Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1 | /* |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 2 | * Copyright (c) 2015-2017 The Khronos Group Inc. |
| 3 | * Copyright (c) 2015-2017 Valve Corporation |
| 4 | * Copyright (c) 2015-2017 LunarG, Inc. |
| 5 | * Copyright (c) 2015-2017 Google, Inc. |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 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" |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 41 | #include "vk_object_types.h" |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 42 | #include "vulkan/vk_layer.h" |
| 43 | |
| 44 | #include "object_tracker.h" |
| 45 | |
Karl Schultz | a9ef1e5 | 2016-10-06 17:53:48 -0600 | [diff] [blame] | 46 | #include "vk_validation_error_messages.h" |
| 47 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 48 | namespace object_tracker { |
| 49 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 50 | static uint32_t loader_layer_if_version = CURRENT_LOADER_LAYER_INTERFACE_VERSION; |
| 51 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 52 | static void InitObjectTracker(layer_data *my_data, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 53 | layer_debug_actions(my_data->report_data, my_data->logging_callback, pAllocator, "lunarg_object_tracker"); |
| 54 | } |
| 55 | |
| 56 | // Add new queue to head of global queue list |
| 57 | static void AddQueueInfo(VkDevice device, uint32_t queue_node_index, VkQueue queue) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 58 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 59 | auto queueItem = device_data->queue_info_map.find(queue); |
| 60 | if (queueItem == device_data->queue_info_map.end()) { |
| 61 | OT_QUEUE_INFO *p_queue_info = new OT_QUEUE_INFO; |
| 62 | if (p_queue_info != NULL) { |
| 63 | memset(p_queue_info, 0, sizeof(OT_QUEUE_INFO)); |
| 64 | p_queue_info->queue = queue; |
| 65 | p_queue_info->queue_node_index = queue_node_index; |
| 66 | device_data->queue_info_map[queue] = p_queue_info; |
| 67 | } else { |
| 68 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, |
| 69 | reinterpret_cast<uint64_t>(queue), __LINE__, OBJTRACK_INTERNAL_ERROR, LayerName, |
| 70 | "ERROR: VK_ERROR_OUT_OF_HOST_MEMORY -- could not allocate memory for Queue Information"); |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | // Destroy memRef lists and free all memory |
| 76 | static void DestroyQueueDataStructures(VkDevice device) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 77 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 78 | |
| 79 | for (auto queue_item : device_data->queue_info_map) { |
| 80 | delete queue_item.second; |
| 81 | } |
| 82 | device_data->queue_info_map.clear(); |
| 83 | |
| 84 | // Destroy the items in the queue map |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 85 | auto queue = device_data->object_map[kVulkanObjectTypeQueue].begin(); |
| 86 | while (queue != device_data->object_map[kVulkanObjectTypeQueue].end()) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 87 | uint32_t obj_index = queue->second->object_type; |
| 88 | assert(device_data->num_total_objects > 0); |
| 89 | device_data->num_total_objects--; |
| 90 | assert(device_data->num_objects[obj_index] > 0); |
| 91 | device_data->num_objects[obj_index]--; |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 92 | log_msg(device_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, |
| 93 | queue->second->handle, __LINE__, OBJTRACK_NONE, LayerName, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 94 | "OBJ_STAT Destroy Queue obj 0x%" PRIxLEAST64 " (%" PRIu64 " total objs remain & %" PRIu64 " Queue objs).", |
| 95 | queue->second->handle, device_data->num_total_objects, device_data->num_objects[obj_index]); |
| 96 | delete queue->second; |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 97 | queue = device_data->object_map[kVulkanObjectTypeQueue].erase(queue); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 98 | } |
| 99 | } |
| 100 | |
| 101 | // Check Queue type flags for selected queue operations |
| 102 | static void ValidateQueueFlags(VkQueue queue, const char *function) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 103 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 104 | auto queue_item = device_data->queue_info_map.find(queue); |
| 105 | if (queue_item != device_data->queue_info_map.end()) { |
| 106 | OT_QUEUE_INFO *pQueueInfo = queue_item->second; |
| 107 | if (pQueueInfo != NULL) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 108 | layer_data *instance_data = GetLayerDataPtr(get_dispatch_key(device_data->physical_device), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 109 | if ((instance_data->queue_family_properties[pQueueInfo->queue_node_index].queueFlags & VK_QUEUE_SPARSE_BINDING_BIT) == |
| 110 | 0) { |
| 111 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, |
Mike Schuchardt | 7fbb7e3 | 2016-12-06 10:56:01 -0700 | [diff] [blame] | 112 | reinterpret_cast<uint64_t>(queue), __LINE__, VALIDATION_ERROR_01651, LayerName, |
| 113 | "Attempting %s on a non-memory-management capable queue -- VK_QUEUE_SPARSE_BINDING_BIT not set. %s", |
| 114 | function, validation_error_map[VALIDATION_ERROR_01651]); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 115 | } |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | static void AllocateCommandBuffer(VkDevice device, const VkCommandPool command_pool, const VkCommandBuffer command_buffer, |
Mark Lobodzinski | e58ffe8 | 2017-04-11 13:57:45 -0600 | [diff] [blame] | 121 | VkCommandBufferLevel level) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 122 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 123 | |
Mark Lobodzinski | e58ffe8 | 2017-04-11 13:57:45 -0600 | [diff] [blame] | 124 | log_msg(device_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 125 | reinterpret_cast<const uint64_t>(command_buffer), __LINE__, OBJTRACK_NONE, LayerName, |
| 126 | "OBJ[0x%" PRIxLEAST64 "] : CREATE %s object 0x%" PRIxLEAST64, object_track_index++, |
Mark Lobodzinski | e58ffe8 | 2017-04-11 13:57:45 -0600 | [diff] [blame] | 127 | "VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT", reinterpret_cast<const uint64_t>(command_buffer)); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 128 | |
| 129 | OBJTRACK_NODE *pNewObjNode = new OBJTRACK_NODE; |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 130 | pNewObjNode->object_type = kVulkanObjectTypeCommandBuffer; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 131 | pNewObjNode->handle = reinterpret_cast<const uint64_t>(command_buffer); |
| 132 | pNewObjNode->parent_object = reinterpret_cast<const uint64_t &>(command_pool); |
| 133 | if (level == VK_COMMAND_BUFFER_LEVEL_SECONDARY) { |
| 134 | pNewObjNode->status = OBJSTATUS_COMMAND_BUFFER_SECONDARY; |
| 135 | } else { |
| 136 | pNewObjNode->status = OBJSTATUS_NONE; |
| 137 | } |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 138 | device_data->object_map[kVulkanObjectTypeCommandBuffer][reinterpret_cast<const uint64_t>(command_buffer)] = pNewObjNode; |
| 139 | device_data->num_objects[kVulkanObjectTypeCommandBuffer]++; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 140 | device_data->num_total_objects++; |
| 141 | } |
| 142 | |
| 143 | static bool ValidateCommandBuffer(VkDevice device, VkCommandPool command_pool, VkCommandBuffer command_buffer) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 144 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 145 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 146 | uint64_t object_handle = reinterpret_cast<uint64_t>(command_buffer); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 147 | if (device_data->object_map[kVulkanObjectTypeCommandBuffer].find(object_handle) != |
| 148 | device_data->object_map[kVulkanObjectTypeCommandBuffer].end()) { |
| 149 | OBJTRACK_NODE *pNode = device_data->object_map[kVulkanObjectTypeCommandBuffer][reinterpret_cast<uint64_t>(command_buffer)]; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 150 | |
| 151 | if (pNode->parent_object != reinterpret_cast<uint64_t &>(command_pool)) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 152 | skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 153 | object_handle, __LINE__, VALIDATION_ERROR_00102, LayerName, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 154 | "FreeCommandBuffers is attempting to free Command Buffer 0x%" PRIxLEAST64 |
| 155 | " belonging to Command Pool 0x%" PRIxLEAST64 " from pool 0x%" PRIxLEAST64 "). %s", |
| 156 | reinterpret_cast<uint64_t>(command_buffer), pNode->parent_object, |
| 157 | reinterpret_cast<uint64_t &>(command_pool), validation_error_map[VALIDATION_ERROR_00102]); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 158 | } |
| 159 | } else { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 160 | skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 161 | object_handle, __LINE__, VALIDATION_ERROR_00097, LayerName, "Invalid %s Object 0x%" PRIxLEAST64 ". %s", |
Mark Lobodzinski | 7459779 | 2017-04-11 15:43:49 -0600 | [diff] [blame] | 162 | object_string[kVulkanObjectTypeCommandBuffer], object_handle, validation_error_map[VALIDATION_ERROR_00097]); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 163 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 164 | return skip; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 165 | } |
| 166 | |
Mark Lobodzinski | e58ffe8 | 2017-04-11 13:57:45 -0600 | [diff] [blame] | 167 | static void AllocateDescriptorSet(VkDevice device, VkDescriptorPool descriptor_pool, VkDescriptorSet descriptor_set) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 168 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 169 | |
Mark Lobodzinski | e58ffe8 | 2017-04-11 13:57:45 -0600 | [diff] [blame] | 170 | log_msg(device_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 171 | reinterpret_cast<uint64_t &>(descriptor_set), __LINE__, OBJTRACK_NONE, LayerName, |
Mark Lobodzinski | e58ffe8 | 2017-04-11 13:57:45 -0600 | [diff] [blame] | 172 | "OBJ[0x%" PRIxLEAST64 "] : CREATE %s object 0x%" PRIxLEAST64, object_track_index++, |
| 173 | "VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT", reinterpret_cast<uint64_t &>(descriptor_set)); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 174 | |
| 175 | OBJTRACK_NODE *pNewObjNode = new OBJTRACK_NODE; |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 176 | pNewObjNode->object_type = kVulkanObjectTypeDescriptorSet; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 177 | pNewObjNode->status = OBJSTATUS_NONE; |
| 178 | pNewObjNode->handle = reinterpret_cast<uint64_t &>(descriptor_set); |
| 179 | pNewObjNode->parent_object = reinterpret_cast<uint64_t &>(descriptor_pool); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 180 | device_data->object_map[kVulkanObjectTypeDescriptorSet][reinterpret_cast<uint64_t &>(descriptor_set)] = pNewObjNode; |
| 181 | device_data->num_objects[kVulkanObjectTypeDescriptorSet]++; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 182 | device_data->num_total_objects++; |
| 183 | } |
| 184 | |
| 185 | static bool ValidateDescriptorSet(VkDevice device, VkDescriptorPool descriptor_pool, VkDescriptorSet descriptor_set) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 186 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 187 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 188 | uint64_t object_handle = reinterpret_cast<uint64_t &>(descriptor_set); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 189 | auto dsItem = device_data->object_map[kVulkanObjectTypeDescriptorSet].find(object_handle); |
| 190 | if (dsItem != device_data->object_map[kVulkanObjectTypeDescriptorSet].end()) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 191 | OBJTRACK_NODE *pNode = dsItem->second; |
| 192 | |
| 193 | if (pNode->parent_object != reinterpret_cast<uint64_t &>(descriptor_pool)) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 194 | skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, |
| 195 | object_handle, __LINE__, VALIDATION_ERROR_00927, LayerName, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 196 | "FreeDescriptorSets is attempting to free descriptorSet 0x%" PRIxLEAST64 |
| 197 | " belonging to Descriptor Pool 0x%" PRIxLEAST64 " from pool 0x%" PRIxLEAST64 "). %s", |
| 198 | reinterpret_cast<uint64_t &>(descriptor_set), pNode->parent_object, |
| 199 | reinterpret_cast<uint64_t &>(descriptor_pool), validation_error_map[VALIDATION_ERROR_00927]); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 200 | } |
| 201 | } else { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 202 | skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, |
| 203 | object_handle, __LINE__, VALIDATION_ERROR_00920, LayerName, "Invalid %s Object 0x%" PRIxLEAST64 ". %s", |
Mark Lobodzinski | 7459779 | 2017-04-11 15:43:49 -0600 | [diff] [blame] | 204 | object_string[kVulkanObjectTypeDescriptorSet], object_handle, validation_error_map[VALIDATION_ERROR_00920]); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 205 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 206 | return skip; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 207 | } |
| 208 | |
Mark Lobodzinski | e58ffe8 | 2017-04-11 13:57:45 -0600 | [diff] [blame] | 209 | static void CreateQueue(VkDevice device, VkQueue vkObj) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 210 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 211 | |
Mark Lobodzinski | e58ffe8 | 2017-04-11 13:57:45 -0600 | [diff] [blame] | 212 | log_msg(device_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, |
| 213 | reinterpret_cast<uint64_t>(vkObj), __LINE__, OBJTRACK_NONE, LayerName, |
| 214 | "OBJ[0x%" PRIxLEAST64 "] : CREATE %s object 0x%" PRIxLEAST64, object_track_index++, |
| 215 | "VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT", reinterpret_cast<uint64_t>(vkObj)); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 216 | |
| 217 | OBJTRACK_NODE *p_obj_node = NULL; |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 218 | auto queue_item = device_data->object_map[kVulkanObjectTypeQueue].find(reinterpret_cast<uint64_t>(vkObj)); |
| 219 | if (queue_item == device_data->object_map[kVulkanObjectTypeQueue].end()) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 220 | p_obj_node = new OBJTRACK_NODE; |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 221 | device_data->object_map[kVulkanObjectTypeQueue][reinterpret_cast<uint64_t>(vkObj)] = p_obj_node; |
| 222 | device_data->num_objects[kVulkanObjectTypeQueue]++; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 223 | device_data->num_total_objects++; |
| 224 | } else { |
| 225 | p_obj_node = queue_item->second; |
| 226 | } |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 227 | p_obj_node->object_type = kVulkanObjectTypeQueue; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 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) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 233 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(dispatchable_object), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 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; |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 240 | pNewObjNode->object_type = kVulkanObjectTypeImage; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 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 | |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [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 | } |
Chris Forbes | 64a31a1 | 2016-10-04 14:54:13 +1300 | [diff] [blame] | 255 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 256 | template <typename T1, typename T2> |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 257 | static void CreateObject(T1 dispatchable_object, T2 object, VulkanObjectType object_type, const VkAllocationCallbacks *pAllocator) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 258 | layer_data *instance_data = GetLayerDataPtr(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 | |
Mike Schuchardt | 21d998c | 2016-12-13 14:04:57 -0700 | [diff] [blame] | 263 | if (!instance_data->object_map[object_type].count(object_handle)) { |
Mark Lobodzinski | c51dbb7 | 2017-04-13 14:25:39 -0600 | [diff] [blame] | 264 | VkDebugReportObjectTypeEXT debug_object_type = get_debug_report_enum[object_type]; |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 265 | log_msg(instance_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, debug_object_type, object_handle, __LINE__, |
Mike Schuchardt | 21d998c | 2016-12-13 14:04:57 -0700 | [diff] [blame] | 266 | OBJTRACK_NONE, LayerName, "OBJ[0x%" PRIxLEAST64 "] : CREATE %s object 0x%" PRIxLEAST64, object_track_index++, |
Mark Lobodzinski | 7459779 | 2017-04-11 15:43:49 -0600 | [diff] [blame] | 267 | object_string[object_type], object_handle); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 268 | |
Mike Schuchardt | 21d998c | 2016-12-13 14:04:57 -0700 | [diff] [blame] | 269 | OBJTRACK_NODE *pNewObjNode = new OBJTRACK_NODE; |
| 270 | pNewObjNode->object_type = object_type; |
| 271 | pNewObjNode->status = custom_allocator ? OBJSTATUS_CUSTOM_ALLOCATOR : OBJSTATUS_NONE; |
| 272 | pNewObjNode->handle = object_handle; |
| 273 | |
| 274 | instance_data->object_map[object_type][object_handle] = pNewObjNode; |
| 275 | instance_data->num_objects[object_type]++; |
| 276 | instance_data->num_total_objects++; |
| 277 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | template <typename T1, typename T2> |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 281 | static void DestroyObject(T1 dispatchable_object, T2 object, VulkanObjectType object_type, const VkAllocationCallbacks *pAllocator, |
| 282 | enum UNIQUE_VALIDATION_ERROR_CODE expected_custom_allocator_code, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 283 | enum UNIQUE_VALIDATION_ERROR_CODE expected_default_allocator_code) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 284 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(dispatchable_object), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 285 | |
Chris Forbes | 64a31a1 | 2016-10-04 14:54:13 +1300 | [diff] [blame] | 286 | auto object_handle = handle_value(object); |
Mark Lobodzinski | 4dc768c | 2016-10-03 16:01:12 -0600 | [diff] [blame] | 287 | bool custom_allocator = pAllocator != nullptr; |
Mark Lobodzinski | c51dbb7 | 2017-04-13 14:25:39 -0600 | [diff] [blame] | 288 | VkDebugReportObjectTypeEXT debug_object_type = get_debug_report_enum[object_type]; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 289 | |
Mark Lobodzinski | 3b9f8e7 | 2016-11-17 10:56:14 -0700 | [diff] [blame] | 290 | if (object_handle != VK_NULL_HANDLE) { |
| 291 | auto item = device_data->object_map[object_type].find(object_handle); |
| 292 | if (item != device_data->object_map[object_type].end()) { |
Mark Lobodzinski | 3b9f8e7 | 2016-11-17 10:56:14 -0700 | [diff] [blame] | 293 | OBJTRACK_NODE *pNode = item->second; |
| 294 | assert(device_data->num_total_objects > 0); |
| 295 | device_data->num_total_objects--; |
| 296 | assert(device_data->num_objects[pNode->object_type] > 0); |
| 297 | device_data->num_objects[pNode->object_type]--; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 298 | |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 299 | log_msg(device_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, debug_object_type, object_handle, __LINE__, |
Mark Lobodzinski | 3b9f8e7 | 2016-11-17 10:56:14 -0700 | [diff] [blame] | 300 | OBJTRACK_NONE, LayerName, |
| 301 | "OBJ_STAT Destroy %s obj 0x%" PRIxLEAST64 " (%" PRIu64 " total objs remain & %" PRIu64 " %s objs).", |
Mark Lobodzinski | 7459779 | 2017-04-11 15:43:49 -0600 | [diff] [blame] | 302 | object_string[object_type], reinterpret_cast<uint64_t &>(object), device_data->num_total_objects, |
| 303 | device_data->num_objects[pNode->object_type], object_string[object_type]); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 304 | |
Mark Lobodzinski | 3b9f8e7 | 2016-11-17 10:56:14 -0700 | [diff] [blame] | 305 | auto allocated_with_custom = (pNode->status & OBJSTATUS_CUSTOM_ALLOCATOR) ? true : false; |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 306 | if (allocated_with_custom && !custom_allocator && expected_custom_allocator_code != VALIDATION_ERROR_UNDEFINED) { |
Mark Young | dee312c | 2017-03-08 13:38:35 -0700 | [diff] [blame] | 307 | // This check only verifies that custom allocation callbacks were provided to both Create and Destroy calls, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 308 | // it cannot verify that these allocation callbacks are compatible with each other. |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 309 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, debug_object_type, object_handle, __LINE__, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 310 | expected_custom_allocator_code, LayerName, |
| 311 | "Custom allocator not specified while destroying %s obj 0x%" PRIxLEAST64 " but specified at creation. %s", |
Mark Lobodzinski | 7459779 | 2017-04-11 15:43:49 -0600 | [diff] [blame] | 312 | object_string[object_type], object_handle, validation_error_map[expected_custom_allocator_code]); |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 313 | } else if (!allocated_with_custom && custom_allocator && |
| 314 | expected_default_allocator_code != VALIDATION_ERROR_UNDEFINED) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 315 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, debug_object_type, object_handle, __LINE__, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 316 | expected_default_allocator_code, LayerName, |
| 317 | "Custom allocator specified while destroying %s obj 0x%" PRIxLEAST64 " but not specified at creation. %s", |
Mark Lobodzinski | 7459779 | 2017-04-11 15:43:49 -0600 | [diff] [blame] | 318 | object_string[object_type], object_handle, validation_error_map[expected_default_allocator_code]); |
Mark Lobodzinski | 3b9f8e7 | 2016-11-17 10:56:14 -0700 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | delete pNode; |
| 322 | device_data->object_map[object_type].erase(item); |
| 323 | } else { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 324 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, object_handle, |
| 325 | __LINE__, OBJTRACK_UNKNOWN_OBJECT, LayerName, |
Mark Lobodzinski | 3b9f8e7 | 2016-11-17 10:56:14 -0700 | [diff] [blame] | 326 | "Unable to remove %s obj 0x%" PRIxLEAST64 ". Was it created? Has it already been destroyed?", |
Mark Lobodzinski | 7459779 | 2017-04-11 15:43:49 -0600 | [diff] [blame] | 327 | object_string[object_type], object_handle); |
Chris Forbes | 3e51a20 | 2016-09-29 14:35:09 +1300 | [diff] [blame] | 328 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 329 | } |
| 330 | } |
| 331 | |
| 332 | template <typename T1, typename T2> |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 333 | static bool ValidateObject(T1 dispatchable_object, T2 object, VulkanObjectType object_type, bool null_allowed, |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 334 | enum UNIQUE_VALIDATION_ERROR_CODE invalid_handle_code, |
| 335 | enum UNIQUE_VALIDATION_ERROR_CODE wrong_device_code) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 336 | if (null_allowed && (object == VK_NULL_HANDLE)) { |
| 337 | return false; |
| 338 | } |
Chris Forbes | 64a31a1 | 2016-10-04 14:54:13 +1300 | [diff] [blame] | 339 | auto object_handle = handle_value(object); |
Mark Lobodzinski | c51dbb7 | 2017-04-13 14:25:39 -0600 | [diff] [blame] | 340 | VkDebugReportObjectTypeEXT debug_object_type = get_debug_report_enum[object_type]; |
Chris Forbes | 64a31a1 | 2016-10-04 14:54:13 +1300 | [diff] [blame] | 341 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 342 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(dispatchable_object), layer_data_map); |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 343 | // Look for object in device object map |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 344 | 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] | 345 | // If object is an image, also look for it in the swapchain image map |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 346 | if ((object_type != kVulkanObjectTypeImage) || |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 347 | (device_data->swapchainImageMap.find(object_handle) == device_data->swapchainImageMap.end())) { |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 348 | // Object not found, look for it in other device object maps |
| 349 | for (auto other_device_data : layer_data_map) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 350 | if (other_device_data.second != device_data) { |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 351 | if (other_device_data.second->object_map[object_type].find(object_handle) != |
| 352 | other_device_data.second->object_map[object_type].end() || |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 353 | (object_type == kVulkanObjectTypeImage && other_device_data.second->swapchainImageMap.find(object_handle) != |
| 354 | other_device_data.second->swapchainImageMap.end())) { |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 355 | // Object found on other device, report an error if object has a device parent error code |
| 356 | if (wrong_device_code != VALIDATION_ERROR_UNDEFINED) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 357 | return log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, debug_object_type, |
| 358 | object_handle, __LINE__, wrong_device_code, LayerName, |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 359 | "Object 0x%" PRIxLEAST64 |
| 360 | " was not created, allocated or retrieved from the correct device. %s", |
| 361 | object_handle, validation_error_map[wrong_device_code]); |
| 362 | } else { |
| 363 | return false; |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | // Report an error if object was not found anywhere |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 369 | return log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, debug_object_type, object_handle, __LINE__, |
| 370 | invalid_handle_code, LayerName, "Invalid %s Object 0x%" PRIxLEAST64 ". %s", |
Mark Lobodzinski | 7459779 | 2017-04-11 15:43:49 -0600 | [diff] [blame] | 371 | object_string[object_type], object_handle, validation_error_map[invalid_handle_code]); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 372 | } |
| 373 | } |
| 374 | return false; |
| 375 | } |
| 376 | |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 377 | static void DeviceReportUndestroyedObjects(VkDevice device, VulkanObjectType object_type, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 378 | enum UNIQUE_VALIDATION_ERROR_CODE error_code) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 379 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 380 | for (auto item = device_data->object_map[object_type].begin(); item != device_data->object_map[object_type].end();) { |
| 381 | OBJTRACK_NODE *object_info = item->second; |
Mark Lobodzinski | c51dbb7 | 2017-04-13 14:25:39 -0600 | [diff] [blame] | 382 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, get_debug_report_enum[object_type], object_info->handle, |
Mark Lobodzinski | 7459779 | 2017-04-11 15:43:49 -0600 | [diff] [blame] | 383 | __LINE__, error_code, LayerName, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 384 | "OBJ ERROR : For device 0x%" PRIxLEAST64 ", %s object 0x%" PRIxLEAST64 " has not been destroyed. %s", |
Mark Lobodzinski | 7459779 | 2017-04-11 15:43:49 -0600 | [diff] [blame] | 385 | reinterpret_cast<uint64_t>(device), object_string[object_type], object_info->handle, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 386 | validation_error_map[error_code]); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 387 | item = device_data->object_map[object_type].erase(item); |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { |
| 392 | std::unique_lock<std::mutex> lock(global_lock); |
| 393 | |
| 394 | dispatch_key key = get_dispatch_key(instance); |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 395 | layer_data *instance_data = GetLayerDataPtr(key, layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 396 | |
| 397 | // Enable the temporary callback(s) here to catch cleanup issues: |
| 398 | bool callback_setup = false; |
| 399 | if (instance_data->num_tmp_callbacks > 0) { |
| 400 | if (!layer_enable_tmp_callbacks(instance_data->report_data, instance_data->num_tmp_callbacks, |
| 401 | instance_data->tmp_dbg_create_infos, instance_data->tmp_callbacks)) { |
| 402 | callback_setup = true; |
| 403 | } |
| 404 | } |
| 405 | |
Jeremy Hayes | 058b41c | 2016-11-03 10:49:44 -0600 | [diff] [blame] | 406 | // TODO: The instance handle can not be validated here. The loader will likely have to validate it. |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 407 | ValidateObject(instance, instance, kVulkanObjectTypeInstance, true, VALIDATION_ERROR_00021, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 408 | |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 409 | DestroyObject(instance, instance, kVulkanObjectTypeInstance, pAllocator, VALIDATION_ERROR_00019, VALIDATION_ERROR_00020); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 410 | // Report any remaining objects in LL |
| 411 | |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 412 | for (auto iit = instance_data->object_map[kVulkanObjectTypeDevice].begin(); |
| 413 | iit != instance_data->object_map[kVulkanObjectTypeDevice].end();) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 414 | OBJTRACK_NODE *pNode = iit->second; |
| 415 | |
| 416 | VkDevice device = reinterpret_cast<VkDevice>(pNode->handle); |
Mark Lobodzinski | c51dbb7 | 2017-04-13 14:25:39 -0600 | [diff] [blame] | 417 | VkDebugReportObjectTypeEXT debug_object_type = get_debug_report_enum[pNode->object_type]; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 418 | |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 419 | log_msg(instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, debug_object_type, pNode->handle, __LINE__, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 420 | OBJTRACK_OBJECT_LEAK, LayerName, "OBJ ERROR : %s object 0x%" PRIxLEAST64 " has not been destroyed.", |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 421 | string_VkDebugReportObjectTypeEXT(debug_object_type), pNode->handle); |
| 422 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeCommandBuffer, VALIDATION_ERROR_00018); |
| 423 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeSemaphore, VALIDATION_ERROR_00018); |
| 424 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeFence, VALIDATION_ERROR_00018); |
| 425 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDeviceMemory, VALIDATION_ERROR_00018); |
| 426 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeBuffer, VALIDATION_ERROR_00018); |
| 427 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeImage, VALIDATION_ERROR_00018); |
| 428 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeEvent, VALIDATION_ERROR_00018); |
| 429 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeQueryPool, VALIDATION_ERROR_00018); |
| 430 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeBufferView, VALIDATION_ERROR_00018); |
| 431 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeImageView, VALIDATION_ERROR_00018); |
| 432 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeShaderModule, VALIDATION_ERROR_00018); |
| 433 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypePipelineCache, VALIDATION_ERROR_00018); |
| 434 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypePipelineLayout, VALIDATION_ERROR_00018); |
| 435 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeRenderPass, VALIDATION_ERROR_00018); |
| 436 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypePipeline, VALIDATION_ERROR_00018); |
| 437 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDescriptorSetLayout, VALIDATION_ERROR_00018); |
| 438 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeSampler, VALIDATION_ERROR_00018); |
| 439 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDescriptorPool, VALIDATION_ERROR_00018); |
| 440 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDescriptorSet, VALIDATION_ERROR_00018); |
| 441 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeFramebuffer, VALIDATION_ERROR_00018); |
| 442 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeCommandPool, VALIDATION_ERROR_00018); |
| 443 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeSurfaceKHR, VALIDATION_ERROR_00018); |
| 444 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeSwapchainKHR, VALIDATION_ERROR_00018); |
| 445 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDisplayKHR, VALIDATION_ERROR_00018); |
| 446 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDisplayModeKHR, VALIDATION_ERROR_00018); |
| 447 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDescriptorUpdateTemplateKHR, VALIDATION_ERROR_00018); |
| 448 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDebugReportCallbackEXT, VALIDATION_ERROR_00018); |
| 449 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeObjectTableNVX, VALIDATION_ERROR_00018); |
| 450 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeIndirectCommandsLayoutNVX, VALIDATION_ERROR_00018); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 451 | } |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 452 | instance_data->object_map[kVulkanObjectTypeDevice].clear(); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 453 | |
| 454 | VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ot_instance_table_map, instance); |
| 455 | pInstanceTable->DestroyInstance(instance, pAllocator); |
| 456 | |
| 457 | // Disable and cleanup the temporary callback(s): |
| 458 | if (callback_setup) { |
| 459 | layer_disable_tmp_callbacks(instance_data->report_data, instance_data->num_tmp_callbacks, instance_data->tmp_callbacks); |
| 460 | } |
| 461 | if (instance_data->num_tmp_callbacks > 0) { |
| 462 | layer_free_tmp_callbacks(instance_data->tmp_dbg_create_infos, instance_data->tmp_callbacks); |
| 463 | instance_data->num_tmp_callbacks = 0; |
| 464 | } |
| 465 | |
| 466 | // Clean up logging callback, if any |
| 467 | while (instance_data->logging_callback.size() > 0) { |
| 468 | VkDebugReportCallbackEXT callback = instance_data->logging_callback.back(); |
| 469 | layer_destroy_msg_callback(instance_data->report_data, callback, pAllocator); |
| 470 | instance_data->logging_callback.pop_back(); |
| 471 | } |
| 472 | |
| 473 | layer_debug_report_destroy_instance(instance_data->report_data); |
| 474 | layer_data_map.erase(key); |
| 475 | |
| 476 | instanceExtMap.erase(pInstanceTable); |
| 477 | lock.unlock(); |
| 478 | ot_instance_table_map.erase(key); |
| 479 | } |
| 480 | |
| 481 | VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 482 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 483 | ValidateObject(device, device, kVulkanObjectTypeDevice, true, VALIDATION_ERROR_00052, VALIDATION_ERROR_UNDEFINED); |
| 484 | DestroyObject(device, device, kVulkanObjectTypeDevice, pAllocator, VALIDATION_ERROR_00050, VALIDATION_ERROR_00051); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 485 | |
| 486 | // Report any remaining objects associated with this VkDevice object in LL |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 487 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeSemaphore, VALIDATION_ERROR_00049); |
| 488 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeFence, VALIDATION_ERROR_00049); |
| 489 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDeviceMemory, VALIDATION_ERROR_00049); |
| 490 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeBuffer, VALIDATION_ERROR_00049); |
| 491 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeImage, VALIDATION_ERROR_00049); |
| 492 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeEvent, VALIDATION_ERROR_00049); |
| 493 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeQueryPool, VALIDATION_ERROR_00049); |
| 494 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeBufferView, VALIDATION_ERROR_00049); |
| 495 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeImageView, VALIDATION_ERROR_00049); |
| 496 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeShaderModule, VALIDATION_ERROR_00049); |
| 497 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypePipelineCache, VALIDATION_ERROR_00049); |
| 498 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypePipelineLayout, VALIDATION_ERROR_00049); |
| 499 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeRenderPass, VALIDATION_ERROR_00049); |
| 500 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypePipeline, VALIDATION_ERROR_00049); |
| 501 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDescriptorSetLayout, VALIDATION_ERROR_00049); |
| 502 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeSampler, VALIDATION_ERROR_00049); |
| 503 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDescriptorPool, VALIDATION_ERROR_00049); |
| 504 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDescriptorSet, VALIDATION_ERROR_00049); |
| 505 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeFramebuffer, VALIDATION_ERROR_00049); |
| 506 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeCommandPool, VALIDATION_ERROR_00049); |
| 507 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeSurfaceKHR, VALIDATION_ERROR_00049); |
| 508 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeSwapchainKHR, VALIDATION_ERROR_00049); |
| 509 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDisplayKHR, VALIDATION_ERROR_00049); |
| 510 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDisplayModeKHR, VALIDATION_ERROR_00049); |
| 511 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDescriptorUpdateTemplateKHR, VALIDATION_ERROR_00049); |
| 512 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeDebugReportCallbackEXT, VALIDATION_ERROR_00049); |
| 513 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeObjectTableNVX, VALIDATION_ERROR_00049); |
| 514 | DeviceReportUndestroyedObjects(device, kVulkanObjectTypeIndirectCommandsLayoutNVX, VALIDATION_ERROR_00049); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 515 | |
| 516 | // Clean up Queue's MemRef Linked Lists |
| 517 | DestroyQueueDataStructures(device); |
| 518 | |
| 519 | lock.unlock(); |
| 520 | |
| 521 | dispatch_key key = get_dispatch_key(device); |
| 522 | VkLayerDispatchTable *pDisp = get_dispatch_table(ot_device_table_map, device); |
| 523 | pDisp->DestroyDevice(device, pAllocator); |
| 524 | ot_device_table_map.erase(key); |
| 525 | } |
| 526 | |
| 527 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 528 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 529 | { |
| 530 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 531 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01679, |
| 532 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 533 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 534 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 535 | return; |
| 536 | } |
| 537 | get_dispatch_table(ot_instance_table_map, physicalDevice)->GetPhysicalDeviceFeatures(physicalDevice, pFeatures); |
| 538 | } |
| 539 | |
| 540 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 541 | VkFormatProperties *pFormatProperties) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 542 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 543 | { |
| 544 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 545 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01683, |
| 546 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 547 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 548 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 549 | return; |
| 550 | } |
| 551 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 552 | ->GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties); |
| 553 | } |
| 554 | |
| 555 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 556 | VkImageType type, VkImageTiling tiling, |
| 557 | VkImageUsageFlags usage, VkImageCreateFlags flags, |
| 558 | VkImageFormatProperties *pImageFormatProperties) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 559 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 560 | { |
| 561 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 562 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01686, |
| 563 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 564 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 565 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 566 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 567 | } |
| 568 | VkResult result = |
| 569 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 570 | ->GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties); |
| 571 | return result; |
| 572 | } |
| 573 | |
| 574 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 575 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 576 | { |
| 577 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 578 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_00026, |
| 579 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 580 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 581 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 582 | return; |
| 583 | } |
| 584 | get_dispatch_table(ot_instance_table_map, physicalDevice)->GetPhysicalDeviceProperties(physicalDevice, pProperties); |
| 585 | } |
| 586 | |
| 587 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, |
| 588 | VkPhysicalDeviceMemoryProperties *pMemoryProperties) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 589 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 590 | { |
| 591 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 592 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_00609, |
| 593 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 594 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 595 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 596 | return; |
| 597 | } |
| 598 | get_dispatch_table(ot_instance_table_map, physicalDevice)->GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties); |
| 599 | } |
| 600 | |
| 601 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char *pName); |
| 602 | |
| 603 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *pName); |
| 604 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 605 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetPhysicalDeviceProcAddr(VkInstance instance, const char *funcName); |
| 606 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 607 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount, |
| 608 | VkExtensionProperties *pProperties); |
| 609 | |
| 610 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pPropertyCount, VkLayerProperties *pProperties); |
| 611 | |
| 612 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 613 | VkLayerProperties *pProperties); |
| 614 | |
| 615 | VKAPI_ATTR VkResult VKAPI_CALL QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 616 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 617 | { |
| 618 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 619 | skip |= ValidateObject(queue, fence, kVulkanObjectTypeFence, true, VALIDATION_ERROR_00130, VALIDATION_ERROR_00131); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 620 | if (pSubmits) { |
| 621 | for (uint32_t idx0 = 0; idx0 < submitCount; ++idx0) { |
| 622 | if (pSubmits[idx0].pCommandBuffers) { |
| 623 | for (uint32_t idx1 = 0; idx1 < pSubmits[idx0].commandBufferCount; ++idx1) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 624 | skip |= ValidateObject(queue, pSubmits[idx0].pCommandBuffers[idx1], kVulkanObjectTypeCommandBuffer, false, |
| 625 | VALIDATION_ERROR_00149, VALIDATION_ERROR_00151); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 626 | } |
| 627 | } |
| 628 | if (pSubmits[idx0].pSignalSemaphores) { |
| 629 | for (uint32_t idx2 = 0; idx2 < pSubmits[idx0].signalSemaphoreCount; ++idx2) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 630 | skip |= ValidateObject(queue, pSubmits[idx0].pSignalSemaphores[idx2], kVulkanObjectTypeSemaphore, false, |
| 631 | VALIDATION_ERROR_00150, VALIDATION_ERROR_00151); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 632 | } |
| 633 | } |
| 634 | if (pSubmits[idx0].pWaitSemaphores) { |
| 635 | for (uint32_t idx3 = 0; idx3 < pSubmits[idx0].waitSemaphoreCount; ++idx3) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 636 | skip |= ValidateObject(queue, pSubmits[idx0].pWaitSemaphores[idx3], kVulkanObjectTypeSemaphore, false, |
| 637 | VALIDATION_ERROR_00146, VALIDATION_ERROR_00151); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 638 | } |
| 639 | } |
| 640 | } |
| 641 | } |
| 642 | if (queue) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 643 | skip |= ValidateObject(queue, queue, kVulkanObjectTypeQueue, false, VALIDATION_ERROR_00128, VALIDATION_ERROR_00131); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 644 | } |
| 645 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 646 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 647 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 648 | } |
| 649 | VkResult result = get_dispatch_table(ot_device_table_map, queue)->QueueSubmit(queue, submitCount, pSubmits, fence); |
| 650 | return result; |
| 651 | } |
| 652 | |
| 653 | VKAPI_ATTR VkResult VKAPI_CALL QueueWaitIdle(VkQueue queue) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 654 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 655 | { |
| 656 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 657 | skip |= ValidateObject(queue, queue, kVulkanObjectTypeQueue, false, VALIDATION_ERROR_00317, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 658 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 659 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 660 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 661 | } |
| 662 | VkResult result = get_dispatch_table(ot_device_table_map, queue)->QueueWaitIdle(queue); |
| 663 | return result; |
| 664 | } |
| 665 | |
| 666 | VKAPI_ATTR VkResult VKAPI_CALL DeviceWaitIdle(VkDevice device) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 667 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 668 | { |
| 669 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 670 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00318, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 671 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 672 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 673 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 674 | } |
| 675 | VkResult result = get_dispatch_table(ot_device_table_map, device)->DeviceWaitIdle(device); |
| 676 | return result; |
| 677 | } |
| 678 | |
| 679 | VKAPI_ATTR VkResult VKAPI_CALL AllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, |
| 680 | const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 681 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 682 | { |
| 683 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 684 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00612, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 685 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 686 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 687 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 688 | } |
| 689 | VkResult result = get_dispatch_table(ot_device_table_map, device)->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory); |
| 690 | { |
| 691 | std::lock_guard<std::mutex> lock(global_lock); |
| 692 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 693 | CreateObject(device, *pMemory, kVulkanObjectTypeDeviceMemory, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 694 | } |
| 695 | } |
| 696 | return result; |
| 697 | } |
| 698 | |
| 699 | VKAPI_ATTR VkResult VKAPI_CALL FlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, |
| 700 | const VkMappedMemoryRange *pMemoryRanges) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 701 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 702 | { |
| 703 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 704 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00635, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 705 | if (pMemoryRanges) { |
| 706 | for (uint32_t idx0 = 0; idx0 < memoryRangeCount; ++idx0) { |
| 707 | if (pMemoryRanges[idx0].memory) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 708 | skip |= ValidateObject(device, pMemoryRanges[idx0].memory, kVulkanObjectTypeDeviceMemory, false, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 709 | VALIDATION_ERROR_00648, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 710 | } |
| 711 | } |
| 712 | } |
| 713 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 714 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 715 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 716 | } |
| 717 | VkResult result = |
| 718 | get_dispatch_table(ot_device_table_map, device)->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
| 719 | return result; |
| 720 | } |
| 721 | |
| 722 | VKAPI_ATTR VkResult VKAPI_CALL InvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, |
| 723 | const VkMappedMemoryRange *pMemoryRanges) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 724 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 725 | { |
| 726 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 727 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00638, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 728 | if (pMemoryRanges) { |
| 729 | for (uint32_t idx0 = 0; idx0 < memoryRangeCount; ++idx0) { |
| 730 | if (pMemoryRanges[idx0].memory) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 731 | skip |= ValidateObject(device, pMemoryRanges[idx0].memory, kVulkanObjectTypeDeviceMemory, false, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 732 | VALIDATION_ERROR_00648, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 733 | } |
| 734 | } |
| 735 | } |
| 736 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 737 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 738 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 739 | } |
| 740 | VkResult result = |
| 741 | get_dispatch_table(ot_device_table_map, device)->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
| 742 | return result; |
| 743 | } |
| 744 | |
| 745 | VKAPI_ATTR void VKAPI_CALL GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, |
| 746 | VkDeviceSize *pCommittedMemoryInBytes) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 747 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 748 | { |
| 749 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 750 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00654, VALIDATION_ERROR_UNDEFINED); |
| 751 | skip |= |
| 752 | ValidateObject(device, memory, kVulkanObjectTypeDeviceMemory, false, VALIDATION_ERROR_00655, VALIDATION_ERROR_00657); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 753 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 754 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 755 | return; |
| 756 | } |
| 757 | get_dispatch_table(ot_device_table_map, device)->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); |
| 758 | } |
| 759 | |
| 760 | VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, |
| 761 | VkDeviceSize memoryOffset) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 762 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 763 | { |
| 764 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 765 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00798, VALIDATION_ERROR_UNDEFINED); |
| 766 | skip |= ValidateObject(device, buffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_00799, VALIDATION_ERROR_00801); |
| 767 | skip |= |
| 768 | ValidateObject(device, memory, kVulkanObjectTypeDeviceMemory, false, VALIDATION_ERROR_00800, VALIDATION_ERROR_00802); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 769 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 770 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 771 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 772 | } |
| 773 | VkResult result = get_dispatch_table(ot_device_table_map, device)->BindBufferMemory(device, buffer, memory, memoryOffset); |
| 774 | return result; |
| 775 | } |
| 776 | |
| 777 | VKAPI_ATTR VkResult VKAPI_CALL BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 778 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 779 | { |
| 780 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 781 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00807, VALIDATION_ERROR_UNDEFINED); |
| 782 | skip |= ValidateObject(device, image, kVulkanObjectTypeImage, false, VALIDATION_ERROR_00808, VALIDATION_ERROR_00810); |
| 783 | skip |= |
| 784 | ValidateObject(device, memory, kVulkanObjectTypeDeviceMemory, false, VALIDATION_ERROR_00809, VALIDATION_ERROR_00811); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 785 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 786 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 787 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 788 | } |
| 789 | VkResult result = get_dispatch_table(ot_device_table_map, device)->BindImageMemory(device, image, memory, memoryOffset); |
| 790 | return result; |
| 791 | } |
| 792 | |
| 793 | VKAPI_ATTR void VKAPI_CALL GetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, |
| 794 | VkMemoryRequirements *pMemoryRequirements) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 795 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 796 | { |
| 797 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 798 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00783, VALIDATION_ERROR_UNDEFINED); |
| 799 | skip |= ValidateObject(device, buffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_00784, VALIDATION_ERROR_00786); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 800 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 801 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 802 | return; |
| 803 | } |
| 804 | get_dispatch_table(ot_device_table_map, device)->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements); |
| 805 | } |
| 806 | |
| 807 | VKAPI_ATTR void VKAPI_CALL GetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 808 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 809 | { |
| 810 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 811 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00787, VALIDATION_ERROR_UNDEFINED); |
| 812 | skip |= ValidateObject(device, image, kVulkanObjectTypeImage, false, VALIDATION_ERROR_00788, VALIDATION_ERROR_00790); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 813 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 814 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 815 | return; |
| 816 | } |
| 817 | get_dispatch_table(ot_device_table_map, device)->GetImageMemoryRequirements(device, image, pMemoryRequirements); |
| 818 | } |
| 819 | |
| 820 | VKAPI_ATTR void VKAPI_CALL GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, |
| 821 | VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 822 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 823 | { |
| 824 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 825 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_01610, VALIDATION_ERROR_UNDEFINED); |
| 826 | skip |= ValidateObject(device, image, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01611, VALIDATION_ERROR_01614); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 827 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 828 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 829 | return; |
| 830 | } |
| 831 | get_dispatch_table(ot_device_table_map, device) |
| 832 | ->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 833 | } |
| 834 | |
| 835 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 836 | VkImageType type, VkSampleCountFlagBits samples, |
| 837 | VkImageUsageFlags usage, VkImageTiling tiling, |
| 838 | uint32_t *pPropertyCount, |
| 839 | VkSparseImageFormatProperties *pProperties) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 840 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 841 | { |
| 842 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 843 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01601, |
| 844 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 845 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 846 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 847 | return; |
| 848 | } |
| 849 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 850 | ->GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, |
| 851 | pProperties); |
| 852 | } |
| 853 | |
| 854 | VKAPI_ATTR VkResult VKAPI_CALL CreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, |
| 855 | const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 856 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 857 | { |
| 858 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 859 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00166, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 860 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 861 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 862 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 863 | } |
| 864 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateFence(device, pCreateInfo, pAllocator, pFence); |
| 865 | { |
| 866 | std::lock_guard<std::mutex> lock(global_lock); |
| 867 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 868 | CreateObject(device, *pFence, kVulkanObjectTypeFence, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 869 | } |
| 870 | } |
| 871 | return result; |
| 872 | } |
| 873 | |
| 874 | VKAPI_ATTR void VKAPI_CALL DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 875 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 876 | { |
| 877 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 878 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00176, VALIDATION_ERROR_UNDEFINED); |
| 879 | skip |= ValidateObject(device, fence, kVulkanObjectTypeFence, true, VALIDATION_ERROR_00177, VALIDATION_ERROR_00179); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 880 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 881 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 882 | return; |
| 883 | } |
| 884 | { |
| 885 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 886 | DestroyObject(device, fence, kVulkanObjectTypeFence, pAllocator, VALIDATION_ERROR_00174, VALIDATION_ERROR_00175); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 887 | } |
| 888 | get_dispatch_table(ot_device_table_map, device)->DestroyFence(device, fence, pAllocator); |
| 889 | } |
| 890 | |
| 891 | VKAPI_ATTR VkResult VKAPI_CALL ResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 892 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 893 | { |
| 894 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 895 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00184, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 896 | if (pFences) { |
| 897 | for (uint32_t idx0 = 0; idx0 < fenceCount; ++idx0) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 898 | skip |= ValidateObject(device, pFences[idx0], kVulkanObjectTypeFence, false, VALIDATION_ERROR_00185, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 899 | VALIDATION_ERROR_00187); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 900 | } |
| 901 | } |
| 902 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 903 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 904 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 905 | } |
| 906 | VkResult result = get_dispatch_table(ot_device_table_map, device)->ResetFences(device, fenceCount, pFences); |
| 907 | return result; |
| 908 | } |
| 909 | |
| 910 | VKAPI_ATTR VkResult VKAPI_CALL GetFenceStatus(VkDevice device, VkFence fence) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 911 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 912 | { |
| 913 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 914 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00180, VALIDATION_ERROR_UNDEFINED); |
| 915 | skip |= ValidateObject(device, fence, kVulkanObjectTypeFence, false, VALIDATION_ERROR_00181, VALIDATION_ERROR_00182); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 916 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 917 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 918 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 919 | } |
| 920 | VkResult result = get_dispatch_table(ot_device_table_map, device)->GetFenceStatus(device, fence); |
| 921 | return result; |
| 922 | } |
| 923 | |
| 924 | VKAPI_ATTR VkResult VKAPI_CALL WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, |
| 925 | uint64_t timeout) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 926 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 927 | { |
| 928 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 929 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00188, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 930 | if (pFences) { |
| 931 | for (uint32_t idx0 = 0; idx0 < fenceCount; ++idx0) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 932 | skip |= ValidateObject(device, pFences[idx0], kVulkanObjectTypeFence, false, VALIDATION_ERROR_00189, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 933 | VALIDATION_ERROR_00191); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 934 | } |
| 935 | } |
| 936 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 937 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 938 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 939 | } |
| 940 | VkResult result = get_dispatch_table(ot_device_table_map, device)->WaitForFences(device, fenceCount, pFences, waitAll, timeout); |
| 941 | return result; |
| 942 | } |
| 943 | |
| 944 | VKAPI_ATTR VkResult VKAPI_CALL CreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, |
| 945 | const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 946 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 947 | { |
| 948 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 949 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00192, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 950 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 951 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 952 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 953 | } |
| 954 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore); |
| 955 | { |
| 956 | std::lock_guard<std::mutex> lock(global_lock); |
| 957 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 958 | CreateObject(device, *pSemaphore, kVulkanObjectTypeSemaphore, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 959 | } |
| 960 | } |
| 961 | return result; |
| 962 | } |
| 963 | |
| 964 | VKAPI_ATTR void VKAPI_CALL DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 965 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 966 | { |
| 967 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 968 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00202, VALIDATION_ERROR_UNDEFINED); |
| 969 | skip |= ValidateObject(device, semaphore, kVulkanObjectTypeSemaphore, true, VALIDATION_ERROR_00203, VALIDATION_ERROR_00205); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 970 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 971 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 972 | return; |
| 973 | } |
| 974 | { |
| 975 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 976 | DestroyObject(device, semaphore, kVulkanObjectTypeSemaphore, pAllocator, VALIDATION_ERROR_00200, VALIDATION_ERROR_00201); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 977 | } |
| 978 | get_dispatch_table(ot_device_table_map, device)->DestroySemaphore(device, semaphore, pAllocator); |
| 979 | } |
| 980 | |
| 981 | VKAPI_ATTR VkResult VKAPI_CALL CreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, |
| 982 | const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 983 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 984 | { |
| 985 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 986 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00206, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 987 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 988 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 989 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 990 | } |
| 991 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateEvent(device, pCreateInfo, pAllocator, pEvent); |
| 992 | { |
| 993 | std::lock_guard<std::mutex> lock(global_lock); |
| 994 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 995 | CreateObject(device, *pEvent, kVulkanObjectTypeEvent, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 996 | } |
| 997 | } |
| 998 | return result; |
| 999 | } |
| 1000 | |
| 1001 | VKAPI_ATTR void VKAPI_CALL DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1002 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1003 | { |
| 1004 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1005 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00216, VALIDATION_ERROR_UNDEFINED); |
| 1006 | skip |= ValidateObject(device, event, kVulkanObjectTypeEvent, true, VALIDATION_ERROR_00217, VALIDATION_ERROR_00219); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1007 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1008 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1009 | return; |
| 1010 | } |
| 1011 | { |
| 1012 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1013 | DestroyObject(device, event, kVulkanObjectTypeEvent, pAllocator, VALIDATION_ERROR_00214, VALIDATION_ERROR_00215); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1014 | } |
| 1015 | get_dispatch_table(ot_device_table_map, device)->DestroyEvent(device, event, pAllocator); |
| 1016 | } |
| 1017 | |
| 1018 | VKAPI_ATTR VkResult VKAPI_CALL GetEventStatus(VkDevice device, VkEvent event) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1019 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1020 | { |
| 1021 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1022 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00220, VALIDATION_ERROR_UNDEFINED); |
| 1023 | skip |= ValidateObject(device, event, kVulkanObjectTypeEvent, false, VALIDATION_ERROR_00221, VALIDATION_ERROR_00222); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1024 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1025 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1026 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1027 | } |
| 1028 | VkResult result = get_dispatch_table(ot_device_table_map, device)->GetEventStatus(device, event); |
| 1029 | return result; |
| 1030 | } |
| 1031 | |
| 1032 | VKAPI_ATTR VkResult VKAPI_CALL SetEvent(VkDevice device, VkEvent event) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1033 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1034 | { |
| 1035 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1036 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00223, VALIDATION_ERROR_UNDEFINED); |
| 1037 | skip |= ValidateObject(device, event, kVulkanObjectTypeEvent, false, VALIDATION_ERROR_00224, VALIDATION_ERROR_00225); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1038 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1039 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1040 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1041 | } |
| 1042 | VkResult result = get_dispatch_table(ot_device_table_map, device)->SetEvent(device, event); |
| 1043 | return result; |
| 1044 | } |
| 1045 | |
| 1046 | VKAPI_ATTR VkResult VKAPI_CALL ResetEvent(VkDevice device, VkEvent event) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1047 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1048 | { |
| 1049 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1050 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00227, VALIDATION_ERROR_UNDEFINED); |
| 1051 | skip |= ValidateObject(device, event, kVulkanObjectTypeEvent, false, VALIDATION_ERROR_00228, VALIDATION_ERROR_00229); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1052 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1053 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1054 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1055 | } |
| 1056 | VkResult result = get_dispatch_table(ot_device_table_map, device)->ResetEvent(device, event); |
| 1057 | return result; |
| 1058 | } |
| 1059 | |
| 1060 | VKAPI_ATTR VkResult VKAPI_CALL CreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, |
| 1061 | const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1062 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1063 | { |
| 1064 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1065 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_01002, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1066 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1067 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1068 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1069 | } |
| 1070 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); |
| 1071 | { |
| 1072 | std::lock_guard<std::mutex> lock(global_lock); |
| 1073 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1074 | CreateObject(device, *pQueryPool, kVulkanObjectTypeQueryPool, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1075 | } |
| 1076 | } |
| 1077 | return result; |
| 1078 | } |
| 1079 | |
| 1080 | VKAPI_ATTR void VKAPI_CALL DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1081 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1082 | { |
| 1083 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1084 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_01015, VALIDATION_ERROR_UNDEFINED); |
| 1085 | skip |= ValidateObject(device, queryPool, kVulkanObjectTypeQueryPool, true, VALIDATION_ERROR_01016, VALIDATION_ERROR_01018); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1086 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1087 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1088 | return; |
| 1089 | } |
| 1090 | { |
| 1091 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1092 | DestroyObject(device, queryPool, kVulkanObjectTypeQueryPool, pAllocator, VALIDATION_ERROR_01013, VALIDATION_ERROR_01014); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1093 | } |
| 1094 | get_dispatch_table(ot_device_table_map, device)->DestroyQueryPool(device, queryPool, pAllocator); |
| 1095 | } |
| 1096 | |
| 1097 | VKAPI_ATTR VkResult VKAPI_CALL GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, |
| 1098 | size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1099 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1100 | { |
| 1101 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1102 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_01054, VALIDATION_ERROR_UNDEFINED); |
| 1103 | skip |= |
| 1104 | ValidateObject(device, queryPool, kVulkanObjectTypeQueryPool, false, VALIDATION_ERROR_01055, VALIDATION_ERROR_01059); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1105 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1106 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1107 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1108 | } |
| 1109 | VkResult result = get_dispatch_table(ot_device_table_map, device) |
| 1110 | ->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); |
| 1111 | return result; |
| 1112 | } |
| 1113 | |
| 1114 | VKAPI_ATTR VkResult VKAPI_CALL CreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, |
| 1115 | const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1116 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1117 | { |
| 1118 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1119 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00659, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1120 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1121 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1122 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1123 | } |
| 1124 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); |
| 1125 | { |
| 1126 | std::lock_guard<std::mutex> lock(global_lock); |
| 1127 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1128 | CreateObject(device, *pBuffer, kVulkanObjectTypeBuffer, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1129 | } |
| 1130 | } |
| 1131 | return result; |
| 1132 | } |
| 1133 | |
| 1134 | VKAPI_ATTR void VKAPI_CALL DestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1135 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1136 | { |
| 1137 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1138 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00679, VALIDATION_ERROR_UNDEFINED); |
| 1139 | skip |= ValidateObject(device, buffer, kVulkanObjectTypeBuffer, true, VALIDATION_ERROR_00680, VALIDATION_ERROR_00682); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1140 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1141 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1142 | return; |
| 1143 | } |
| 1144 | { |
| 1145 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1146 | DestroyObject(device, buffer, kVulkanObjectTypeBuffer, pAllocator, VALIDATION_ERROR_00677, VALIDATION_ERROR_00678); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1147 | } |
| 1148 | get_dispatch_table(ot_device_table_map, device)->DestroyBuffer(device, buffer, pAllocator); |
| 1149 | } |
| 1150 | |
| 1151 | VKAPI_ATTR VkResult VKAPI_CALL CreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, |
| 1152 | const VkAllocationCallbacks *pAllocator, VkBufferView *pView) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1153 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1154 | { |
| 1155 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1156 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00683, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1157 | if (pCreateInfo) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1158 | skip |= ValidateObject(device, pCreateInfo->buffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_00699, |
| 1159 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1160 | } |
| 1161 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1162 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1163 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1164 | } |
| 1165 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateBufferView(device, pCreateInfo, pAllocator, pView); |
| 1166 | { |
| 1167 | std::lock_guard<std::mutex> lock(global_lock); |
| 1168 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1169 | CreateObject(device, *pView, kVulkanObjectTypeBufferView, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1170 | } |
| 1171 | } |
| 1172 | return result; |
| 1173 | } |
| 1174 | |
| 1175 | VKAPI_ATTR void VKAPI_CALL DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1176 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1177 | { |
| 1178 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1179 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00704, VALIDATION_ERROR_UNDEFINED); |
| 1180 | skip |= |
| 1181 | ValidateObject(device, bufferView, kVulkanObjectTypeBufferView, true, VALIDATION_ERROR_00705, VALIDATION_ERROR_00707); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1182 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1183 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1184 | return; |
| 1185 | } |
| 1186 | { |
| 1187 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1188 | DestroyObject(device, bufferView, kVulkanObjectTypeBufferView, pAllocator, VALIDATION_ERROR_00702, VALIDATION_ERROR_00703); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1189 | } |
| 1190 | get_dispatch_table(ot_device_table_map, device)->DestroyBufferView(device, bufferView, pAllocator); |
| 1191 | } |
| 1192 | |
| 1193 | VKAPI_ATTR VkResult VKAPI_CALL CreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, |
| 1194 | const VkAllocationCallbacks *pAllocator, VkImage *pImage) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1195 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1196 | { |
| 1197 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1198 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00709, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1199 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1200 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1201 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1202 | } |
| 1203 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateImage(device, pCreateInfo, pAllocator, pImage); |
| 1204 | { |
| 1205 | std::lock_guard<std::mutex> lock(global_lock); |
| 1206 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1207 | CreateObject(device, *pImage, kVulkanObjectTypeImage, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1208 | } |
| 1209 | } |
| 1210 | return result; |
| 1211 | } |
| 1212 | |
| 1213 | VKAPI_ATTR void VKAPI_CALL DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1214 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1215 | { |
| 1216 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1217 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00746, VALIDATION_ERROR_UNDEFINED); |
| 1218 | skip |= ValidateObject(device, image, kVulkanObjectTypeImage, true, VALIDATION_ERROR_00747, VALIDATION_ERROR_00749); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1219 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1220 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1221 | return; |
| 1222 | } |
| 1223 | { |
| 1224 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1225 | DestroyObject(device, image, kVulkanObjectTypeImage, pAllocator, VALIDATION_ERROR_00744, VALIDATION_ERROR_00745); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1226 | } |
| 1227 | get_dispatch_table(ot_device_table_map, device)->DestroyImage(device, image, pAllocator); |
| 1228 | } |
| 1229 | |
| 1230 | VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, |
| 1231 | VkSubresourceLayout *pLayout) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1232 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1233 | { |
| 1234 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1235 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00734, VALIDATION_ERROR_UNDEFINED); |
| 1236 | skip |= ValidateObject(device, image, kVulkanObjectTypeImage, false, VALIDATION_ERROR_00735, VALIDATION_ERROR_00738); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1237 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1238 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1239 | return; |
| 1240 | } |
| 1241 | get_dispatch_table(ot_device_table_map, device)->GetImageSubresourceLayout(device, image, pSubresource, pLayout); |
| 1242 | } |
| 1243 | |
| 1244 | VKAPI_ATTR VkResult VKAPI_CALL CreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, |
| 1245 | const VkAllocationCallbacks *pAllocator, VkImageView *pView) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1246 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1247 | { |
| 1248 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1249 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00750, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1250 | if (pCreateInfo) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1251 | skip |= ValidateObject(device, pCreateInfo->image, kVulkanObjectTypeImage, false, VALIDATION_ERROR_00763, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1252 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1253 | } |
| 1254 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1255 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1256 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1257 | } |
| 1258 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateImageView(device, pCreateInfo, pAllocator, pView); |
| 1259 | { |
| 1260 | std::lock_guard<std::mutex> lock(global_lock); |
| 1261 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1262 | CreateObject(device, *pView, kVulkanObjectTypeImageView, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1263 | } |
| 1264 | } |
| 1265 | return result; |
| 1266 | } |
| 1267 | |
| 1268 | VKAPI_ATTR void VKAPI_CALL DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1269 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1270 | { |
| 1271 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1272 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00779, VALIDATION_ERROR_UNDEFINED); |
| 1273 | skip |= ValidateObject(device, imageView, kVulkanObjectTypeImageView, true, VALIDATION_ERROR_00780, VALIDATION_ERROR_00782); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1274 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1275 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1276 | return; |
| 1277 | } |
| 1278 | { |
| 1279 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1280 | DestroyObject(device, imageView, kVulkanObjectTypeImageView, pAllocator, VALIDATION_ERROR_00777, VALIDATION_ERROR_00778); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1281 | } |
| 1282 | get_dispatch_table(ot_device_table_map, device)->DestroyImageView(device, imageView, pAllocator); |
| 1283 | } |
| 1284 | |
| 1285 | VKAPI_ATTR VkResult VKAPI_CALL CreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, |
| 1286 | const VkAllocationCallbacks *pAllocator, VkShaderModule *pShaderModule) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1287 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1288 | { |
| 1289 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1290 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00466, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1291 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1292 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1293 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1294 | } |
| 1295 | VkResult result = |
| 1296 | get_dispatch_table(ot_device_table_map, device)->CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule); |
| 1297 | { |
| 1298 | std::lock_guard<std::mutex> lock(global_lock); |
| 1299 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1300 | CreateObject(device, *pShaderModule, kVulkanObjectTypeShaderModule, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1301 | } |
| 1302 | } |
| 1303 | return result; |
| 1304 | } |
| 1305 | |
| 1306 | VKAPI_ATTR void VKAPI_CALL DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, |
| 1307 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1308 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1309 | { |
| 1310 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1311 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00481, VALIDATION_ERROR_UNDEFINED); |
| 1312 | skip |= ValidateObject(device, shaderModule, kVulkanObjectTypeShaderModule, true, VALIDATION_ERROR_00482, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1313 | VALIDATION_ERROR_00484); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1314 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1315 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1316 | return; |
| 1317 | } |
| 1318 | { |
| 1319 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1320 | DestroyObject(device, shaderModule, kVulkanObjectTypeShaderModule, pAllocator, VALIDATION_ERROR_00479, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 1321 | VALIDATION_ERROR_00480); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1322 | } |
| 1323 | get_dispatch_table(ot_device_table_map, device)->DestroyShaderModule(device, shaderModule, pAllocator); |
| 1324 | } |
| 1325 | |
| 1326 | VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, |
| 1327 | const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1328 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1329 | { |
| 1330 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1331 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00562, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1332 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1333 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1334 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1335 | } |
| 1336 | VkResult result = |
| 1337 | get_dispatch_table(ot_device_table_map, device)->CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache); |
| 1338 | { |
| 1339 | std::lock_guard<std::mutex> lock(global_lock); |
| 1340 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1341 | CreateObject(device, *pPipelineCache, kVulkanObjectTypePipelineCache, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1342 | } |
| 1343 | } |
| 1344 | return result; |
| 1345 | } |
| 1346 | |
| 1347 | VKAPI_ATTR void VKAPI_CALL DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, |
| 1348 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1349 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1350 | { |
| 1351 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1352 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00585, VALIDATION_ERROR_UNDEFINED); |
| 1353 | skip |= ValidateObject(device, pipelineCache, kVulkanObjectTypePipelineCache, true, VALIDATION_ERROR_00586, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1354 | VALIDATION_ERROR_00588); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1355 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1356 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1357 | return; |
| 1358 | } |
| 1359 | { |
| 1360 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1361 | DestroyObject(device, pipelineCache, kVulkanObjectTypePipelineCache, pAllocator, VALIDATION_ERROR_00583, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 1362 | VALIDATION_ERROR_00584); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1363 | } |
| 1364 | get_dispatch_table(ot_device_table_map, device)->DestroyPipelineCache(device, pipelineCache, pAllocator); |
| 1365 | } |
| 1366 | |
| 1367 | VKAPI_ATTR VkResult VKAPI_CALL GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, |
| 1368 | void *pData) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1369 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1370 | { |
| 1371 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1372 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00578, VALIDATION_ERROR_UNDEFINED); |
| 1373 | skip |= ValidateObject(device, pipelineCache, kVulkanObjectTypePipelineCache, false, VALIDATION_ERROR_00579, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1374 | VALIDATION_ERROR_00582); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1375 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1376 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1377 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1378 | } |
| 1379 | VkResult result = |
| 1380 | get_dispatch_table(ot_device_table_map, device)->GetPipelineCacheData(device, pipelineCache, pDataSize, pData); |
| 1381 | return result; |
| 1382 | } |
| 1383 | |
| 1384 | VKAPI_ATTR VkResult VKAPI_CALL MergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, |
| 1385 | const VkPipelineCache *pSrcCaches) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1386 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1387 | { |
| 1388 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1389 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00572, VALIDATION_ERROR_UNDEFINED); |
| 1390 | skip |= |
| 1391 | ValidateObject(device, dstCache, kVulkanObjectTypePipelineCache, false, VALIDATION_ERROR_00573, VALIDATION_ERROR_00576); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1392 | if (pSrcCaches) { |
| 1393 | for (uint32_t idx0 = 0; idx0 < srcCacheCount; ++idx0) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1394 | skip |= ValidateObject(device, pSrcCaches[idx0], kVulkanObjectTypePipelineCache, false, VALIDATION_ERROR_00574, |
| 1395 | VALIDATION_ERROR_00577); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1396 | } |
| 1397 | } |
| 1398 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1399 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1400 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1401 | } |
| 1402 | VkResult result = |
| 1403 | get_dispatch_table(ot_device_table_map, device)->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches); |
| 1404 | return result; |
| 1405 | } |
| 1406 | |
| 1407 | VKAPI_ATTR void VKAPI_CALL DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1408 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1409 | { |
| 1410 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1411 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00558, VALIDATION_ERROR_UNDEFINED); |
| 1412 | skip |= ValidateObject(device, pipeline, kVulkanObjectTypePipeline, true, VALIDATION_ERROR_00559, VALIDATION_ERROR_00561); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1413 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1414 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1415 | return; |
| 1416 | } |
| 1417 | { |
| 1418 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1419 | DestroyObject(device, pipeline, kVulkanObjectTypePipeline, pAllocator, VALIDATION_ERROR_00556, VALIDATION_ERROR_00557); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1420 | } |
| 1421 | get_dispatch_table(ot_device_table_map, device)->DestroyPipeline(device, pipeline, pAllocator); |
| 1422 | } |
| 1423 | |
| 1424 | VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, |
| 1425 | const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1426 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1427 | { |
| 1428 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1429 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00861, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1430 | if (pCreateInfo) { |
| 1431 | if (pCreateInfo->pSetLayouts) { |
| 1432 | for (uint32_t idx0 = 0; idx0 < pCreateInfo->setLayoutCount; ++idx0) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1433 | skip |= ValidateObject(device, pCreateInfo->pSetLayouts[idx0], kVulkanObjectTypeDescriptorSetLayout, false, |
| 1434 | VALIDATION_ERROR_00875, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1435 | } |
| 1436 | } |
| 1437 | } |
| 1438 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1439 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1440 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1441 | } |
| 1442 | VkResult result = |
| 1443 | get_dispatch_table(ot_device_table_map, device)->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout); |
| 1444 | { |
| 1445 | std::lock_guard<std::mutex> lock(global_lock); |
| 1446 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1447 | CreateObject(device, *pPipelineLayout, kVulkanObjectTypePipelineLayout, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1448 | } |
| 1449 | } |
| 1450 | return result; |
| 1451 | } |
| 1452 | |
| 1453 | VKAPI_ATTR void VKAPI_CALL DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, |
| 1454 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1455 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1456 | { |
| 1457 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1458 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00885, VALIDATION_ERROR_UNDEFINED); |
| 1459 | skip |= ValidateObject(device, pipelineLayout, kVulkanObjectTypePipelineLayout, true, VALIDATION_ERROR_00886, |
| 1460 | VALIDATION_ERROR_00888); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1461 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1462 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1463 | return; |
| 1464 | } |
| 1465 | { |
| 1466 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1467 | DestroyObject(device, pipelineLayout, kVulkanObjectTypePipelineLayout, pAllocator, VALIDATION_ERROR_00883, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 1468 | VALIDATION_ERROR_00884); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1469 | } |
| 1470 | get_dispatch_table(ot_device_table_map, device)->DestroyPipelineLayout(device, pipelineLayout, pAllocator); |
| 1471 | } |
| 1472 | |
| 1473 | VKAPI_ATTR VkResult VKAPI_CALL CreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, |
| 1474 | const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1475 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1476 | { |
| 1477 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1478 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00812, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1479 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1480 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1481 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1482 | } |
| 1483 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateSampler(device, pCreateInfo, pAllocator, pSampler); |
| 1484 | { |
| 1485 | std::lock_guard<std::mutex> lock(global_lock); |
| 1486 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1487 | CreateObject(device, *pSampler, kVulkanObjectTypeSampler, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1488 | } |
| 1489 | } |
| 1490 | return result; |
| 1491 | } |
| 1492 | |
| 1493 | VKAPI_ATTR void VKAPI_CALL DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1494 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1495 | { |
| 1496 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1497 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00840, VALIDATION_ERROR_UNDEFINED); |
| 1498 | skip |= ValidateObject(device, sampler, kVulkanObjectTypeSampler, true, VALIDATION_ERROR_00841, VALIDATION_ERROR_00843); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1499 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1500 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1501 | return; |
| 1502 | } |
| 1503 | { |
| 1504 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1505 | DestroyObject(device, sampler, kVulkanObjectTypeSampler, pAllocator, VALIDATION_ERROR_00838, VALIDATION_ERROR_00839); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1506 | } |
| 1507 | get_dispatch_table(ot_device_table_map, device)->DestroySampler(device, sampler, pAllocator); |
| 1508 | } |
| 1509 | |
| 1510 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
| 1511 | const VkAllocationCallbacks *pAllocator, |
| 1512 | VkDescriptorSetLayout *pSetLayout) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1513 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1514 | { |
| 1515 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1516 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00844, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1517 | if (pCreateInfo) { |
| 1518 | if (pCreateInfo->pBindings) { |
| 1519 | for (uint32_t idx0 = 0; idx0 < pCreateInfo->bindingCount; ++idx0) { |
Karl Schultz | 4a13e0f | 2016-10-17 18:27:20 -0600 | [diff] [blame] | 1520 | if ((pCreateInfo->pBindings[idx0].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 1521 | (pCreateInfo->pBindings[idx0].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)) { |
| 1522 | if (pCreateInfo->pBindings[idx0].pImmutableSamplers) { |
| 1523 | for (uint32_t idx1 = 0; idx1 < pCreateInfo->pBindings[idx0].descriptorCount; ++idx1) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1524 | skip |= ValidateObject(device, pCreateInfo->pBindings[idx0].pImmutableSamplers[idx1], |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1525 | kVulkanObjectTypeSampler, false, VALIDATION_ERROR_00852, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1526 | VALIDATION_ERROR_UNDEFINED); |
Karl Schultz | 4a13e0f | 2016-10-17 18:27:20 -0600 | [diff] [blame] | 1527 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1528 | } |
| 1529 | } |
| 1530 | } |
| 1531 | } |
| 1532 | } |
| 1533 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1534 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1535 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1536 | } |
| 1537 | VkResult result = |
| 1538 | get_dispatch_table(ot_device_table_map, device)->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout); |
| 1539 | { |
| 1540 | std::lock_guard<std::mutex> lock(global_lock); |
| 1541 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1542 | CreateObject(device, *pSetLayout, kVulkanObjectTypeDescriptorSetLayout, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1543 | } |
| 1544 | } |
| 1545 | return result; |
| 1546 | } |
| 1547 | |
| 1548 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, |
| 1549 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1550 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1551 | { |
| 1552 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1553 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00857, VALIDATION_ERROR_UNDEFINED); |
| 1554 | skip |= ValidateObject(device, descriptorSetLayout, kVulkanObjectTypeDescriptorSetLayout, true, VALIDATION_ERROR_00858, |
| 1555 | VALIDATION_ERROR_00860); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1556 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1557 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1558 | return; |
| 1559 | } |
| 1560 | { |
| 1561 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1562 | DestroyObject(device, descriptorSetLayout, kVulkanObjectTypeDescriptorSetLayout, pAllocator, VALIDATION_ERROR_00855, |
| 1563 | VALIDATION_ERROR_00856); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1564 | } |
| 1565 | get_dispatch_table(ot_device_table_map, device)->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); |
| 1566 | } |
| 1567 | |
| 1568 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, |
| 1569 | const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1570 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1571 | { |
| 1572 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1573 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00889, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1574 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1575 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1576 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1577 | } |
| 1578 | VkResult result = |
| 1579 | get_dispatch_table(ot_device_table_map, device)->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool); |
| 1580 | { |
| 1581 | std::lock_guard<std::mutex> lock(global_lock); |
| 1582 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1583 | CreateObject(device, *pDescriptorPool, kVulkanObjectTypeDescriptorPool, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1584 | } |
| 1585 | } |
| 1586 | return result; |
| 1587 | } |
| 1588 | |
| 1589 | VKAPI_ATTR VkResult VKAPI_CALL ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 1590 | VkDescriptorPoolResetFlags flags) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1591 | bool skip = false; |
Chris Forbes | 2a947ce | 2016-09-29 18:47:50 +1300 | [diff] [blame] | 1592 | std::unique_lock<std::mutex> lock(global_lock); |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1593 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1594 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00929, VALIDATION_ERROR_UNDEFINED); |
| 1595 | skip |= ValidateObject(device, descriptorPool, kVulkanObjectTypeDescriptorPool, false, VALIDATION_ERROR_00930, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1596 | VALIDATION_ERROR_00932); |
| 1597 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1598 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1599 | } |
Chris Forbes | 2a947ce | 2016-09-29 18:47:50 +1300 | [diff] [blame] | 1600 | // A DescriptorPool's descriptor sets are implicitly deleted when the pool is reset. |
| 1601 | // Remove this pool's descriptor sets from our descriptorSet map. |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1602 | auto itr = device_data->object_map[kVulkanObjectTypeDescriptorSet].begin(); |
| 1603 | while (itr != device_data->object_map[kVulkanObjectTypeDescriptorSet].end()) { |
Chris Forbes | 2a947ce | 2016-09-29 18:47:50 +1300 | [diff] [blame] | 1604 | OBJTRACK_NODE *pNode = (*itr).second; |
| 1605 | auto del_itr = itr++; |
| 1606 | if (pNode->parent_object == reinterpret_cast<uint64_t &>(descriptorPool)) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1607 | DestroyObject(device, (VkDescriptorSet)((*del_itr).first), kVulkanObjectTypeDescriptorSet, nullptr, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 1608 | VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Chris Forbes | 2a947ce | 2016-09-29 18:47:50 +1300 | [diff] [blame] | 1609 | } |
| 1610 | } |
| 1611 | lock.unlock(); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1612 | VkResult result = get_dispatch_table(ot_device_table_map, device)->ResetDescriptorPool(device, descriptorPool, flags); |
| 1613 | return result; |
| 1614 | } |
| 1615 | |
| 1616 | VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, |
| 1617 | const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, |
| 1618 | const VkCopyDescriptorSet *pDescriptorCopies) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1619 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1620 | { |
| 1621 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1622 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00933, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1623 | if (pDescriptorCopies) { |
| 1624 | for (uint32_t idx0 = 0; idx0 < descriptorCopyCount; ++idx0) { |
| 1625 | if (pDescriptorCopies[idx0].dstSet) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1626 | skip |= ValidateObject(device, pDescriptorCopies[idx0].dstSet, kVulkanObjectTypeDescriptorSet, false, |
| 1627 | VALIDATION_ERROR_00972, VALIDATION_ERROR_00973); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1628 | } |
| 1629 | if (pDescriptorCopies[idx0].srcSet) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1630 | skip |= ValidateObject(device, pDescriptorCopies[idx0].srcSet, kVulkanObjectTypeDescriptorSet, false, |
| 1631 | VALIDATION_ERROR_00971, VALIDATION_ERROR_00973); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1632 | } |
| 1633 | } |
| 1634 | } |
| 1635 | if (pDescriptorWrites) { |
| 1636 | for (uint32_t idx1 = 0; idx1 < descriptorWriteCount; ++idx1) { |
| 1637 | if (pDescriptorWrites[idx1].dstSet) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1638 | skip |= ValidateObject(device, pDescriptorWrites[idx1].dstSet, kVulkanObjectTypeDescriptorSet, false, |
| 1639 | VALIDATION_ERROR_00955, VALIDATION_ERROR_00958); |
Karl Schultz | 4a13e0f | 2016-10-17 18:27:20 -0600 | [diff] [blame] | 1640 | } |
| 1641 | if ((pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || |
| 1642 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { |
| 1643 | for (uint32_t idx2 = 0; idx2 < pDescriptorWrites[idx1].descriptorCount; ++idx2) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1644 | skip |= ValidateObject(device, pDescriptorWrites[idx1].pTexelBufferView[idx2], kVulkanObjectTypeBufferView, |
| 1645 | false, VALIDATION_ERROR_00940, VALIDATION_ERROR_00958); |
Karl Schultz | 4a13e0f | 2016-10-17 18:27:20 -0600 | [diff] [blame] | 1646 | } |
| 1647 | } |
| 1648 | if ((pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || |
| 1649 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || |
| 1650 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || |
| 1651 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)) { |
| 1652 | for (uint32_t idx3 = 0; idx3 < pDescriptorWrites[idx1].descriptorCount; ++idx3) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1653 | skip |= ValidateObject(device, pDescriptorWrites[idx1].pImageInfo[idx3].imageView, |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1654 | kVulkanObjectTypeImageView, false, VALIDATION_ERROR_00943, VALIDATION_ERROR_00963); |
Karl Schultz | 4a13e0f | 2016-10-17 18:27:20 -0600 | [diff] [blame] | 1655 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1656 | } |
| 1657 | if ((pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 1658 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 1659 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || |
| 1660 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1661 | for (uint32_t idx4 = 0; idx4 < pDescriptorWrites[idx1].descriptorCount; ++idx4) { |
Karl Schultz | 4a13e0f | 2016-10-17 18:27:20 -0600 | [diff] [blame] | 1662 | if (pDescriptorWrites[idx1].pBufferInfo[idx4].buffer) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1663 | skip |= |
| 1664 | ValidateObject(device, pDescriptorWrites[idx1].pBufferInfo[idx4].buffer, kVulkanObjectTypeBuffer, |
| 1665 | false, VALIDATION_ERROR_00962, VALIDATION_ERROR_UNDEFINED); |
Karl Schultz | 4a13e0f | 2016-10-17 18:27:20 -0600 | [diff] [blame] | 1666 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1667 | } |
| 1668 | } |
| 1669 | } |
| 1670 | } |
| 1671 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1672 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1673 | return; |
| 1674 | } |
| 1675 | get_dispatch_table(ot_device_table_map, device) |
| 1676 | ->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); |
| 1677 | } |
| 1678 | |
| 1679 | VKAPI_ATTR VkResult VKAPI_CALL CreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
| 1680 | const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1681 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1682 | { |
| 1683 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1684 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00400, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1685 | if (pCreateInfo) { |
| 1686 | if (pCreateInfo->pAttachments) { |
| 1687 | for (uint32_t idx0 = 0; idx0 < pCreateInfo->attachmentCount; ++idx0) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1688 | skip |= ValidateObject(device, pCreateInfo->pAttachments[idx0], kVulkanObjectTypeImageView, false, |
| 1689 | VALIDATION_ERROR_00420, VALIDATION_ERROR_00421); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1690 | } |
| 1691 | } |
| 1692 | if (pCreateInfo->renderPass) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1693 | skip |= ValidateObject(device, pCreateInfo->renderPass, kVulkanObjectTypeRenderPass, false, VALIDATION_ERROR_00419, |
| 1694 | VALIDATION_ERROR_00421); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1695 | } |
| 1696 | } |
| 1697 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1698 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1699 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1700 | } |
| 1701 | VkResult result = |
| 1702 | get_dispatch_table(ot_device_table_map, device)->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer); |
| 1703 | { |
| 1704 | std::lock_guard<std::mutex> lock(global_lock); |
| 1705 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1706 | CreateObject(device, *pFramebuffer, kVulkanObjectTypeFramebuffer, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1707 | } |
| 1708 | } |
| 1709 | return result; |
| 1710 | } |
| 1711 | |
| 1712 | VKAPI_ATTR void VKAPI_CALL DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1713 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1714 | { |
| 1715 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1716 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00425, VALIDATION_ERROR_UNDEFINED); |
| 1717 | skip |= |
| 1718 | ValidateObject(device, framebuffer, kVulkanObjectTypeFramebuffer, true, VALIDATION_ERROR_00426, VALIDATION_ERROR_00428); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1719 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1720 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1721 | return; |
| 1722 | } |
| 1723 | { |
| 1724 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1725 | DestroyObject(device, framebuffer, kVulkanObjectTypeFramebuffer, pAllocator, VALIDATION_ERROR_00423, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 1726 | VALIDATION_ERROR_00424); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1727 | } |
| 1728 | get_dispatch_table(ot_device_table_map, device)->DestroyFramebuffer(device, framebuffer, pAllocator); |
| 1729 | } |
| 1730 | |
| 1731 | VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
| 1732 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1733 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1734 | { |
| 1735 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1736 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00319, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1737 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1738 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1739 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1740 | } |
| 1741 | VkResult result = |
| 1742 | get_dispatch_table(ot_device_table_map, device)->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass); |
| 1743 | { |
| 1744 | std::lock_guard<std::mutex> lock(global_lock); |
| 1745 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1746 | CreateObject(device, *pRenderPass, kVulkanObjectTypeRenderPass, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1747 | } |
| 1748 | } |
| 1749 | return result; |
| 1750 | } |
| 1751 | |
| 1752 | VKAPI_ATTR void VKAPI_CALL DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1753 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1754 | { |
| 1755 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1756 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00396, VALIDATION_ERROR_UNDEFINED); |
| 1757 | skip |= |
| 1758 | ValidateObject(device, renderPass, kVulkanObjectTypeRenderPass, true, VALIDATION_ERROR_00397, VALIDATION_ERROR_00399); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1759 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1760 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1761 | return; |
| 1762 | } |
| 1763 | { |
| 1764 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1765 | DestroyObject(device, renderPass, kVulkanObjectTypeRenderPass, pAllocator, VALIDATION_ERROR_00394, VALIDATION_ERROR_00395); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1766 | } |
| 1767 | get_dispatch_table(ot_device_table_map, device)->DestroyRenderPass(device, renderPass, pAllocator); |
| 1768 | } |
| 1769 | |
| 1770 | VKAPI_ATTR void VKAPI_CALL GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1771 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1772 | { |
| 1773 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1774 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00449, VALIDATION_ERROR_UNDEFINED); |
| 1775 | skip |= |
| 1776 | ValidateObject(device, renderPass, kVulkanObjectTypeRenderPass, false, VALIDATION_ERROR_00450, VALIDATION_ERROR_00452); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1777 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1778 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1779 | return; |
| 1780 | } |
| 1781 | get_dispatch_table(ot_device_table_map, device)->GetRenderAreaGranularity(device, renderPass, pGranularity); |
| 1782 | } |
| 1783 | |
| 1784 | VKAPI_ATTR VkResult VKAPI_CALL CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, |
| 1785 | const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1786 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1787 | { |
| 1788 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1789 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00064, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1790 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1791 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1792 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1793 | } |
| 1794 | VkResult result = |
| 1795 | get_dispatch_table(ot_device_table_map, device)->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); |
| 1796 | { |
| 1797 | std::lock_guard<std::mutex> lock(global_lock); |
| 1798 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1799 | CreateObject(device, *pCommandPool, kVulkanObjectTypeCommandPool, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1800 | } |
| 1801 | } |
| 1802 | return result; |
| 1803 | } |
| 1804 | |
| 1805 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1806 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1807 | { |
| 1808 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1809 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00073, VALIDATION_ERROR_UNDEFINED); |
| 1810 | skip |= ValidateObject(device, commandPool, kVulkanObjectTypeCommandPool, false, VALIDATION_ERROR_00074, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1811 | VALIDATION_ERROR_00076); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1812 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1813 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1814 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1815 | } |
| 1816 | VkResult result = get_dispatch_table(ot_device_table_map, device)->ResetCommandPool(device, commandPool, flags); |
| 1817 | return result; |
| 1818 | } |
| 1819 | |
| 1820 | VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer command_buffer, const VkCommandBufferBeginInfo *begin_info) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1821 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(command_buffer), layer_data_map); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1822 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1823 | { |
| 1824 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1825 | skip |= ValidateObject(command_buffer, command_buffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00108, |
| 1826 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1827 | if (begin_info) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1828 | OBJTRACK_NODE *pNode = |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1829 | device_data->object_map[kVulkanObjectTypeCommandBuffer][reinterpret_cast<const uint64_t>(command_buffer)]; |
Mike Schuchardt | 662c39c | 2016-11-11 16:10:51 -0700 | [diff] [blame] | 1830 | if ((begin_info->pInheritanceInfo) && (pNode->status & OBJSTATUS_COMMAND_BUFFER_SECONDARY) && |
| 1831 | (begin_info->flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT)) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1832 | skip |= ValidateObject(command_buffer, begin_info->pInheritanceInfo->framebuffer, kVulkanObjectTypeFramebuffer, |
| 1833 | true, VALIDATION_ERROR_00112, VALIDATION_ERROR_00121); |
| 1834 | skip |= ValidateObject(command_buffer, begin_info->pInheritanceInfo->renderPass, kVulkanObjectTypeRenderPass, false, |
| 1835 | VALIDATION_ERROR_00110, VALIDATION_ERROR_00121); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1836 | } |
| 1837 | } |
| 1838 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1839 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1840 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1841 | } |
| 1842 | VkResult result = get_dispatch_table(ot_device_table_map, command_buffer)->BeginCommandBuffer(command_buffer, begin_info); |
| 1843 | return result; |
| 1844 | } |
| 1845 | |
| 1846 | VKAPI_ATTR VkResult VKAPI_CALL EndCommandBuffer(VkCommandBuffer commandBuffer) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1847 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1848 | { |
| 1849 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1850 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00125, |
| 1851 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1852 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1853 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1854 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1855 | } |
| 1856 | VkResult result = get_dispatch_table(ot_device_table_map, commandBuffer)->EndCommandBuffer(commandBuffer); |
| 1857 | return result; |
| 1858 | } |
| 1859 | |
| 1860 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1861 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1862 | { |
| 1863 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1864 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00094, |
| 1865 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1866 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1867 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1868 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1869 | } |
| 1870 | VkResult result = get_dispatch_table(ot_device_table_map, commandBuffer)->ResetCommandBuffer(commandBuffer, flags); |
| 1871 | return result; |
| 1872 | } |
| 1873 | |
| 1874 | VKAPI_ATTR void VKAPI_CALL CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 1875 | VkPipeline pipeline) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1876 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1877 | { |
| 1878 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1879 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00599, |
| 1880 | VALIDATION_ERROR_UNDEFINED); |
| 1881 | skip |= ValidateObject(commandBuffer, pipeline, kVulkanObjectTypePipeline, false, VALIDATION_ERROR_00601, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1882 | VALIDATION_ERROR_00604); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1883 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1884 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1885 | return; |
| 1886 | } |
| 1887 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline); |
| 1888 | } |
| 1889 | |
| 1890 | VKAPI_ATTR void VKAPI_CALL CmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
| 1891 | const VkViewport *pViewports) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1892 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1893 | { |
| 1894 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1895 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01443, |
| 1896 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1897 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1898 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1899 | return; |
| 1900 | } |
| 1901 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports); |
| 1902 | } |
| 1903 | |
| 1904 | VKAPI_ATTR void VKAPI_CALL CmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, |
| 1905 | const VkRect2D *pScissors) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1906 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1907 | { |
| 1908 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1909 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01492, |
| 1910 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1911 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1912 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1913 | return; |
| 1914 | } |
| 1915 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors); |
| 1916 | } |
| 1917 | |
| 1918 | VKAPI_ATTR void VKAPI_CALL CmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1919 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1920 | { |
| 1921 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1922 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01478, |
| 1923 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1924 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1925 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1926 | return; |
| 1927 | } |
| 1928 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetLineWidth(commandBuffer, lineWidth); |
| 1929 | } |
| 1930 | |
| 1931 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, |
| 1932 | float depthBiasSlopeFactor) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1933 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1934 | { |
| 1935 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1936 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01483, |
| 1937 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1938 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1939 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1940 | return; |
| 1941 | } |
| 1942 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 1943 | ->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
| 1944 | } |
| 1945 | |
| 1946 | VKAPI_ATTR void VKAPI_CALL CmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1947 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1948 | { |
| 1949 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1950 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01551, |
| 1951 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1952 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1953 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1954 | return; |
| 1955 | } |
| 1956 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetBlendConstants(commandBuffer, blendConstants); |
| 1957 | } |
| 1958 | |
| 1959 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1960 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1961 | { |
| 1962 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1963 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01507, |
| 1964 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1965 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1966 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1967 | return; |
| 1968 | } |
| 1969 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds); |
| 1970 | } |
| 1971 | |
| 1972 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, |
| 1973 | uint32_t compareMask) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1974 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1975 | { |
| 1976 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1977 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01515, |
| 1978 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1979 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1980 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1981 | return; |
| 1982 | } |
| 1983 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask); |
| 1984 | } |
| 1985 | |
| 1986 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1987 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1988 | { |
| 1989 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 1990 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01521, |
| 1991 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1992 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 1993 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1994 | return; |
| 1995 | } |
| 1996 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask); |
| 1997 | } |
| 1998 | |
| 1999 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2000 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2001 | { |
| 2002 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2003 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01527, |
| 2004 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2005 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2006 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2007 | return; |
| 2008 | } |
| 2009 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetStencilReference(commandBuffer, faceMask, reference); |
| 2010 | } |
| 2011 | |
| 2012 | VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 2013 | VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, |
| 2014 | const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, |
| 2015 | const uint32_t *pDynamicOffsets) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2016 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2017 | { |
| 2018 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2019 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00979, |
| 2020 | VALIDATION_ERROR_UNDEFINED); |
| 2021 | skip |= ValidateObject(commandBuffer, layout, kVulkanObjectTypePipelineLayout, false, VALIDATION_ERROR_00981, |
| 2022 | VALIDATION_ERROR_00987); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2023 | if (pDescriptorSets) { |
| 2024 | for (uint32_t idx0 = 0; idx0 < descriptorSetCount; ++idx0) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2025 | skip |= ValidateObject(commandBuffer, pDescriptorSets[idx0], kVulkanObjectTypeDescriptorSet, false, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2026 | VALIDATION_ERROR_00982, VALIDATION_ERROR_00987); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2027 | } |
| 2028 | } |
| 2029 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2030 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2031 | return; |
| 2032 | } |
| 2033 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2034 | ->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, |
| 2035 | dynamicOffsetCount, pDynamicOffsets); |
| 2036 | } |
| 2037 | |
| 2038 | VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 2039 | VkIndexType indexType) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2040 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2041 | { |
| 2042 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2043 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01353, |
| 2044 | VALIDATION_ERROR_UNDEFINED); |
| 2045 | skip |= |
| 2046 | ValidateObject(commandBuffer, buffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01354, VALIDATION_ERROR_01358); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2047 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2048 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2049 | return; |
| 2050 | } |
| 2051 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType); |
| 2052 | } |
| 2053 | |
| 2054 | VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, |
| 2055 | const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2056 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2057 | { |
| 2058 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2059 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01419, |
| 2060 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2061 | if (pBuffers) { |
| 2062 | for (uint32_t idx0 = 0; idx0 < bindingCount; ++idx0) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2063 | skip |= ValidateObject(commandBuffer, pBuffers[idx0], kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01420, |
| 2064 | VALIDATION_ERROR_01425); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2065 | } |
| 2066 | } |
| 2067 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2068 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2069 | return; |
| 2070 | } |
| 2071 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2072 | ->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); |
| 2073 | } |
| 2074 | |
| 2075 | VKAPI_ATTR void VKAPI_CALL CmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, |
| 2076 | uint32_t firstVertex, uint32_t firstInstance) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2077 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2078 | { |
| 2079 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2080 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01362, |
| 2081 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2082 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2083 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2084 | return; |
| 2085 | } |
| 2086 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2087 | ->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
| 2088 | } |
| 2089 | |
| 2090 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, |
| 2091 | uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2092 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2093 | { |
| 2094 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2095 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01369, |
| 2096 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2097 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2098 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2099 | return; |
| 2100 | } |
| 2101 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2102 | ->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); |
| 2103 | } |
| 2104 | |
| 2105 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, |
| 2106 | uint32_t stride) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2107 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2108 | { |
| 2109 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2110 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01377, |
| 2111 | VALIDATION_ERROR_UNDEFINED); |
| 2112 | skip |= |
| 2113 | ValidateObject(commandBuffer, buffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01378, VALIDATION_ERROR_01382); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2114 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2115 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2116 | return; |
| 2117 | } |
| 2118 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride); |
| 2119 | } |
| 2120 | |
| 2121 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 2122 | uint32_t drawCount, uint32_t stride) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2123 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2124 | { |
| 2125 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2126 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01389, |
| 2127 | VALIDATION_ERROR_UNDEFINED); |
| 2128 | skip |= |
| 2129 | ValidateObject(commandBuffer, buffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01390, VALIDATION_ERROR_01394); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2130 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2131 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2132 | return; |
| 2133 | } |
| 2134 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2135 | ->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride); |
| 2136 | } |
| 2137 | |
| 2138 | VKAPI_ATTR void VKAPI_CALL CmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2139 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2140 | { |
| 2141 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2142 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01559, |
| 2143 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2144 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2145 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2146 | return; |
| 2147 | } |
| 2148 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDispatch(commandBuffer, x, y, z); |
| 2149 | } |
| 2150 | |
| 2151 | VKAPI_ATTR void VKAPI_CALL CmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2152 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2153 | { |
| 2154 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2155 | skip |= |
| 2156 | ValidateObject(commandBuffer, buffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01566, VALIDATION_ERROR_01570); |
| 2157 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01565, |
| 2158 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2159 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2160 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2161 | return; |
| 2162 | } |
| 2163 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDispatchIndirect(commandBuffer, buffer, offset); |
| 2164 | } |
| 2165 | |
| 2166 | VKAPI_ATTR void VKAPI_CALL CmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, |
| 2167 | uint32_t regionCount, const VkBufferCopy *pRegions) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2168 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2169 | { |
| 2170 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2171 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01166, |
| 2172 | VALIDATION_ERROR_UNDEFINED); |
| 2173 | skip |= ValidateObject(commandBuffer, dstBuffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01168, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2174 | VALIDATION_ERROR_01174); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2175 | skip |= ValidateObject(commandBuffer, srcBuffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01167, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2176 | VALIDATION_ERROR_01174); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2177 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2178 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2179 | return; |
| 2180 | } |
| 2181 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2182 | ->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); |
| 2183 | } |
| 2184 | |
| 2185 | VKAPI_ATTR void VKAPI_CALL CmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 2186 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 2187 | const VkImageCopy *pRegions) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2188 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2189 | { |
| 2190 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2191 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01186, |
| 2192 | VALIDATION_ERROR_UNDEFINED); |
| 2193 | skip |= |
| 2194 | ValidateObject(commandBuffer, dstImage, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01189, VALIDATION_ERROR_01196); |
| 2195 | skip |= |
| 2196 | ValidateObject(commandBuffer, srcImage, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01187, VALIDATION_ERROR_01196); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2197 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2198 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2199 | return; |
| 2200 | } |
| 2201 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2202 | ->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
| 2203 | } |
| 2204 | |
| 2205 | VKAPI_ATTR void VKAPI_CALL CmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 2206 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 2207 | const VkImageBlit *pRegions, VkFilter filter) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2208 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2209 | { |
| 2210 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2211 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01291, |
| 2212 | VALIDATION_ERROR_UNDEFINED); |
| 2213 | skip |= |
| 2214 | ValidateObject(commandBuffer, dstImage, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01294, VALIDATION_ERROR_01302); |
| 2215 | skip |= |
| 2216 | ValidateObject(commandBuffer, srcImage, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01292, VALIDATION_ERROR_01302); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2217 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2218 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2219 | return; |
| 2220 | } |
| 2221 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2222 | ->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); |
| 2223 | } |
| 2224 | |
| 2225 | VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, |
| 2226 | VkImageLayout dstImageLayout, uint32_t regionCount, |
| 2227 | const VkBufferImageCopy *pRegions) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2228 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2229 | { |
| 2230 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2231 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01235, |
| 2232 | VALIDATION_ERROR_UNDEFINED); |
| 2233 | skip |= |
| 2234 | ValidateObject(commandBuffer, dstImage, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01237, VALIDATION_ERROR_01244); |
| 2235 | skip |= ValidateObject(commandBuffer, srcBuffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01236, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2236 | VALIDATION_ERROR_01244); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2237 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2238 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2239 | return; |
| 2240 | } |
| 2241 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2242 | ->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); |
| 2243 | } |
| 2244 | |
| 2245 | VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 2246 | VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2247 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2248 | { |
| 2249 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2250 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01253, |
| 2251 | VALIDATION_ERROR_UNDEFINED); |
| 2252 | skip |= ValidateObject(commandBuffer, dstBuffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01256, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2253 | VALIDATION_ERROR_01262); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2254 | skip |= |
| 2255 | ValidateObject(commandBuffer, srcImage, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01254, VALIDATION_ERROR_01262); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2256 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2257 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2258 | return; |
| 2259 | } |
| 2260 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2261 | ->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); |
| 2262 | } |
| 2263 | |
| 2264 | VKAPI_ATTR void VKAPI_CALL CmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 2265 | VkDeviceSize dataSize, const uint32_t *pData) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2266 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2267 | { |
| 2268 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2269 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01150, |
| 2270 | VALIDATION_ERROR_UNDEFINED); |
| 2271 | skip |= ValidateObject(commandBuffer, dstBuffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01151, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2272 | VALIDATION_ERROR_01157); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2273 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2274 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2275 | return; |
| 2276 | } |
| 2277 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData); |
| 2278 | } |
| 2279 | |
| 2280 | VKAPI_ATTR void VKAPI_CALL CmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 2281 | VkDeviceSize size, uint32_t data) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2282 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2283 | { |
| 2284 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2285 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01138, |
| 2286 | VALIDATION_ERROR_UNDEFINED); |
| 2287 | skip |= ValidateObject(commandBuffer, dstBuffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01139, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2288 | VALIDATION_ERROR_01143); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2289 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2290 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2291 | return; |
| 2292 | } |
| 2293 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data); |
| 2294 | } |
| 2295 | |
| 2296 | VKAPI_ATTR void VKAPI_CALL CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 2297 | const VkClearColorValue *pColor, uint32_t rangeCount, |
| 2298 | const VkImageSubresourceRange *pRanges) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2299 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2300 | { |
| 2301 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2302 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01089, |
| 2303 | VALIDATION_ERROR_UNDEFINED); |
| 2304 | skip |= ValidateObject(commandBuffer, image, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01090, VALIDATION_ERROR_01098); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2305 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2306 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2307 | return; |
| 2308 | } |
| 2309 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2310 | ->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges); |
| 2311 | } |
| 2312 | |
| 2313 | VKAPI_ATTR void VKAPI_CALL CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 2314 | const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, |
| 2315 | const VkImageSubresourceRange *pRanges) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2316 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2317 | { |
| 2318 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2319 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01104, |
| 2320 | VALIDATION_ERROR_UNDEFINED); |
| 2321 | skip |= ValidateObject(commandBuffer, image, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01105, VALIDATION_ERROR_01113); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2322 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2323 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2324 | return; |
| 2325 | } |
| 2326 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2327 | ->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); |
| 2328 | } |
| 2329 | |
| 2330 | VKAPI_ATTR void VKAPI_CALL CmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 2331 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
| 2332 | const VkClearRect *pRects) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2333 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2334 | { |
| 2335 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2336 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01117, |
| 2337 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2338 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2339 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2340 | return; |
| 2341 | } |
| 2342 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2343 | ->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects); |
| 2344 | } |
| 2345 | |
| 2346 | VKAPI_ATTR void VKAPI_CALL CmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 2347 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 2348 | const VkImageResolve *pRegions) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2349 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2350 | { |
| 2351 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2352 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01327, |
| 2353 | VALIDATION_ERROR_UNDEFINED); |
| 2354 | skip |= |
| 2355 | ValidateObject(commandBuffer, dstImage, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01330, VALIDATION_ERROR_01337); |
| 2356 | skip |= |
| 2357 | ValidateObject(commandBuffer, srcImage, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01328, VALIDATION_ERROR_01337); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2358 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2359 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2360 | return; |
| 2361 | } |
| 2362 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2363 | ->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
| 2364 | } |
| 2365 | |
| 2366 | VKAPI_ATTR void VKAPI_CALL CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2367 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2368 | { |
| 2369 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2370 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00232, |
| 2371 | VALIDATION_ERROR_UNDEFINED); |
| 2372 | skip |= ValidateObject(commandBuffer, event, kVulkanObjectTypeEvent, false, VALIDATION_ERROR_00233, VALIDATION_ERROR_00239); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2373 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2374 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2375 | return; |
| 2376 | } |
| 2377 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetEvent(commandBuffer, event, stageMask); |
| 2378 | } |
| 2379 | |
| 2380 | VKAPI_ATTR void VKAPI_CALL CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2381 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2382 | { |
| 2383 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2384 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00243, |
| 2385 | VALIDATION_ERROR_UNDEFINED); |
| 2386 | skip |= ValidateObject(commandBuffer, event, kVulkanObjectTypeEvent, false, VALIDATION_ERROR_00244, VALIDATION_ERROR_00250); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2387 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2388 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2389 | return; |
| 2390 | } |
| 2391 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdResetEvent(commandBuffer, event, stageMask); |
| 2392 | } |
| 2393 | |
| 2394 | VKAPI_ATTR void VKAPI_CALL CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, |
| 2395 | VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, |
| 2396 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 2397 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 2398 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2399 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2400 | { |
| 2401 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2402 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00252, |
| 2403 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2404 | if (pBufferMemoryBarriers) { |
| 2405 | for (uint32_t idx0 = 0; idx0 < bufferMemoryBarrierCount; ++idx0) { |
| 2406 | if (pBufferMemoryBarriers[idx0].buffer) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2407 | skip |= ValidateObject(commandBuffer, pBufferMemoryBarriers[idx0].buffer, kVulkanObjectTypeBuffer, false, |
| 2408 | VALIDATION_ERROR_00259, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2409 | } |
| 2410 | } |
| 2411 | } |
| 2412 | if (pEvents) { |
| 2413 | for (uint32_t idx1 = 0; idx1 < eventCount; ++idx1) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2414 | skip |= ValidateObject(commandBuffer, pEvents[idx1], kVulkanObjectTypeEvent, false, VALIDATION_ERROR_00253, |
| 2415 | VALIDATION_ERROR_00264); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2416 | } |
| 2417 | } |
| 2418 | if (pImageMemoryBarriers) { |
| 2419 | for (uint32_t idx2 = 0; idx2 < imageMemoryBarrierCount; ++idx2) { |
| 2420 | if (pImageMemoryBarriers[idx2].image) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2421 | skip |= ValidateObject(commandBuffer, pImageMemoryBarriers[idx2].image, kVulkanObjectTypeImage, false, |
| 2422 | VALIDATION_ERROR_00260, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2423 | } |
| 2424 | } |
| 2425 | } |
| 2426 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2427 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2428 | return; |
| 2429 | } |
| 2430 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2431 | ->CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, |
| 2432 | bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
| 2433 | } |
| 2434 | |
| 2435 | VKAPI_ATTR void VKAPI_CALL CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, |
| 2436 | VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, |
| 2437 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 2438 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 2439 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2440 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2441 | { |
| 2442 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2443 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00270, |
| 2444 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2445 | if (pBufferMemoryBarriers) { |
| 2446 | for (uint32_t idx0 = 0; idx0 < bufferMemoryBarrierCount; ++idx0) { |
| 2447 | if (pBufferMemoryBarriers[idx0].buffer) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2448 | skip |= ValidateObject(commandBuffer, pBufferMemoryBarriers[idx0].buffer, kVulkanObjectTypeBuffer, false, |
| 2449 | VALIDATION_ERROR_00277, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2450 | } |
| 2451 | } |
| 2452 | } |
| 2453 | if (pImageMemoryBarriers) { |
| 2454 | for (uint32_t idx1 = 0; idx1 < imageMemoryBarrierCount; ++idx1) { |
| 2455 | if (pImageMemoryBarriers[idx1].image) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2456 | skip |= ValidateObject(commandBuffer, pImageMemoryBarriers[idx1].image, kVulkanObjectTypeImage, false, |
| 2457 | VALIDATION_ERROR_00278, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2458 | } |
| 2459 | } |
| 2460 | } |
| 2461 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2462 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2463 | return; |
| 2464 | } |
| 2465 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2466 | ->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, |
| 2467 | bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
| 2468 | } |
| 2469 | |
| 2470 | VKAPI_ATTR void VKAPI_CALL CmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, |
| 2471 | VkQueryControlFlags flags) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2472 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2473 | { |
| 2474 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2475 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01035, |
| 2476 | VALIDATION_ERROR_UNDEFINED); |
| 2477 | skip |= ValidateObject(commandBuffer, queryPool, kVulkanObjectTypeQueryPool, false, VALIDATION_ERROR_01036, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2478 | VALIDATION_ERROR_01040); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2479 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2480 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2481 | return; |
| 2482 | } |
| 2483 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdBeginQuery(commandBuffer, queryPool, query, flags); |
| 2484 | } |
| 2485 | |
| 2486 | VKAPI_ATTR void VKAPI_CALL CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2487 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2488 | { |
| 2489 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2490 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01043, |
| 2491 | VALIDATION_ERROR_UNDEFINED); |
| 2492 | skip |= ValidateObject(commandBuffer, queryPool, kVulkanObjectTypeQueryPool, false, VALIDATION_ERROR_01044, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2493 | VALIDATION_ERROR_01047); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2494 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2495 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2496 | return; |
| 2497 | } |
| 2498 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdEndQuery(commandBuffer, queryPool, query); |
| 2499 | } |
| 2500 | |
| 2501 | VKAPI_ATTR void VKAPI_CALL CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 2502 | uint32_t queryCount) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2503 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2504 | { |
| 2505 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2506 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01021, |
| 2507 | VALIDATION_ERROR_UNDEFINED); |
| 2508 | skip |= ValidateObject(commandBuffer, queryPool, kVulkanObjectTypeQueryPool, false, VALIDATION_ERROR_01022, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2509 | VALIDATION_ERROR_01026); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2510 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2511 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2512 | return; |
| 2513 | } |
| 2514 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); |
| 2515 | } |
| 2516 | |
| 2517 | VKAPI_ATTR void VKAPI_CALL CmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, |
| 2518 | VkQueryPool queryPool, uint32_t query) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2519 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2520 | { |
| 2521 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2522 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01078, |
| 2523 | VALIDATION_ERROR_UNDEFINED); |
| 2524 | skip |= ValidateObject(commandBuffer, queryPool, kVulkanObjectTypeQueryPool, false, VALIDATION_ERROR_01080, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2525 | VALIDATION_ERROR_01083); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2526 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2527 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2528 | return; |
| 2529 | } |
| 2530 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 2531 | } |
| 2532 | |
| 2533 | VKAPI_ATTR void VKAPI_CALL CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 2534 | uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 2535 | VkDeviceSize stride, VkQueryResultFlags flags) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2536 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2537 | { |
| 2538 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2539 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01068, |
| 2540 | VALIDATION_ERROR_UNDEFINED); |
| 2541 | skip |= ValidateObject(commandBuffer, dstBuffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01070, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2542 | VALIDATION_ERROR_01075); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2543 | skip |= ValidateObject(commandBuffer, queryPool, kVulkanObjectTypeQueryPool, false, VALIDATION_ERROR_01069, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2544 | VALIDATION_ERROR_01075); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2545 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2546 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2547 | return; |
| 2548 | } |
| 2549 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2550 | ->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags); |
| 2551 | } |
| 2552 | |
| 2553 | VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, |
| 2554 | uint32_t offset, uint32_t size, const void *pValues) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2555 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2556 | { |
| 2557 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2558 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00993, |
| 2559 | VALIDATION_ERROR_UNDEFINED); |
| 2560 | skip |= ValidateObject(commandBuffer, layout, kVulkanObjectTypePipelineLayout, false, VALIDATION_ERROR_00994, |
| 2561 | VALIDATION_ERROR_01001); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2562 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2563 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2564 | return; |
| 2565 | } |
| 2566 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2567 | ->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues); |
| 2568 | } |
| 2569 | |
| 2570 | VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, |
| 2571 | VkSubpassContents contents) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2572 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2573 | { |
| 2574 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2575 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00435, |
| 2576 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2577 | if (pRenderPassBegin) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2578 | skip |= ValidateObject(commandBuffer, pRenderPassBegin->framebuffer, kVulkanObjectTypeFramebuffer, false, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2579 | VALIDATION_ERROR_00446, VALIDATION_ERROR_00448); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2580 | skip |= ValidateObject(commandBuffer, pRenderPassBegin->renderPass, kVulkanObjectTypeRenderPass, false, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2581 | VALIDATION_ERROR_00445, VALIDATION_ERROR_00448); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2582 | } |
| 2583 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2584 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2585 | return; |
| 2586 | } |
| 2587 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents); |
| 2588 | } |
| 2589 | |
| 2590 | VKAPI_ATTR void VKAPI_CALL CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2591 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2592 | { |
| 2593 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2594 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00454, |
| 2595 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2596 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2597 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2598 | return; |
| 2599 | } |
| 2600 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdNextSubpass(commandBuffer, contents); |
| 2601 | } |
| 2602 | |
| 2603 | VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2604 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2605 | { |
| 2606 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2607 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00461, |
| 2608 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2609 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2610 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2611 | return; |
| 2612 | } |
| 2613 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdEndRenderPass(commandBuffer); |
| 2614 | } |
| 2615 | |
| 2616 | VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, |
| 2617 | const VkCommandBuffer *pCommandBuffers) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2618 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2619 | { |
| 2620 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2621 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_00159, |
| 2622 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2623 | if (pCommandBuffers) { |
| 2624 | for (uint32_t idx0 = 0; idx0 < commandBufferCount; ++idx0) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2625 | skip |= ValidateObject(commandBuffer, pCommandBuffers[idx0], kVulkanObjectTypeCommandBuffer, false, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2626 | VALIDATION_ERROR_00160, VALIDATION_ERROR_00165); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2627 | } |
| 2628 | } |
| 2629 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2630 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2631 | return; |
| 2632 | } |
| 2633 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers); |
| 2634 | } |
| 2635 | |
| 2636 | VKAPI_ATTR void VKAPI_CALL DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2637 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2638 | { |
| 2639 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2640 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_01847, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2641 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2642 | skip |= ValidateObject(instance, surface, kVulkanObjectTypeSurfaceKHR, true, VALIDATION_ERROR_01848, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2643 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2644 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2645 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2646 | return; |
| 2647 | } |
| 2648 | { |
| 2649 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2650 | DestroyObject(instance, surface, kVulkanObjectTypeSurfaceKHR, pAllocator, VALIDATION_ERROR_01845, VALIDATION_ERROR_01846); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2651 | } |
| 2652 | get_dispatch_table(ot_instance_table_map, instance)->DestroySurfaceKHR(instance, surface, pAllocator); |
| 2653 | } |
| 2654 | |
| 2655 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, |
| 2656 | VkSurfaceKHR surface, VkBool32 *pSupported) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2657 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2658 | { |
| 2659 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2660 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01890, |
| 2661 | VALIDATION_ERROR_UNDEFINED); |
| 2662 | skip |= ValidateObject(physicalDevice, surface, kVulkanObjectTypeSurfaceKHR, false, VALIDATION_ERROR_01891, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2663 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2664 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2665 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2666 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2667 | } |
| 2668 | VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2669 | ->GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported); |
| 2670 | return result; |
| 2671 | } |
| 2672 | |
| 2673 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 2674 | VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2675 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2676 | { |
| 2677 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2678 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01907, |
| 2679 | VALIDATION_ERROR_UNDEFINED); |
| 2680 | skip |= ValidateObject(physicalDevice, surface, kVulkanObjectTypeSurfaceKHR, false, VALIDATION_ERROR_01908, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2681 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2682 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2683 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2684 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2685 | } |
| 2686 | VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2687 | ->GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities); |
| 2688 | return result; |
| 2689 | } |
| 2690 | |
| 2691 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 2692 | uint32_t *pSurfaceFormatCount, |
| 2693 | VkSurfaceFormatKHR *pSurfaceFormats) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2694 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2695 | { |
| 2696 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2697 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01910, |
| 2698 | VALIDATION_ERROR_UNDEFINED); |
| 2699 | skip |= ValidateObject(physicalDevice, surface, kVulkanObjectTypeSurfaceKHR, false, VALIDATION_ERROR_01911, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2700 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2701 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2702 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2703 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2704 | } |
| 2705 | VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2706 | ->GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats); |
| 2707 | return result; |
| 2708 | } |
| 2709 | |
| 2710 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 2711 | uint32_t *pPresentModeCount, |
| 2712 | VkPresentModeKHR *pPresentModes) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2713 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2714 | { |
| 2715 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2716 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01914, |
| 2717 | VALIDATION_ERROR_UNDEFINED); |
| 2718 | skip |= ValidateObject(physicalDevice, surface, kVulkanObjectTypeSurfaceKHR, false, VALIDATION_ERROR_01915, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2719 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2720 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2721 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2722 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2723 | } |
| 2724 | VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2725 | ->GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes); |
| 2726 | return result; |
| 2727 | } |
| 2728 | |
| 2729 | VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
| 2730 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2731 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2732 | { |
| 2733 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2734 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_01918, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2735 | if (pCreateInfo) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2736 | skip |= ValidateObject(device, pCreateInfo->oldSwapchain, kVulkanObjectTypeSwapchainKHR, true, VALIDATION_ERROR_01935, |
| 2737 | VALIDATION_ERROR_UNDEFINED); |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2738 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2739 | skip |= ValidateObject(device_data->physical_device, pCreateInfo->surface, kVulkanObjectTypeSurfaceKHR, false, |
| 2740 | VALIDATION_ERROR_01926, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2741 | } |
| 2742 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2743 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2744 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2745 | } |
| 2746 | VkResult result = |
| 2747 | get_dispatch_table(ot_device_table_map, device)->CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); |
| 2748 | { |
| 2749 | std::lock_guard<std::mutex> lock(global_lock); |
| 2750 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2751 | CreateObject(device, *pSwapchain, kVulkanObjectTypeSwapchainKHR, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2752 | } |
| 2753 | } |
| 2754 | return result; |
| 2755 | } |
| 2756 | |
| 2757 | VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, |
| 2758 | VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2759 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2760 | { |
| 2761 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2762 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_01954, VALIDATION_ERROR_UNDEFINED); |
| 2763 | skip |= ValidateObject(device, fence, kVulkanObjectTypeFence, true, VALIDATION_ERROR_01957, VALIDATION_ERROR_01960); |
| 2764 | skip |= ValidateObject(device, semaphore, kVulkanObjectTypeSemaphore, true, VALIDATION_ERROR_01956, VALIDATION_ERROR_01959); |
| 2765 | skip |= ValidateObject(device, swapchain, kVulkanObjectTypeSwapchainKHR, false, VALIDATION_ERROR_01955, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2766 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2767 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2768 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2769 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2770 | } |
| 2771 | VkResult result = get_dispatch_table(ot_device_table_map, device) |
| 2772 | ->AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex); |
| 2773 | return result; |
| 2774 | } |
| 2775 | |
| 2776 | VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2777 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2778 | { |
| 2779 | std::lock_guard<std::mutex> lock(global_lock); |
| 2780 | if (pPresentInfo) { |
| 2781 | if (pPresentInfo->pSwapchains) { |
| 2782 | for (uint32_t idx0 = 0; idx0 < pPresentInfo->swapchainCount; ++idx0) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2783 | skip |= ValidateObject(queue, pPresentInfo->pSwapchains[idx0], kVulkanObjectTypeSwapchainKHR, false, |
| 2784 | VALIDATION_ERROR_01969, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2785 | } |
| 2786 | } |
| 2787 | if (pPresentInfo->pWaitSemaphores) { |
| 2788 | for (uint32_t idx1 = 0; idx1 < pPresentInfo->waitSemaphoreCount; ++idx1) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2789 | skip |= ValidateObject(queue, pPresentInfo->pWaitSemaphores[idx1], kVulkanObjectTypeSemaphore, false, |
| 2790 | VALIDATION_ERROR_01968, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2791 | } |
| 2792 | } |
| 2793 | } |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2794 | skip |= ValidateObject(queue, queue, kVulkanObjectTypeQueue, false, VALIDATION_ERROR_01962, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2795 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2796 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2797 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2798 | } |
| 2799 | VkResult result = get_dispatch_table(ot_device_table_map, queue)->QueuePresentKHR(queue, pPresentInfo); |
| 2800 | return result; |
| 2801 | } |
| 2802 | |
| 2803 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 2804 | VKAPI_ATTR VkResult VKAPI_CALL CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
| 2805 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2806 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2807 | { |
| 2808 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2809 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_01820, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2810 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2811 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2812 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2813 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2814 | } |
| 2815 | VkResult result = |
| 2816 | get_dispatch_table(ot_instance_table_map, instance)->CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 2817 | { |
| 2818 | std::lock_guard<std::mutex> lock(global_lock); |
| 2819 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2820 | CreateObject(instance, *pSurface, kVulkanObjectTypeSurfaceKHR, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2821 | } |
| 2822 | } |
| 2823 | return result; |
| 2824 | } |
| 2825 | |
| 2826 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 2827 | uint32_t queueFamilyIndex) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2828 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2829 | { |
| 2830 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2831 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01900, |
| 2832 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2833 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2834 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2835 | return VK_FALSE; |
| 2836 | } |
| 2837 | VkBool32 result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2838 | ->GetPhysicalDeviceWin32PresentationSupportKHR(physicalDevice, queueFamilyIndex); |
| 2839 | return result; |
| 2840 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2841 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2842 | |
| 2843 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 2844 | VKAPI_ATTR VkResult VKAPI_CALL CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, |
| 2845 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2846 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2847 | { |
| 2848 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2849 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_01827, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2850 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2851 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2852 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2853 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2854 | } |
| 2855 | VkResult result = |
| 2856 | get_dispatch_table(ot_instance_table_map, instance)->CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 2857 | { |
| 2858 | std::lock_guard<std::mutex> lock(global_lock); |
| 2859 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2860 | CreateObject(instance, *pSurface, kVulkanObjectTypeSurfaceKHR, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2861 | } |
| 2862 | } |
| 2863 | return result; |
| 2864 | } |
| 2865 | |
| 2866 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 2867 | uint32_t queueFamilyIndex, xcb_connection_t *connection, |
| 2868 | xcb_visualid_t visual_id) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2869 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2870 | { |
| 2871 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2872 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01902, |
| 2873 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2874 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2875 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2876 | return VK_FALSE; |
| 2877 | } |
| 2878 | VkBool32 result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2879 | ->GetPhysicalDeviceXcbPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection, visual_id); |
| 2880 | return result; |
| 2881 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2882 | #endif // VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2883 | |
| 2884 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 2885 | VKAPI_ATTR VkResult VKAPI_CALL CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, |
| 2886 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2887 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2888 | { |
| 2889 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2890 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_01836, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2891 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2892 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2893 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2894 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2895 | } |
| 2896 | VkResult result = |
| 2897 | get_dispatch_table(ot_instance_table_map, instance)->CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 2898 | { |
| 2899 | std::lock_guard<std::mutex> lock(global_lock); |
| 2900 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2901 | CreateObject(instance, *pSurface, kVulkanObjectTypeSurfaceKHR, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2902 | } |
| 2903 | } |
| 2904 | return result; |
| 2905 | } |
| 2906 | |
| 2907 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 2908 | uint32_t queueFamilyIndex, Display *dpy, |
| 2909 | VisualID visualID) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2910 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2911 | { |
| 2912 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2913 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01905, |
| 2914 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2915 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2916 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2917 | return VK_FALSE; |
| 2918 | } |
| 2919 | VkBool32 result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2920 | ->GetPhysicalDeviceXlibPresentationSupportKHR(physicalDevice, queueFamilyIndex, dpy, visualID); |
| 2921 | return result; |
| 2922 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2923 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2924 | |
| 2925 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 2926 | VKAPI_ATTR VkResult VKAPI_CALL CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, |
| 2927 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2928 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2929 | { |
| 2930 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2931 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_01802, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2932 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2933 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2934 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2935 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2936 | } |
| 2937 | VkResult result = |
| 2938 | get_dispatch_table(ot_instance_table_map, instance)->CreateMirSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 2939 | { |
| 2940 | std::lock_guard<std::mutex> lock(global_lock); |
| 2941 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2942 | CreateObject(instance, *pSurface, kVulkanObjectTypeSurfaceKHR, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2943 | } |
| 2944 | } |
| 2945 | return result; |
| 2946 | } |
| 2947 | |
| 2948 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 2949 | uint32_t queueFamilyIndex, MirConnection *connection) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2950 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2951 | { |
| 2952 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2953 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01894, |
| 2954 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2955 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2956 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2957 | return VK_FALSE; |
| 2958 | } |
| 2959 | VkBool32 result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2960 | ->GetPhysicalDeviceMirPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection); |
| 2961 | return result; |
| 2962 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2963 | #endif // VK_USE_PLATFORM_MIR_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2964 | |
| 2965 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 2966 | VKAPI_ATTR VkResult VKAPI_CALL CreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, |
| 2967 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2968 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2969 | { |
| 2970 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2971 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_01811, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2972 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2973 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2974 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2975 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2976 | } |
| 2977 | VkResult result = |
| 2978 | get_dispatch_table(ot_instance_table_map, instance)->CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 2979 | { |
| 2980 | std::lock_guard<std::mutex> lock(global_lock); |
| 2981 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2982 | CreateObject(instance, *pSurface, kVulkanObjectTypeSurfaceKHR, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2983 | } |
| 2984 | } |
| 2985 | return result; |
| 2986 | } |
| 2987 | |
| 2988 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 2989 | uint32_t queueFamilyIndex, |
| 2990 | struct wl_display *display) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2991 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2992 | { |
| 2993 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 2994 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01897, |
| 2995 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2996 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 2997 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2998 | return VK_FALSE; |
| 2999 | } |
| 3000 | VkBool32 result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 3001 | ->GetPhysicalDeviceWaylandPresentationSupportKHR(physicalDevice, queueFamilyIndex, display); |
| 3002 | return result; |
| 3003 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3004 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3005 | |
| 3006 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 3007 | VKAPI_ATTR VkResult VKAPI_CALL CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, |
| 3008 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3009 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3010 | { |
| 3011 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3012 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_01794, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3013 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3014 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3015 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3016 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3017 | } |
| 3018 | VkResult result = |
| 3019 | get_dispatch_table(ot_instance_table_map, instance)->CreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 3020 | { |
| 3021 | std::lock_guard<std::mutex> lock(global_lock); |
| 3022 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3023 | CreateObject(instance, *pSurface, kVulkanObjectTypeSurfaceKHR, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3024 | } |
| 3025 | } |
| 3026 | return result; |
| 3027 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3028 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3029 | |
Mark Lobodzinski | e5dbb04 | 2017-03-29 10:51:30 -0600 | [diff] [blame] | 3030 | #ifdef VK_USE_PLATFORM_IOS_MVK |
| 3031 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK(VkInstance instance, const VkIOSSurfaceCreateInfoMVK *pCreateInfo, |
| 3032 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 3033 | bool skip = false; |
| 3034 | { |
| 3035 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3036 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_UNDEFINED, |
Mark Lobodzinski | e5dbb04 | 2017-03-29 10:51:30 -0600 | [diff] [blame] | 3037 | VALIDATION_ERROR_UNDEFINED); |
| 3038 | } |
| 3039 | if (skip) { |
| 3040 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3041 | } |
| 3042 | VkResult result = |
| 3043 | get_dispatch_table(ot_instance_table_map, instance)->CreateIOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface); |
| 3044 | if (result == VK_SUCCESS) { |
| 3045 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3046 | CreateObject(instance, *pSurface, kVulkanObjectTypeSurfaceKHR, pAllocator); |
Mark Lobodzinski | e5dbb04 | 2017-03-29 10:51:30 -0600 | [diff] [blame] | 3047 | } |
| 3048 | return result; |
| 3049 | } |
| 3050 | #endif // VK_USE_PLATFORM_IOS_MVK |
| 3051 | |
| 3052 | #ifdef VK_USE_PLATFORM_MACOS_MVK |
| 3053 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK *pCreateInfo, |
| 3054 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 3055 | bool skip = false; |
| 3056 | { |
| 3057 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3058 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_UNDEFINED, |
Mark Lobodzinski | e5dbb04 | 2017-03-29 10:51:30 -0600 | [diff] [blame] | 3059 | VALIDATION_ERROR_UNDEFINED); |
| 3060 | } |
| 3061 | if (skip) { |
| 3062 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3063 | } |
| 3064 | VkResult result = |
| 3065 | get_dispatch_table(ot_instance_table_map, instance)->CreateMacOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface); |
| 3066 | if (result == VK_SUCCESS) { |
| 3067 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3068 | CreateObject(instance, *pSurface, kVulkanObjectTypeSurfaceKHR, pAllocator); |
Mark Lobodzinski | e5dbb04 | 2017-03-29 10:51:30 -0600 | [diff] [blame] | 3069 | } |
| 3070 | return result; |
| 3071 | } |
| 3072 | #endif // VK_USE_PLATFORM_MACOS_MVK |
| 3073 | |
| 3074 | #ifdef VK_USE_PLATFORM_VI_NN |
| 3075 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN(VkInstance instance, const VkViSurfaceCreateInfoNN *pCreateInfo, |
| 3076 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 3077 | bool skip = false; |
| 3078 | { |
| 3079 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3080 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_UNDEFINED, |
Mark Lobodzinski | e5dbb04 | 2017-03-29 10:51:30 -0600 | [diff] [blame] | 3081 | VALIDATION_ERROR_UNDEFINED); |
| 3082 | } |
| 3083 | if (skip) { |
| 3084 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3085 | } |
| 3086 | VkResult result = |
| 3087 | get_dispatch_table(ot_instance_table_map, instance)->CreateViSurfaceNN(instance, pCreateInfo, pAllocator, pSurface); |
| 3088 | if (result == VK_SUCCESS) { |
| 3089 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3090 | CreateObject(instance, *pSurface, kVulkanObjectTypeSurfaceKHR, pAllocator); |
Mark Lobodzinski | e5dbb04 | 2017-03-29 10:51:30 -0600 | [diff] [blame] | 3091 | } |
| 3092 | return result; |
| 3093 | } |
| 3094 | #endif // VK_USE_PLATFORM_VI_NN |
| 3095 | |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 3096 | VKAPI_ATTR VkResult VKAPI_CALL CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, |
| 3097 | const VkSwapchainCreateInfoKHR *pCreateInfos, |
| 3098 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3099 | bool skip = false; |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 3100 | uint32_t i = 0; |
| 3101 | { |
| 3102 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3103 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_01943, VALIDATION_ERROR_UNDEFINED); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 3104 | if (NULL != pCreateInfos) { |
| 3105 | for (i = 0; i < swapchainCount; i++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3106 | skip |= ValidateObject(device, pCreateInfos[i].oldSwapchain, kVulkanObjectTypeSwapchainKHR, true, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3107 | VALIDATION_ERROR_01935, VALIDATION_ERROR_UNDEFINED); |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3108 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3109 | skip |= ValidateObject(device_data->physical_device, pCreateInfos[i].surface, kVulkanObjectTypeSurfaceKHR, false, |
| 3110 | VALIDATION_ERROR_01926, VALIDATION_ERROR_UNDEFINED); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 3111 | } |
| 3112 | } |
| 3113 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3114 | if (skip) { |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 3115 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3116 | } |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3117 | VkResult result = get_dispatch_table(ot_device_table_map, device) |
| 3118 | ->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 3119 | { |
| 3120 | std::lock_guard<std::mutex> lock(global_lock); |
| 3121 | if (result == VK_SUCCESS) { |
| 3122 | for (i = 0; i < swapchainCount; i++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3123 | CreateObject(device, pSwapchains[i], kVulkanObjectTypeSwapchainKHR, pAllocator); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 3124 | } |
| 3125 | } |
| 3126 | } |
| 3127 | return result; |
| 3128 | } |
| 3129 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3130 | VKAPI_ATTR VkResult VKAPI_CALL CreateDebugReportCallbackEXT(VkInstance instance, |
| 3131 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 3132 | const VkAllocationCallbacks *pAllocator, |
| 3133 | VkDebugReportCallbackEXT *pCallback) { |
| 3134 | VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ot_instance_table_map, instance); |
| 3135 | VkResult result = pInstanceTable->CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pCallback); |
| 3136 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3137 | layer_data *instance_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3138 | result = layer_create_msg_callback(instance_data->report_data, false, pCreateInfo, pAllocator, pCallback); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3139 | CreateObject(instance, *pCallback, kVulkanObjectTypeDebugReportCallbackEXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3140 | } |
| 3141 | return result; |
| 3142 | } |
| 3143 | |
| 3144 | VKAPI_ATTR void VKAPI_CALL DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, |
| 3145 | const VkAllocationCallbacks *pAllocator) { |
| 3146 | VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ot_instance_table_map, instance); |
| 3147 | pInstanceTable->DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3148 | layer_data *instance_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3149 | layer_destroy_msg_callback(instance_data->report_data, msgCallback, pAllocator); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3150 | DestroyObject(instance, msgCallback, kVulkanObjectTypeDebugReportCallbackEXT, pAllocator, VALIDATION_ERROR_02049, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 3151 | VALIDATION_ERROR_02050); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3152 | } |
| 3153 | |
| 3154 | VKAPI_ATTR void VKAPI_CALL DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 3155 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 3156 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
| 3157 | VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ot_instance_table_map, instance); |
| 3158 | pInstanceTable->DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
| 3159 | } |
| 3160 | |
| 3161 | static const VkExtensionProperties instance_extensions[] = {{VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}}; |
| 3162 | |
| 3163 | static const VkLayerProperties globalLayerProps = {"VK_LAYER_LUNARG_object_tracker", |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3164 | VK_LAYER_API_VERSION, // specVersion |
| 3165 | 1, // implementationVersion |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3166 | "LunarG Validation Layer"}; |
| 3167 | |
| 3168 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) { |
| 3169 | return util_GetLayerProperties(1, &globalLayerProps, pCount, pProperties); |
| 3170 | } |
| 3171 | |
| 3172 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 3173 | VkLayerProperties *pProperties) { |
| 3174 | return util_GetLayerProperties(1, &globalLayerProps, pCount, pProperties); |
| 3175 | } |
| 3176 | |
| 3177 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 3178 | VkExtensionProperties *pProperties) { |
| 3179 | if (pLayerName && !strcmp(pLayerName, globalLayerProps.layerName)) |
| 3180 | return util_GetExtensionProperties(1, instance_extensions, pCount, pProperties); |
| 3181 | |
| 3182 | return VK_ERROR_LAYER_NOT_PRESENT; |
| 3183 | } |
| 3184 | |
| 3185 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, |
| 3186 | uint32_t *pCount, VkExtensionProperties *pProperties) { |
| 3187 | if (pLayerName && !strcmp(pLayerName, globalLayerProps.layerName)) |
| 3188 | return util_GetExtensionProperties(0, nullptr, pCount, pProperties); |
| 3189 | |
| 3190 | assert(physicalDevice); |
| 3191 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(ot_instance_table_map, physicalDevice); |
| 3192 | return pTable->EnumerateDeviceExtensionProperties(physicalDevice, NULL, pCount, pProperties); |
| 3193 | } |
| 3194 | |
| 3195 | static inline PFN_vkVoidFunction InterceptMsgCallbackGetProcAddrCommand(const char *name, VkInstance instance) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3196 | layer_data *instance_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3197 | return debug_report_get_instance_proc_addr(instance_data->report_data, name); |
| 3198 | } |
| 3199 | |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3200 | VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayPlaneSurfaceKHR(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3201 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3202 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3203 | static inline PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkInstance instance) { |
| 3204 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(ot_instance_table_map, instance); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3205 | if (instanceExtMap.size() == 0 || !instanceExtMap[pTable].wsi_enabled) return nullptr; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3206 | |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3207 | if (!strcmp("vkDestroySurfaceKHR", name)) return reinterpret_cast<PFN_vkVoidFunction>(DestroySurfaceKHR); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3208 | if (!strcmp("vkGetPhysicalDeviceSurfaceSupportKHR", name)) |
| 3209 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceSupportKHR); |
| 3210 | if (!strcmp("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", name)) |
| 3211 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceCapabilitiesKHR); |
| 3212 | if (!strcmp("vkGetPhysicalDeviceSurfaceFormatsKHR", name)) |
| 3213 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceFormatsKHR); |
| 3214 | if (!strcmp("vkGetPhysicalDeviceSurfacePresentModesKHR", name)) |
| 3215 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfacePresentModesKHR); |
Norbert Nopper | 1dec9a5 | 2016-11-25 07:55:13 +0100 | [diff] [blame] | 3216 | if ((instanceExtMap[pTable].display_enabled == true) && !strcmp("vkCreateDisplayPlaneSurfaceKHR", name)) |
| 3217 | return reinterpret_cast<PFN_vkVoidFunction>(CreateDisplayPlaneSurfaceKHR); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3218 | |
| 3219 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 3220 | if ((instanceExtMap[pTable].win32_enabled == true) && !strcmp("vkCreateWin32SurfaceKHR", name)) |
| 3221 | return reinterpret_cast<PFN_vkVoidFunction>(CreateWin32SurfaceKHR); |
| 3222 | if ((instanceExtMap[pTable].win32_enabled == true) && !strcmp("vkGetPhysicalDeviceWin32PresentationSupportKHR", name)) |
| 3223 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceWin32PresentationSupportKHR); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3224 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3225 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3226 | if ((instanceExtMap[pTable].xcb_enabled == true) && !strcmp("vkCreateXcbSurfaceKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3227 | return reinterpret_cast<PFN_vkVoidFunction>(CreateXcbSurfaceKHR); |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3228 | if ((instanceExtMap[pTable].xcb_enabled == true) && !strcmp("vkGetPhysicalDeviceXcbPresentationSupportKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3229 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXcbPresentationSupportKHR); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3230 | #endif // VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3231 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3232 | if ((instanceExtMap[pTable].xlib_enabled == true) && !strcmp("vkCreateXlibSurfaceKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3233 | return reinterpret_cast<PFN_vkVoidFunction>(CreateXlibSurfaceKHR); |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3234 | if ((instanceExtMap[pTable].xlib_enabled == true) && !strcmp("vkGetPhysicalDeviceXlibPresentationSupportKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3235 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXlibPresentationSupportKHR); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3236 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3237 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3238 | if ((instanceExtMap[pTable].mir_enabled == true) && !strcmp("vkCreateMirSurfaceKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3239 | return reinterpret_cast<PFN_vkVoidFunction>(CreateMirSurfaceKHR); |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3240 | if ((instanceExtMap[pTable].mir_enabled == true) && !strcmp("vkGetPhysicalDeviceMirPresentationSupportKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3241 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceMirPresentationSupportKHR); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3242 | #endif // VK_USE_PLATFORM_MIR_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3243 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3244 | if ((instanceExtMap[pTable].wayland_enabled == true) && !strcmp("vkCreateWaylandSurfaceKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3245 | return reinterpret_cast<PFN_vkVoidFunction>(CreateWaylandSurfaceKHR); |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3246 | if ((instanceExtMap[pTable].wayland_enabled == true) && !strcmp("vkGetPhysicalDeviceWaylandPresentationSupportKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3247 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceWaylandPresentationSupportKHR); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3248 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3249 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3250 | if ((instanceExtMap[pTable].android_enabled == true) && !strcmp("vkCreateAndroidSurfaceKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3251 | return reinterpret_cast<PFN_vkVoidFunction>(CreateAndroidSurfaceKHR); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3252 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3253 | |
| 3254 | return nullptr; |
| 3255 | } |
| 3256 | |
| 3257 | static void CheckDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, VkDevice device) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3258 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3259 | |
| 3260 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3261 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_EXTENSION_NAME) == 0) { |
| 3262 | device_data->enables.wsi_display_extension = true; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3263 | } |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 3264 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME) == 0) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3265 | device_data->enables.wsi_display_swapchain = true; |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 3266 | } |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3267 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME) == 0) { |
| 3268 | device_data->enables.khr_descriptor_update_template = true; |
| 3269 | } |
| 3270 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MAINTENANCE1_EXTENSION_NAME) == 0) { |
| 3271 | device_data->enables.khr_maintenance1 = true; |
| 3272 | } |
| 3273 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME) == 0) { |
| 3274 | device_data->enables.khr_push_descriptor = true; |
| 3275 | } |
| 3276 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0) { |
| 3277 | device_data->enables.wsi = true; |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 3278 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3279 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], "OBJTRACK_EXTENSIONS") == 0) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3280 | device_data->enables.objtrack_extensions = true; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3281 | } |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3282 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHX_DEVICE_GROUP_EXTENSION_NAME) == 0) { |
| 3283 | device_data->enables.khx_device_group = true; |
| 3284 | } |
| 3285 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHX_EXTERNAL_MEMORY_FD_EXTENSION_NAME) == 0) { |
| 3286 | device_data->enables.khx_external_memory_fd = true; |
| 3287 | } |
Mark Lobodzinski | 337c870 | 2017-04-03 10:39:08 -0600 | [diff] [blame] | 3288 | #ifdef VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3289 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHX_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME) == 0) { |
| 3290 | device_data->enables.khx_external_memory_win32 = true; |
| 3291 | } |
Mark Lobodzinski | 337c870 | 2017-04-03 10:39:08 -0600 | [diff] [blame] | 3292 | #endif // VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3293 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHX_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME) == 0) { |
| 3294 | device_data->enables.khx_external_semaphore_fd = true; |
| 3295 | } |
Jamie Madill | 0f94144 | 2017-03-16 12:53:42 -0400 | [diff] [blame] | 3296 | #ifdef VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3297 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHX_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME) == 0) { |
| 3298 | device_data->enables.khx_external_semaphore_win32 = true; |
| 3299 | } |
Jamie Madill | 0f94144 | 2017-03-16 12:53:42 -0400 | [diff] [blame] | 3300 | #endif // VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3301 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME) == 0) { |
| 3302 | device_data->enables.ext_discard_rectangles = true; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 3303 | } |
| 3304 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME) == 0) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3305 | device_data->enables.ext_display_control = true; |
| 3306 | } |
| 3307 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME) == 0) { |
| 3308 | device_data->enables.nv_clip_space_w_scaling = true; |
| 3309 | } |
| 3310 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME) == 0) { |
| 3311 | device_data->enables.nvx_device_generated_commands = true; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 3312 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3313 | } |
| 3314 | } |
| 3315 | |
| 3316 | static void CheckInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance) { |
| 3317 | VkLayerInstanceDispatchTable *pDisp = get_dispatch_table(ot_instance_table_map, instance); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3318 | |
| 3319 | instanceExtMap[pDisp] = {}; |
| 3320 | |
| 3321 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3322 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 3323 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) { |
| 3324 | instanceExtMap[pDisp].android_enabled = true; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3325 | } |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3326 | #endif |
Norbert Nopper | 1dec9a5 | 2016-11-25 07:55:13 +0100 | [diff] [blame] | 3327 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_EXTENSION_NAME) == 0) { |
| 3328 | instanceExtMap[pDisp].display_enabled = true; |
| 3329 | } |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3330 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SURFACE_EXTENSION_NAME) == 0) { |
| 3331 | instanceExtMap[pDisp].wsi_enabled = true; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3332 | } |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3333 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 3334 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) { |
| 3335 | instanceExtMap[pDisp].mir_enabled = true; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3336 | } |
| 3337 | #endif |
| 3338 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 3339 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) { |
| 3340 | instanceExtMap[pDisp].wayland_enabled = true; |
| 3341 | } |
| 3342 | #endif |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3343 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 3344 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) { |
| 3345 | instanceExtMap[pDisp].win32_enabled = true; |
| 3346 | } |
| 3347 | #endif |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 3348 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 3349 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) { |
| 3350 | instanceExtMap[pDisp].xcb_enabled = true; |
| 3351 | } |
| 3352 | #endif |
| 3353 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 3354 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) { |
| 3355 | instanceExtMap[pDisp].xlib_enabled = true; |
| 3356 | } |
| 3357 | #endif |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3358 | } |
| 3359 | } |
| 3360 | |
| 3361 | VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
| 3362 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { |
| 3363 | std::lock_guard<std::mutex> lock(global_lock); |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3364 | layer_data *phy_dev_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3365 | VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
| 3366 | |
| 3367 | assert(chain_info->u.pLayerInfo); |
| 3368 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 3369 | PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; |
| 3370 | PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(phy_dev_data->instance, "vkCreateDevice"); |
| 3371 | if (fpCreateDevice == NULL) { |
| 3372 | return VK_ERROR_INITIALIZATION_FAILED; |
| 3373 | } |
| 3374 | |
| 3375 | // Advance the link info for the next element on the chain |
| 3376 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 3377 | |
| 3378 | VkResult result = fpCreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice); |
| 3379 | if (result != VK_SUCCESS) { |
| 3380 | return result; |
| 3381 | } |
| 3382 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3383 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(*pDevice), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3384 | device_data->report_data = layer_debug_report_create_device(phy_dev_data->report_data, *pDevice); |
Tobin Ehlis | 8ad4193 | 2016-12-01 09:37:56 -0700 | [diff] [blame] | 3385 | layer_init_device_dispatch_table(*pDevice, &device_data->dispatch_table, fpGetDeviceProcAddr); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3386 | |
| 3387 | // Add link back to physDev |
| 3388 | device_data->physical_device = physicalDevice; |
| 3389 | |
| 3390 | initDeviceTable(*pDevice, fpGetDeviceProcAddr, ot_device_table_map); |
| 3391 | |
| 3392 | CheckDeviceRegisterExtensions(pCreateInfo, *pDevice); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3393 | CreateObject(*pDevice, *pDevice, kVulkanObjectTypeDevice, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3394 | |
| 3395 | return result; |
| 3396 | } |
| 3397 | |
| 3398 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, |
| 3399 | uint32_t *pQueueFamilyPropertyCount, |
| 3400 | VkQueueFamilyProperties *pQueueFamilyProperties) { |
Tobin Ehlis | e6fdaf1 | 2017-02-07 15:21:00 -0700 | [diff] [blame] | 3401 | bool skip = false; |
| 3402 | { |
| 3403 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3404 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_00028, |
| 3405 | VALIDATION_ERROR_UNDEFINED); |
Tobin Ehlis | e6fdaf1 | 2017-02-07 15:21:00 -0700 | [diff] [blame] | 3406 | } |
| 3407 | if (skip) { |
| 3408 | return; |
| 3409 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3410 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 3411 | ->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
| 3412 | std::lock_guard<std::mutex> lock(global_lock); |
| 3413 | if (pQueueFamilyProperties != NULL) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3414 | layer_data *instance_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
Tobin Ehlis | e28c6d5 | 2017-02-06 17:02:03 -0700 | [diff] [blame] | 3415 | if (instance_data->queue_family_properties.size() < *pQueueFamilyPropertyCount) { |
| 3416 | instance_data->queue_family_properties.resize(*pQueueFamilyPropertyCount); |
| 3417 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3418 | for (uint32_t i = 0; i < *pQueueFamilyPropertyCount; i++) { |
Tobin Ehlis | e28c6d5 | 2017-02-06 17:02:03 -0700 | [diff] [blame] | 3419 | instance_data->queue_family_properties[i] = pQueueFamilyProperties[i]; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3420 | } |
| 3421 | } |
| 3422 | } |
| 3423 | |
| 3424 | VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 3425 | VkInstance *pInstance) { |
| 3426 | VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
| 3427 | |
| 3428 | assert(chain_info->u.pLayerInfo); |
| 3429 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 3430 | PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)fpGetInstanceProcAddr(NULL, "vkCreateInstance"); |
| 3431 | if (fpCreateInstance == NULL) { |
| 3432 | return VK_ERROR_INITIALIZATION_FAILED; |
| 3433 | } |
| 3434 | |
| 3435 | // Advance the link info for the next element on the chain |
| 3436 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 3437 | |
| 3438 | VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance); |
| 3439 | if (result != VK_SUCCESS) { |
| 3440 | return result; |
| 3441 | } |
| 3442 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3443 | layer_data *instance_data = GetLayerDataPtr(get_dispatch_key(*pInstance), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3444 | instance_data->instance = *pInstance; |
| 3445 | initInstanceTable(*pInstance, fpGetInstanceProcAddr, ot_instance_table_map); |
| 3446 | VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ot_instance_table_map, *pInstance); |
| 3447 | |
| 3448 | // Look for one or more debug report create info structures, and copy the |
| 3449 | // callback(s) for each one found (for use by vkDestroyInstance) |
| 3450 | layer_copy_tmp_callbacks(pCreateInfo->pNext, &instance_data->num_tmp_callbacks, &instance_data->tmp_dbg_create_infos, |
| 3451 | &instance_data->tmp_callbacks); |
| 3452 | |
| 3453 | instance_data->report_data = debug_report_create_instance(pInstanceTable, *pInstance, pCreateInfo->enabledExtensionCount, |
| 3454 | pCreateInfo->ppEnabledExtensionNames); |
| 3455 | |
| 3456 | InitObjectTracker(instance_data, pAllocator); |
| 3457 | CheckInstanceRegisterExtensions(pCreateInfo, *pInstance); |
| 3458 | |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3459 | CreateObject(*pInstance, *pInstance, kVulkanObjectTypeInstance, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3460 | |
| 3461 | return result; |
| 3462 | } |
| 3463 | |
| 3464 | VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, |
| 3465 | VkPhysicalDevice *pPhysicalDevices) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3466 | bool skip = VK_FALSE; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3467 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3468 | skip |= |
| 3469 | ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_00023, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3470 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3471 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3472 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3473 | } |
| 3474 | VkResult result = get_dispatch_table(ot_instance_table_map, instance) |
| 3475 | ->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); |
| 3476 | lock.lock(); |
| 3477 | if (result == VK_SUCCESS) { |
| 3478 | if (pPhysicalDevices) { |
| 3479 | for (uint32_t i = 0; i < *pPhysicalDeviceCount; i++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3480 | CreateObject(instance, pPhysicalDevices[i], kVulkanObjectTypePhysicalDevice, nullptr); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3481 | } |
| 3482 | } |
| 3483 | } |
| 3484 | lock.unlock(); |
| 3485 | return result; |
| 3486 | } |
| 3487 | |
| 3488 | VKAPI_ATTR void VKAPI_CALL GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) { |
| 3489 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3490 | ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00062, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3491 | lock.unlock(); |
| 3492 | |
| 3493 | get_dispatch_table(ot_device_table_map, device)->GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue); |
| 3494 | |
| 3495 | lock.lock(); |
| 3496 | |
Mark Lobodzinski | e58ffe8 | 2017-04-11 13:57:45 -0600 | [diff] [blame] | 3497 | CreateQueue(device, *pQueue); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3498 | AddQueueInfo(device, queueFamilyIndex, *pQueue); |
| 3499 | } |
| 3500 | |
| 3501 | 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] | 3502 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3503 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3504 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00621, VALIDATION_ERROR_UNDEFINED); |
| 3505 | skip |= ValidateObject(device, memory, kVulkanObjectTypeDeviceMemory, true, VALIDATION_ERROR_00622, VALIDATION_ERROR_00624); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3506 | lock.unlock(); |
Tobin Ehlis | 0233735 | 2016-10-20 14:42:57 -0600 | [diff] [blame] | 3507 | if (!skip) { |
| 3508 | get_dispatch_table(ot_device_table_map, device)->FreeMemory(device, memory, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3509 | |
Tobin Ehlis | 0233735 | 2016-10-20 14:42:57 -0600 | [diff] [blame] | 3510 | lock.lock(); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3511 | DestroyObject(device, memory, kVulkanObjectTypeDeviceMemory, pAllocator, VALIDATION_ERROR_UNDEFINED, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 3512 | VALIDATION_ERROR_UNDEFINED); |
Tobin Ehlis | 0233735 | 2016-10-20 14:42:57 -0600 | [diff] [blame] | 3513 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3514 | } |
| 3515 | |
| 3516 | VKAPI_ATTR VkResult VKAPI_CALL MapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, |
| 3517 | VkMemoryMapFlags flags, void **ppData) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3518 | bool skip = VK_FALSE; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3519 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3520 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00630, VALIDATION_ERROR_UNDEFINED); |
| 3521 | skip |= ValidateObject(device, memory, kVulkanObjectTypeDeviceMemory, false, VALIDATION_ERROR_00631, VALIDATION_ERROR_00634); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3522 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3523 | if (skip == VK_TRUE) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3524 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3525 | } |
| 3526 | VkResult result = get_dispatch_table(ot_device_table_map, device)->MapMemory(device, memory, offset, size, flags, ppData); |
| 3527 | return result; |
| 3528 | } |
| 3529 | |
| 3530 | VKAPI_ATTR void VKAPI_CALL UnmapMemory(VkDevice device, VkDeviceMemory memory) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3531 | bool skip = VK_FALSE; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3532 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3533 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00650, VALIDATION_ERROR_UNDEFINED); |
| 3534 | skip |= ValidateObject(device, memory, kVulkanObjectTypeDeviceMemory, false, VALIDATION_ERROR_00651, VALIDATION_ERROR_00652); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3535 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3536 | if (skip == VK_TRUE) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3537 | return; |
| 3538 | } |
| 3539 | |
| 3540 | get_dispatch_table(ot_device_table_map, device)->UnmapMemory(device, memory); |
| 3541 | } |
| 3542 | VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, |
| 3543 | VkFence fence) { |
| 3544 | std::unique_lock<std::mutex> lock(global_lock); |
| 3545 | ValidateQueueFlags(queue, "QueueBindSparse"); |
| 3546 | |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3547 | ValidateObject(queue, queue, kVulkanObjectTypeQueue, false, VALIDATION_ERROR_01648, VALIDATION_ERROR_UNDEFINED); |
| 3548 | ValidateObject(queue, fence, kVulkanObjectTypeFence, true, VALIDATION_ERROR_01650, VALIDATION_ERROR_01652); |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 3549 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3550 | for (uint32_t i = 0; i < bindInfoCount; i++) { |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 3551 | for (uint32_t j = 0; j < pBindInfo[i].bufferBindCount; j++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3552 | ValidateObject(queue, pBindInfo[i].pBufferBinds[j].buffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01656, |
| 3553 | VALIDATION_ERROR_UNDEFINED); |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 3554 | } |
| 3555 | for (uint32_t j = 0; j < pBindInfo[i].imageOpaqueBindCount; j++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3556 | ValidateObject(queue, pBindInfo[i].pImageOpaqueBinds[j].image, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01657, |
| 3557 | VALIDATION_ERROR_UNDEFINED); |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 3558 | } |
| 3559 | for (uint32_t j = 0; j < pBindInfo[i].imageBindCount; j++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3560 | ValidateObject(queue, pBindInfo[i].pImageBinds[j].image, kVulkanObjectTypeImage, false, VALIDATION_ERROR_01658, |
| 3561 | VALIDATION_ERROR_UNDEFINED); |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 3562 | } |
| 3563 | for (uint32_t j = 0; j < pBindInfo[i].waitSemaphoreCount; j++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3564 | ValidateObject(queue, pBindInfo[i].pWaitSemaphores[j], kVulkanObjectTypeSemaphore, false, VALIDATION_ERROR_01655, |
| 3565 | VALIDATION_ERROR_01660); |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 3566 | } |
| 3567 | for (uint32_t j = 0; j < pBindInfo[i].signalSemaphoreCount; j++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3568 | ValidateObject(queue, pBindInfo[i].pSignalSemaphores[j], kVulkanObjectTypeSemaphore, false, VALIDATION_ERROR_01659, |
| 3569 | VALIDATION_ERROR_01660); |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 3570 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3571 | } |
| 3572 | lock.unlock(); |
| 3573 | |
| 3574 | VkResult result = get_dispatch_table(ot_device_table_map, queue)->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); |
| 3575 | return result; |
| 3576 | } |
| 3577 | |
| 3578 | VKAPI_ATTR VkResult VKAPI_CALL AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, |
| 3579 | VkCommandBuffer *pCommandBuffers) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3580 | bool skip = VK_FALSE; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3581 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3582 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00084, VALIDATION_ERROR_UNDEFINED); |
| 3583 | skip |= ValidateObject(device, pAllocateInfo->commandPool, kVulkanObjectTypeCommandPool, false, VALIDATION_ERROR_00090, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3584 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3585 | lock.unlock(); |
| 3586 | |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3587 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3588 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3589 | } |
| 3590 | |
| 3591 | VkResult result = |
| 3592 | get_dispatch_table(ot_device_table_map, device)->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers); |
| 3593 | |
| 3594 | lock.lock(); |
| 3595 | for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) { |
Mark Lobodzinski | e58ffe8 | 2017-04-11 13:57:45 -0600 | [diff] [blame] | 3596 | AllocateCommandBuffer(device, pAllocateInfo->commandPool, pCommandBuffers[i], pAllocateInfo->level); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3597 | } |
| 3598 | lock.unlock(); |
| 3599 | |
| 3600 | return result; |
| 3601 | } |
| 3602 | |
| 3603 | VKAPI_ATTR VkResult VKAPI_CALL AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, |
| 3604 | VkDescriptorSet *pDescriptorSets) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3605 | bool skip = VK_FALSE; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3606 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3607 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00908, VALIDATION_ERROR_UNDEFINED); |
| 3608 | skip |= ValidateObject(device, pAllocateInfo->descriptorPool, kVulkanObjectTypeDescriptorPool, false, VALIDATION_ERROR_00915, |
| 3609 | VALIDATION_ERROR_00918); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3610 | for (uint32_t i = 0; i < pAllocateInfo->descriptorSetCount; i++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3611 | skip |= ValidateObject(device, pAllocateInfo->pSetLayouts[i], kVulkanObjectTypeDescriptorSetLayout, false, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3612 | VALIDATION_ERROR_00916, VALIDATION_ERROR_00918); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3613 | } |
| 3614 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3615 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3616 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3617 | } |
| 3618 | |
| 3619 | VkResult result = |
| 3620 | get_dispatch_table(ot_device_table_map, device)->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets); |
| 3621 | |
| 3622 | if (VK_SUCCESS == result) { |
| 3623 | lock.lock(); |
| 3624 | for (uint32_t i = 0; i < pAllocateInfo->descriptorSetCount; i++) { |
Mark Lobodzinski | e58ffe8 | 2017-04-11 13:57:45 -0600 | [diff] [blame] | 3625 | AllocateDescriptorSet(device, pAllocateInfo->descriptorPool, pDescriptorSets[i]); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3626 | } |
| 3627 | lock.unlock(); |
| 3628 | } |
| 3629 | |
| 3630 | return result; |
| 3631 | } |
| 3632 | |
| 3633 | VKAPI_ATTR void VKAPI_CALL FreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, |
| 3634 | const VkCommandBuffer *pCommandBuffers) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3635 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3636 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3637 | ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00098, VALIDATION_ERROR_UNDEFINED); |
| 3638 | ValidateObject(device, commandPool, kVulkanObjectTypeCommandPool, false, VALIDATION_ERROR_00099, VALIDATION_ERROR_00101); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3639 | for (uint32_t i = 0; i < commandBufferCount; i++) { |
Tony Barbour | 5b28fe7 | 2017-02-02 09:31:30 -0700 | [diff] [blame] | 3640 | if (pCommandBuffers[i] != VK_NULL_HANDLE) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3641 | skip |= ValidateCommandBuffer(device, commandPool, pCommandBuffers[i]); |
Tony Barbour | 5b28fe7 | 2017-02-02 09:31:30 -0700 | [diff] [blame] | 3642 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3643 | } |
| 3644 | |
Mark Lobodzinski | 9bb1154 | 2016-07-13 11:29:00 -0600 | [diff] [blame] | 3645 | for (uint32_t i = 0; i < commandBufferCount; i++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3646 | DestroyObject(device, pCommandBuffers[i], kVulkanObjectTypeCommandBuffer, nullptr, VALIDATION_ERROR_UNDEFINED, |
| 3647 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bb1154 | 2016-07-13 11:29:00 -0600 | [diff] [blame] | 3648 | } |
| 3649 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3650 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3651 | if (!skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3652 | get_dispatch_table(ot_device_table_map, device) |
| 3653 | ->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers); |
| 3654 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3655 | } |
| 3656 | VKAPI_ATTR void VKAPI_CALL DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3657 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3658 | std::unique_lock<std::mutex> lock(global_lock); |
| 3659 | // A swapchain's images are implicitly deleted when the swapchain is deleted. |
| 3660 | // Remove this swapchain's images from our map of such images. |
| 3661 | std::unordered_map<uint64_t, OBJTRACK_NODE *>::iterator itr = device_data->swapchainImageMap.begin(); |
| 3662 | while (itr != device_data->swapchainImageMap.end()) { |
| 3663 | OBJTRACK_NODE *pNode = (*itr).second; |
| 3664 | if (pNode->parent_object == reinterpret_cast<uint64_t &>(swapchain)) { |
| 3665 | delete pNode; |
| 3666 | auto delete_item = itr++; |
| 3667 | device_data->swapchainImageMap.erase(delete_item); |
| 3668 | } else { |
| 3669 | ++itr; |
| 3670 | } |
| 3671 | } |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3672 | DestroyObject(device, swapchain, kVulkanObjectTypeSwapchainKHR, pAllocator, VALIDATION_ERROR_01938, VALIDATION_ERROR_01939); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3673 | lock.unlock(); |
| 3674 | |
| 3675 | get_dispatch_table(ot_device_table_map, device)->DestroySwapchainKHR(device, swapchain, pAllocator); |
| 3676 | } |
| 3677 | |
| 3678 | VKAPI_ATTR VkResult VKAPI_CALL FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, |
| 3679 | const VkDescriptorSet *pDescriptorSets) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3680 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3681 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 3682 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3683 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00923, VALIDATION_ERROR_UNDEFINED); |
| 3684 | skip |= ValidateObject(device, descriptorPool, kVulkanObjectTypeDescriptorPool, false, VALIDATION_ERROR_00924, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3685 | VALIDATION_ERROR_00926); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3686 | for (uint32_t i = 0; i < descriptorSetCount; i++) { |
Tony Barbour | 5b28fe7 | 2017-02-02 09:31:30 -0700 | [diff] [blame] | 3687 | if (pDescriptorSets[i] != VK_NULL_HANDLE) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3688 | skip |= ValidateDescriptorSet(device, descriptorPool, pDescriptorSets[i]); |
Tony Barbour | 5b28fe7 | 2017-02-02 09:31:30 -0700 | [diff] [blame] | 3689 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3690 | } |
| 3691 | |
Mark Lobodzinski | 9bb1154 | 2016-07-13 11:29:00 -0600 | [diff] [blame] | 3692 | for (uint32_t i = 0; i < descriptorSetCount; i++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3693 | DestroyObject(device, pDescriptorSets[i], kVulkanObjectTypeDescriptorSet, nullptr, VALIDATION_ERROR_UNDEFINED, |
| 3694 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bb1154 | 2016-07-13 11:29:00 -0600 | [diff] [blame] | 3695 | } |
| 3696 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3697 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3698 | if (!skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3699 | result = get_dispatch_table(ot_device_table_map, device) |
| 3700 | ->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets); |
| 3701 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3702 | return result; |
| 3703 | } |
| 3704 | |
| 3705 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 3706 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3707 | bool skip = VK_FALSE; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3708 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3709 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3710 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00904, VALIDATION_ERROR_UNDEFINED); |
| 3711 | skip |= ValidateObject(device, descriptorPool, kVulkanObjectTypeDescriptorPool, true, VALIDATION_ERROR_00905, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3712 | VALIDATION_ERROR_00907); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3713 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3714 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3715 | return; |
| 3716 | } |
| 3717 | // A DescriptorPool's descriptor sets are implicitly deleted when the pool is deleted. |
| 3718 | // Remove this pool's descriptor sets from our descriptorSet map. |
| 3719 | lock.lock(); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3720 | std::unordered_map<uint64_t, OBJTRACK_NODE *>::iterator itr = device_data->object_map[kVulkanObjectTypeDescriptorSet].begin(); |
| 3721 | while (itr != device_data->object_map[kVulkanObjectTypeDescriptorSet].end()) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3722 | OBJTRACK_NODE *pNode = (*itr).second; |
| 3723 | auto del_itr = itr++; |
| 3724 | if (pNode->parent_object == reinterpret_cast<uint64_t &>(descriptorPool)) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3725 | DestroyObject(device, (VkDescriptorSet)((*del_itr).first), kVulkanObjectTypeDescriptorSet, nullptr, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 3726 | VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3727 | } |
| 3728 | } |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3729 | DestroyObject(device, descriptorPool, kVulkanObjectTypeDescriptorPool, pAllocator, VALIDATION_ERROR_00902, |
Mike Schuchardt | 3796a88 | 2016-12-06 18:03:56 -0700 | [diff] [blame] | 3730 | VALIDATION_ERROR_00903); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3731 | lock.unlock(); |
| 3732 | get_dispatch_table(ot_device_table_map, device)->DestroyDescriptorPool(device, descriptorPool, pAllocator); |
| 3733 | } |
| 3734 | |
| 3735 | VKAPI_ATTR void VKAPI_CALL DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3736 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3737 | bool skip = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3738 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3739 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00080, VALIDATION_ERROR_UNDEFINED); |
| 3740 | skip |= ValidateObject(device, commandPool, kVulkanObjectTypeCommandPool, true, VALIDATION_ERROR_00081, VALIDATION_ERROR_00083); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3741 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3742 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3743 | return; |
| 3744 | } |
| 3745 | lock.lock(); |
| 3746 | // A CommandPool's command buffers are implicitly deleted when the pool is deleted. |
| 3747 | // Remove this pool's cmdBuffers from our cmd buffer map. |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3748 | auto itr = device_data->object_map[kVulkanObjectTypeCommandBuffer].begin(); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3749 | auto del_itr = itr; |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3750 | while (itr != device_data->object_map[kVulkanObjectTypeCommandBuffer].end()) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3751 | OBJTRACK_NODE *pNode = (*itr).second; |
| 3752 | del_itr = itr++; |
| 3753 | if (pNode->parent_object == reinterpret_cast<uint64_t &>(commandPool)) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3754 | skip |= ValidateCommandBuffer(device, commandPool, reinterpret_cast<VkCommandBuffer>((*del_itr).first)); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3755 | DestroyObject(device, reinterpret_cast<VkCommandBuffer>((*del_itr).first), kVulkanObjectTypeCommandBuffer, nullptr, |
| 3756 | VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3757 | } |
| 3758 | } |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3759 | DestroyObject(device, commandPool, kVulkanObjectTypeCommandPool, pAllocator, VALIDATION_ERROR_00078, VALIDATION_ERROR_00079); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3760 | lock.unlock(); |
| 3761 | get_dispatch_table(ot_device_table_map, device)->DestroyCommandPool(device, commandPool, pAllocator); |
| 3762 | } |
| 3763 | |
| 3764 | VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, |
| 3765 | VkImage *pSwapchainImages) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3766 | bool skip = VK_FALSE; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3767 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3768 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_01948, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3769 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3770 | if (skip) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3771 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3772 | } |
| 3773 | VkResult result = get_dispatch_table(ot_device_table_map, device) |
| 3774 | ->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); |
| 3775 | if (pSwapchainImages != NULL) { |
| 3776 | lock.lock(); |
| 3777 | for (uint32_t i = 0; i < *pSwapchainImageCount; i++) { |
| 3778 | CreateSwapchainImageObject(device, pSwapchainImages[i], swapchain); |
| 3779 | } |
| 3780 | lock.unlock(); |
| 3781 | } |
| 3782 | return result; |
| 3783 | } |
| 3784 | |
| 3785 | VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 3786 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
| 3787 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3788 | bool skip = VK_FALSE; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3789 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3790 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00519, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3791 | if (pCreateInfos) { |
| 3792 | for (uint32_t idx0 = 0; idx0 < createInfoCount; ++idx0) { |
| 3793 | if (pCreateInfos[idx0].basePipelineHandle) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3794 | skip |= ValidateObject(device, pCreateInfos[idx0].basePipelineHandle, kVulkanObjectTypePipeline, true, |
| 3795 | VALIDATION_ERROR_00529, VALIDATION_ERROR_00549); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3796 | } |
| 3797 | if (pCreateInfos[idx0].layout) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3798 | skip |= ValidateObject(device, pCreateInfos[idx0].layout, kVulkanObjectTypePipelineLayout, false, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3799 | VALIDATION_ERROR_00546, VALIDATION_ERROR_00549); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3800 | } |
| 3801 | if (pCreateInfos[idx0].pStages) { |
| 3802 | for (uint32_t idx1 = 0; idx1 < pCreateInfos[idx0].stageCount; ++idx1) { |
| 3803 | if (pCreateInfos[idx0].pStages[idx1].module) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3804 | skip |= ValidateObject(device, pCreateInfos[idx0].pStages[idx1].module, kVulkanObjectTypeShaderModule, |
| 3805 | false, VALIDATION_ERROR_00515, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3806 | } |
| 3807 | } |
| 3808 | } |
| 3809 | if (pCreateInfos[idx0].renderPass) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3810 | skip |= ValidateObject(device, pCreateInfos[idx0].renderPass, kVulkanObjectTypeRenderPass, false, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3811 | VALIDATION_ERROR_00547, VALIDATION_ERROR_00549); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3812 | } |
| 3813 | } |
| 3814 | } |
| 3815 | if (pipelineCache) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3816 | skip |= ValidateObject(device, pipelineCache, kVulkanObjectTypePipelineCache, true, VALIDATION_ERROR_00520, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3817 | VALIDATION_ERROR_00525); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3818 | } |
| 3819 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3820 | if (skip) { |
Chris Forbes | 8d24dc9 | 2016-11-30 14:56:52 +1300 | [diff] [blame] | 3821 | for (uint32_t i = 0; i < createInfoCount; i++) { |
| 3822 | pPipelines[i] = VK_NULL_HANDLE; |
| 3823 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3824 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3825 | } |
| 3826 | VkResult result = get_dispatch_table(ot_device_table_map, device) |
| 3827 | ->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
| 3828 | lock.lock(); |
Maciej Jesionowski | 4220070 | 2016-11-23 10:44:34 +0100 | [diff] [blame] | 3829 | for (uint32_t idx2 = 0; idx2 < createInfoCount; ++idx2) { |
| 3830 | if (pPipelines[idx2] != VK_NULL_HANDLE) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3831 | CreateObject(device, pPipelines[idx2], kVulkanObjectTypePipeline, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3832 | } |
| 3833 | } |
| 3834 | lock.unlock(); |
| 3835 | return result; |
| 3836 | } |
| 3837 | |
| 3838 | VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 3839 | const VkComputePipelineCreateInfo *pCreateInfos, |
| 3840 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3841 | bool skip = VK_FALSE; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3842 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3843 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_00486, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3844 | if (pCreateInfos) { |
| 3845 | for (uint32_t idx0 = 0; idx0 < createInfoCount; ++idx0) { |
| 3846 | if (pCreateInfos[idx0].basePipelineHandle) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3847 | skip |= ValidateObject(device, pCreateInfos[idx0].basePipelineHandle, kVulkanObjectTypePipeline, true, |
| 3848 | VALIDATION_ERROR_00496, VALIDATION_ERROR_00506); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3849 | } |
| 3850 | if (pCreateInfos[idx0].layout) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3851 | skip |= ValidateObject(device, pCreateInfos[idx0].layout, kVulkanObjectTypePipelineLayout, false, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3852 | VALIDATION_ERROR_00505, VALIDATION_ERROR_00506); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3853 | } |
| 3854 | if (pCreateInfos[idx0].stage.module) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3855 | skip |= ValidateObject(device, pCreateInfos[idx0].stage.module, kVulkanObjectTypeShaderModule, false, |
| 3856 | VALIDATION_ERROR_00515, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3857 | } |
| 3858 | } |
| 3859 | } |
| 3860 | if (pipelineCache) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3861 | skip |= ValidateObject(device, pipelineCache, kVulkanObjectTypePipelineCache, true, VALIDATION_ERROR_00487, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3862 | VALIDATION_ERROR_00492); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3863 | } |
| 3864 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3865 | if (skip) { |
Chris Forbes | 8d24dc9 | 2016-11-30 14:56:52 +1300 | [diff] [blame] | 3866 | for (uint32_t i = 0; i < createInfoCount; i++) { |
| 3867 | pPipelines[i] = VK_NULL_HANDLE; |
| 3868 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3869 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3870 | } |
| 3871 | VkResult result = get_dispatch_table(ot_device_table_map, device) |
| 3872 | ->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
| 3873 | lock.lock(); |
Maciej Jesionowski | 4220070 | 2016-11-23 10:44:34 +0100 | [diff] [blame] | 3874 | for (uint32_t idx1 = 0; idx1 < createInfoCount; ++idx1) { |
| 3875 | if (pPipelines[idx1] != VK_NULL_HANDLE) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3876 | CreateObject(device, pPipelines[idx1], kVulkanObjectTypePipeline, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3877 | } |
| 3878 | } |
| 3879 | lock.unlock(); |
| 3880 | return result; |
| 3881 | } |
| 3882 | |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 3883 | // VK_KHR_display Extension |
| 3884 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 3885 | VkDisplayPropertiesKHR *pProperties) { |
| 3886 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 3887 | bool skip = false; |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3888 | { |
| 3889 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3890 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01851, |
| 3891 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3892 | } |
| 3893 | if (!skip) { |
| 3894 | result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3895 | ->GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, pPropertyCount, pProperties); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3896 | } |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 3897 | return result; |
| 3898 | } |
| 3899 | |
| 3900 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 3901 | VkDisplayPlanePropertiesKHR *pProperties) { |
| 3902 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 3903 | bool skip = false; |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3904 | { |
| 3905 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3906 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01854, |
| 3907 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3908 | } |
| 3909 | if (!skip) { |
| 3910 | result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3911 | ->GetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, pPropertyCount, pProperties); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3912 | } |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 3913 | return result; |
| 3914 | } |
| 3915 | |
| 3916 | VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, |
| 3917 | uint32_t *pDisplayCount, VkDisplayKHR *pDisplays) { |
| 3918 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 3919 | bool skip = false; |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3920 | { |
| 3921 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3922 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01858, |
| 3923 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3924 | } |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 3925 | result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 3926 | ->GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, pDisplayCount, pDisplays); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3927 | if (((result == VK_SUCCESS) || (result == VK_INCOMPLETE)) && (pDisplays != NULL)) { |
| 3928 | std::lock_guard<std::mutex> lock(global_lock); |
| 3929 | for (uint32_t displays = 0; displays < *pDisplayCount; displays++) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3930 | CreateObject(physicalDevice, pDisplays[displays], kVulkanObjectTypeDisplayKHR, nullptr); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3931 | } |
| 3932 | } |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 3933 | return result; |
| 3934 | } |
| 3935 | |
| 3936 | VKAPI_ATTR VkResult VKAPI_CALL GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 3937 | uint32_t *pPropertyCount, VkDisplayModePropertiesKHR *pProperties) { |
| 3938 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 3939 | bool skip = false; |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3940 | { |
| 3941 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3942 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01861, |
| 3943 | VALIDATION_ERROR_UNDEFINED); |
| 3944 | skip |= ValidateObject(physicalDevice, display, kVulkanObjectTypeDisplayKHR, false, VALIDATION_ERROR_01862, |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 3945 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3946 | } |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 3947 | result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 3948 | ->GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, pProperties); |
| 3949 | |
| 3950 | return result; |
| 3951 | } |
| 3952 | |
| 3953 | VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 3954 | const VkDisplayModeCreateInfoKHR *pCreateInfo, |
| 3955 | const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) { |
| 3956 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 3957 | bool skip = false; |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3958 | { |
| 3959 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3960 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01865, |
| 3961 | VALIDATION_ERROR_UNDEFINED); |
| 3962 | skip |= ValidateObject(physicalDevice, display, kVulkanObjectTypeDisplayKHR, false, VALIDATION_ERROR_01866, |
Mike Schuchardt | dc2cb78 | 2017-02-14 15:33:52 -0700 | [diff] [blame] | 3963 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3964 | } |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 3965 | result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 3966 | ->CreateDisplayModeKHR(physicalDevice, display, pCreateInfo, pAllocator, pMode); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3967 | { |
| 3968 | std::lock_guard<std::mutex> lock(global_lock); |
| 3969 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3970 | CreateObject(physicalDevice, *pMode, kVulkanObjectTypeDisplayModeKHR, pAllocator); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3971 | } |
| 3972 | } |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 3973 | return result; |
| 3974 | } |
| 3975 | |
| 3976 | VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, |
| 3977 | uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR *pCapabilities) { |
| 3978 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 3979 | bool skip = false; |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3980 | { |
| 3981 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3982 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01875, |
| 3983 | VALIDATION_ERROR_UNDEFINED); |
| 3984 | skip |= ValidateObject(physicalDevice, mode, kVulkanObjectTypeDisplayModeKHR, false, VALIDATION_ERROR_01876, |
| 3985 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3986 | } |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 3987 | result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 3988 | ->GetDisplayPlaneCapabilitiesKHR(physicalDevice, mode, planeIndex, pCapabilities); |
| 3989 | |
| 3990 | return result; |
| 3991 | } |
| 3992 | |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3993 | VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayPlaneSurfaceKHR(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3994 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3995 | bool skip = false; |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 3996 | { |
| 3997 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 3998 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_01878, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 3999 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4000 | skip |= ValidateObject(instance, pCreateInfo->displayMode, kVulkanObjectTypeDisplayModeKHR, false, VALIDATION_ERROR_01886, |
| 4001 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 4002 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4003 | if (skip) { |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 4004 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4005 | } |
| 4006 | VkResult result = get_dispatch_table(ot_instance_table_map, instance) |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4007 | ->CreateDisplayPlaneSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 4008 | { |
| 4009 | std::lock_guard<std::mutex> lock(global_lock); |
| 4010 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4011 | CreateObject(instance, *pSurface, kVulkanObjectTypeSurfaceKHR, pAllocator); |
Mark Lobodzinski | 3aa148a | 2016-11-14 10:32:41 -0700 | [diff] [blame] | 4012 | } |
| 4013 | } |
| 4014 | return result; |
| 4015 | } |
| 4016 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4017 | // VK_KHR_get_physical_device_properties2 Extension |
| 4018 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR *pFeatures) { |
| 4019 | bool skip = false; |
| 4020 | { |
Tobin Ehlis | fc85c62 | 2017-02-06 16:15:55 -0700 | [diff] [blame] | 4021 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4022 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4023 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4024 | } |
| 4025 | if (!skip) { |
| 4026 | get_dispatch_table(ot_instance_table_map, physicalDevice)->GetPhysicalDeviceFeatures2KHR(physicalDevice, pFeatures); |
| 4027 | } |
| 4028 | } |
| 4029 | |
| 4030 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, |
| 4031 | VkPhysicalDeviceProperties2KHR *pProperties) { |
| 4032 | bool skip = false; |
| 4033 | { |
Tobin Ehlis | fc85c62 | 2017-02-06 16:15:55 -0700 | [diff] [blame] | 4034 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4035 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4036 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4037 | } |
| 4038 | if (!skip) { |
| 4039 | get_dispatch_table(ot_instance_table_map, physicalDevice)->GetPhysicalDeviceProperties2KHR(physicalDevice, pProperties); |
| 4040 | } |
| 4041 | } |
| 4042 | |
| 4043 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, |
| 4044 | VkFormatProperties2KHR *pFormatProperties) { |
| 4045 | bool skip = false; |
| 4046 | { |
Tobin Ehlis | fc85c62 | 2017-02-06 16:15:55 -0700 | [diff] [blame] | 4047 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4048 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4049 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4050 | } |
| 4051 | if (!skip) { |
| 4052 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4053 | ->GetPhysicalDeviceFormatProperties2KHR(physicalDevice, format, pFormatProperties); |
| 4054 | } |
| 4055 | } |
| 4056 | |
| 4057 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties2KHR( |
| 4058 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo, |
| 4059 | VkImageFormatProperties2KHR *pImageFormatProperties) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4060 | bool skip = false; |
| 4061 | { |
Tobin Ehlis | fc85c62 | 2017-02-06 16:15:55 -0700 | [diff] [blame] | 4062 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4063 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4064 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4065 | } |
| 4066 | if (skip) { |
| 4067 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4068 | } |
Tobin Ehlis | fc85c62 | 2017-02-06 16:15:55 -0700 | [diff] [blame] | 4069 | VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4070 | ->GetPhysicalDeviceImageFormatProperties2KHR(physicalDevice, pImageFormatInfo, pImageFormatProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4071 | |
| 4072 | return result; |
| 4073 | } |
| 4074 | |
| 4075 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physicalDevice, |
| 4076 | uint32_t *pQueueFamilyPropertyCount, |
| 4077 | VkQueueFamilyProperties2KHR *pQueueFamilyProperties) { |
| 4078 | bool skip = false; |
| 4079 | { |
Tobin Ehlis | fc85c62 | 2017-02-06 16:15:55 -0700 | [diff] [blame] | 4080 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4081 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4082 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4083 | } |
Tobin Ehlis | fc85c62 | 2017-02-06 16:15:55 -0700 | [diff] [blame] | 4084 | if (skip) { |
| 4085 | return; |
| 4086 | } |
| 4087 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4088 | ->GetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
| 4089 | std::lock_guard<std::mutex> lock(global_lock); |
| 4090 | if (pQueueFamilyProperties != NULL) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4091 | layer_data *instance_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
Tobin Ehlis | e28c6d5 | 2017-02-06 17:02:03 -0700 | [diff] [blame] | 4092 | if (instance_data->queue_family_properties.size() < *pQueueFamilyPropertyCount) { |
| 4093 | instance_data->queue_family_properties.resize(*pQueueFamilyPropertyCount); |
| 4094 | } |
Tobin Ehlis | fc85c62 | 2017-02-06 16:15:55 -0700 | [diff] [blame] | 4095 | for (uint32_t i = 0; i < *pQueueFamilyPropertyCount; i++) { |
Tobin Ehlis | e28c6d5 | 2017-02-06 17:02:03 -0700 | [diff] [blame] | 4096 | instance_data->queue_family_properties[i] = pQueueFamilyProperties[i].queueFamilyProperties; |
Tobin Ehlis | fc85c62 | 2017-02-06 16:15:55 -0700 | [diff] [blame] | 4097 | } |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4098 | } |
| 4099 | } |
| 4100 | |
| 4101 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physicalDevice, |
| 4102 | VkPhysicalDeviceMemoryProperties2KHR *pMemoryProperties) { |
| 4103 | bool skip = false; |
| 4104 | { |
Tobin Ehlis | fc85c62 | 2017-02-06 16:15:55 -0700 | [diff] [blame] | 4105 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4106 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4107 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4108 | } |
| 4109 | if (!skip) { |
| 4110 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4111 | ->GetPhysicalDeviceMemoryProperties2KHR(physicalDevice, pMemoryProperties); |
| 4112 | } |
| 4113 | } |
| 4114 | |
| 4115 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties2KHR( |
| 4116 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, uint32_t *pPropertyCount, |
| 4117 | VkSparseImageFormatProperties2KHR *pProperties) { |
| 4118 | bool skip = false; |
| 4119 | { |
Tobin Ehlis | fc85c62 | 2017-02-06 16:15:55 -0700 | [diff] [blame] | 4120 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4121 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4122 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4123 | } |
| 4124 | if (!skip) { |
| 4125 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4126 | ->GetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice, pFormatInfo, pPropertyCount, pProperties); |
| 4127 | } |
| 4128 | } |
| 4129 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4130 | // VK_KHR_descriptor_update_template |
| 4131 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorUpdateTemplateKHR(VkDevice device, |
| 4132 | const VkDescriptorUpdateTemplateCreateInfoKHR *pCreateInfo, |
| 4133 | const VkAllocationCallbacks *pAllocator, |
| 4134 | VkDescriptorUpdateTemplateKHR *pDescriptorUpdateTemplate) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4135 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4136 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4137 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4138 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4139 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4140 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4141 | } |
| 4142 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4143 | VkResult result = VK_SUCCESS; |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4144 | result = dev_data->dispatch_table.CreateDescriptorUpdateTemplateKHR(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate); |
| 4145 | // TODO: Add tracking of VkDescriptorUpdateTemplateKHR |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4146 | return result; |
| 4147 | } |
| 4148 | |
| 4149 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorUpdateTemplateKHR(VkDevice device, |
| 4150 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, |
| 4151 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4152 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4153 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4154 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4155 | // TODO: Add tracking of VkDescriptorUpdateTemplateKHR |
| 4156 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4157 | if (!skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4158 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4159 | dev_data->dispatch_table.DestroyDescriptorUpdateTemplateKHR(device, descriptorUpdateTemplate, pAllocator); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4160 | } |
| 4161 | } |
| 4162 | |
| 4163 | VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSetWithTemplateKHR(VkDevice device, VkDescriptorSet descriptorSet, |
| 4164 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, |
| 4165 | const void *pData) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4166 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4167 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4168 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
| 4169 | skip |= ValidateObject(device, descriptorSet, kVulkanObjectTypeDescriptorSet, false, VALIDATION_ERROR_UNDEFINED, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4170 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4171 | // TODO: Add tracking of VkDescriptorUpdateTemplateKHR |
| 4172 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4173 | if (!skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4174 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4175 | dev_data->dispatch_table.UpdateDescriptorSetWithTemplateKHR(device, descriptorSet, descriptorUpdateTemplate, pData); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4176 | } |
| 4177 | } |
| 4178 | |
| 4179 | VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer, |
| 4180 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, |
| 4181 | VkPipelineLayout layout, uint32_t set, const void *pData) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4182 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4183 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4184 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_UNDEFINED, |
| 4185 | VALIDATION_ERROR_UNDEFINED); |
| 4186 | skip |= ValidateObject(commandBuffer, layout, kVulkanObjectTypePipelineLayout, false, VALIDATION_ERROR_UNDEFINED, |
| 4187 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4188 | // TODO: Add tracking of VkDescriptorUpdateTemplateKHR |
| 4189 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4190 | if (!skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4191 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4192 | dev_data->dispatch_table.CmdPushDescriptorSetWithTemplateKHR(commandBuffer, descriptorUpdateTemplate, layout, set, pData); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4193 | } |
| 4194 | } |
| 4195 | |
| 4196 | // VK_KHR_maintenance1 Extension |
| 4197 | VKAPI_ATTR void VKAPI_CALL TrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlagsKHR flags) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4198 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4199 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4200 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
| 4201 | skip |= ValidateObject(device, commandPool, kVulkanObjectTypeCommandPool, false, VALIDATION_ERROR_UNDEFINED, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4202 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4203 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4204 | if (!skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4205 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4206 | dev_data->dispatch_table.TrimCommandPoolKHR(device, commandPool, flags); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4207 | } |
| 4208 | } |
| 4209 | |
| 4210 | // VK_KHR_push_descriptor Extension |
| 4211 | VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 4212 | VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, |
| 4213 | const VkWriteDescriptorSet *pDescriptorWrites) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4214 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4215 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4216 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_UNDEFINED, |
| 4217 | VALIDATION_ERROR_UNDEFINED); |
| 4218 | skip |= ValidateObject(commandBuffer, layout, kVulkanObjectTypePipelineLayout, false, VALIDATION_ERROR_UNDEFINED, |
| 4219 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4220 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4221 | if (!skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4222 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 4223 | ->CmdPushDescriptorSetKHR(commandBuffer, pipelineBindPoint, layout, set, descriptorWriteCount, pDescriptorWrites); |
| 4224 | } |
| 4225 | } |
| 4226 | |
| 4227 | // VK_KHX_device_group Extension |
| 4228 | VKAPI_ATTR void VKAPI_CALL GetDeviceGroupPeerMemoryFeaturesKHX(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, |
| 4229 | uint32_t remoteDeviceIndex, |
| 4230 | VkPeerMemoryFeatureFlagsKHX *pPeerMemoryFeatures) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4231 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4232 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4233 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4234 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4235 | if (!skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4236 | get_dispatch_table(ot_device_table_map, device) |
| 4237 | ->GetDeviceGroupPeerMemoryFeaturesKHX(device, heapIndex, localDeviceIndex, remoteDeviceIndex, pPeerMemoryFeatures); |
| 4238 | } |
| 4239 | } |
| 4240 | |
| 4241 | VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory2KHX(VkDevice device, uint32_t bindInfoCount, |
| 4242 | const VkBindBufferMemoryInfoKHX *pBindInfos) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4243 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4244 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4245 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4246 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4247 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4248 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4249 | } |
| 4250 | VkResult result = VK_SUCCESS; |
| 4251 | result = get_dispatch_table(ot_device_table_map, device)->BindBufferMemory2KHX(device, bindInfoCount, pBindInfos); |
| 4252 | return result; |
| 4253 | } |
| 4254 | |
| 4255 | VKAPI_ATTR VkResult VKAPI_CALL BindImageMemory2KHX(VkDevice device, uint32_t bindInfoCount, |
| 4256 | const VkBindImageMemoryInfoKHX *pBindInfos) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4257 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4258 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4259 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4260 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4261 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4262 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4263 | } |
| 4264 | VkResult result = VK_SUCCESS; |
| 4265 | result = get_dispatch_table(ot_device_table_map, device)->BindImageMemory2KHX(device, bindInfoCount, pBindInfos); |
| 4266 | return result; |
| 4267 | } |
| 4268 | |
| 4269 | VKAPI_ATTR void VKAPI_CALL CmdSetDeviceMaskKHX(VkCommandBuffer commandBuffer, uint32_t deviceMask) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4270 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4271 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4272 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_UNDEFINED, |
| 4273 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4274 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4275 | if (!skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4276 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetDeviceMaskKHX(commandBuffer, deviceMask); |
| 4277 | } |
| 4278 | } |
| 4279 | |
| 4280 | VKAPI_ATTR VkResult VKAPI_CALL |
| 4281 | GetDeviceGroupPresentCapabilitiesKHX(VkDevice device, VkDeviceGroupPresentCapabilitiesKHX *pDeviceGroupPresentCapabilities) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4282 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4283 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4284 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4285 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4286 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4287 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4288 | } |
| 4289 | VkResult result = VK_SUCCESS; |
| 4290 | result = get_dispatch_table(ot_device_table_map, device) |
| 4291 | ->GetDeviceGroupPresentCapabilitiesKHX(device, pDeviceGroupPresentCapabilities); |
| 4292 | return result; |
| 4293 | } |
| 4294 | |
| 4295 | VKAPI_ATTR VkResult VKAPI_CALL GetDeviceGroupSurfacePresentModesKHX(VkDevice device, VkSurfaceKHR surface, |
| 4296 | VkDeviceGroupPresentModeFlagsKHX *pModes) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4297 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4298 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4299 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4300 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4301 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4302 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4303 | } |
| 4304 | VkResult result = VK_SUCCESS; |
| 4305 | result = get_dispatch_table(ot_device_table_map, device)->GetDeviceGroupSurfacePresentModesKHX(device, surface, pModes); |
| 4306 | return result; |
| 4307 | } |
| 4308 | |
| 4309 | VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImage2KHX(VkDevice device, const VkAcquireNextImageInfoKHX *pAcquireInfo, |
| 4310 | uint32_t *pImageIndex) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4311 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4312 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4313 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4314 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4315 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4316 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4317 | } |
| 4318 | VkResult result = VK_SUCCESS; |
| 4319 | result = get_dispatch_table(ot_device_table_map, device)->AcquireNextImage2KHX(device, pAcquireInfo, pImageIndex); |
| 4320 | return result; |
| 4321 | } |
| 4322 | |
| 4323 | VKAPI_ATTR void VKAPI_CALL CmdDispatchBaseKHX(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, |
| 4324 | uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, |
| 4325 | uint32_t groupCountZ) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4326 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4327 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4328 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_UNDEFINED, |
| 4329 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4330 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4331 | if (!skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4332 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 4333 | ->CmdDispatchBaseKHX(commandBuffer, baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, groupCountZ); |
| 4334 | } |
| 4335 | } |
| 4336 | |
| 4337 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDevicePresentRectanglesKHX(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 4338 | uint32_t *pRectCount, VkRect2D *pRects) { |
| 4339 | bool skip = false; |
| 4340 | { |
| 4341 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4342 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4343 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4344 | } |
| 4345 | if (!skip) { |
| 4346 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4347 | ->GetPhysicalDevicePresentRectanglesKHX(physicalDevice, surface, pRectCount, pRects); |
| 4348 | } |
| 4349 | } |
| 4350 | |
| 4351 | // VK_KHX_device_group_creation Extension |
| 4352 | VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceGroupsKHX( |
| 4353 | VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupPropertiesKHX *pPhysicalDeviceGroupProperties) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4354 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4355 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4356 | skip |= ValidateObject(instance, instance, kVulkanObjectTypeInstance, false, VALIDATION_ERROR_UNDEFINED, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4357 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4358 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4359 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4360 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4361 | } |
| 4362 | VkResult result = get_dispatch_table(ot_instance_table_map, instance) |
| 4363 | ->EnumeratePhysicalDeviceGroupsKHX(instance, pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties); |
| 4364 | { |
| 4365 | lock.lock(); |
| 4366 | if (result == VK_SUCCESS) { |
| 4367 | if (nullptr != pPhysicalDeviceGroupProperties) { |
| 4368 | // NOTE: Each physical device should only appear in one group |
| 4369 | for (uint32_t i = 0; i < *pPhysicalDeviceGroupCount; i++) { |
| 4370 | for (uint32_t j = 0; j < pPhysicalDeviceGroupProperties[i].physicalDeviceCount; j++) { |
| 4371 | CreateObject(instance, pPhysicalDeviceGroupProperties[i].physicalDevices[j], |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4372 | kVulkanObjectTypePhysicalDevice, nullptr); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4373 | } |
| 4374 | } |
| 4375 | } |
| 4376 | } |
| 4377 | lock.unlock(); |
| 4378 | } |
| 4379 | return result; |
| 4380 | } |
| 4381 | |
| 4382 | // VK_KHX_external_memory_capabilities Extension |
| 4383 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalBufferPropertiesKHX( |
| 4384 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfoKHX *pExternalBufferInfo, |
| 4385 | VkExternalBufferPropertiesKHX *pExternalBufferProperties) { |
| 4386 | bool skip = false; |
| 4387 | { |
| 4388 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4389 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4390 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4391 | } |
| 4392 | if (!skip) { |
| 4393 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4394 | ->GetPhysicalDeviceExternalBufferPropertiesKHX(physicalDevice, pExternalBufferInfo, pExternalBufferProperties); |
| 4395 | } |
| 4396 | } |
| 4397 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4398 | // VK_KHX_external_memory_fd Extension |
| 4399 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdKHX(VkDevice device, VkDeviceMemory memory, |
| 4400 | VkExternalMemoryHandleTypeFlagBitsKHX handleType, int *pFd) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4401 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4402 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4403 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
| 4404 | skip |= ValidateObject(device, memory, kVulkanObjectTypeDeviceMemory, false, VALIDATION_ERROR_UNDEFINED, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4405 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4406 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4407 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4408 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4409 | } |
| 4410 | VkResult result = VK_SUCCESS; |
| 4411 | result = get_dispatch_table(ot_device_table_map, device)->GetMemoryFdKHX(device, memory, handleType, pFd); |
| 4412 | return result; |
| 4413 | } |
| 4414 | |
| 4415 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdPropertiesKHX(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHX handleType, int fd, |
| 4416 | VkMemoryFdPropertiesKHX *pMemoryFdProperties) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4417 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4418 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4419 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4420 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4421 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4422 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4423 | } |
| 4424 | VkResult result = VK_SUCCESS; |
| 4425 | result = get_dispatch_table(ot_device_table_map, device)->GetMemoryFdPropertiesKHX(device, handleType, fd, pMemoryFdProperties); |
| 4426 | return result; |
| 4427 | } |
| 4428 | |
| 4429 | // VK_KHX_external_memory_win32 Extension |
Jamie Madill | c9a7692 | 2017-03-21 13:46:11 -0400 | [diff] [blame] | 4430 | #ifdef VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4431 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleKHX(VkDevice device, VkDeviceMemory memory, |
| 4432 | VkExternalMemoryHandleTypeFlagBitsKHX handleType, HANDLE *pHandle) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4433 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4434 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4435 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
| 4436 | skip |= ValidateObject(device, memory, kVulkanObjectTypeDeviceMemory, false, VALIDATION_ERROR_UNDEFINED, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4437 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4438 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4439 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4440 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4441 | } |
| 4442 | VkResult result = VK_SUCCESS; |
| 4443 | result = get_dispatch_table(ot_device_table_map, device)->GetMemoryWin32HandleKHX(device, memory, handleType, pHandle); |
| 4444 | return result; |
| 4445 | } |
| 4446 | |
| 4447 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandlePropertiesKHX(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHX handleType, |
| 4448 | HANDLE handle, |
| 4449 | VkMemoryWin32HandlePropertiesKHX *pMemoryWin32HandleProperties) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4450 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4451 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4452 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4453 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4454 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4455 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4456 | } |
| 4457 | VkResult result = VK_SUCCESS; |
| 4458 | result = get_dispatch_table(ot_device_table_map, device) |
| 4459 | ->GetMemoryWin32HandlePropertiesKHX(device, handleType, handle, pMemoryWin32HandleProperties); |
| 4460 | return result; |
| 4461 | } |
Jamie Madill | c9a7692 | 2017-03-21 13:46:11 -0400 | [diff] [blame] | 4462 | #endif // VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4463 | |
| 4464 | // VK_KHX_external_semaphore_capabilities Extension |
| 4465 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalSemaphorePropertiesKHX( |
| 4466 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHX *pExternalSemaphoreInfo, |
| 4467 | VkExternalSemaphorePropertiesKHX *pExternalSemaphoreProperties) { |
| 4468 | bool skip = false; |
| 4469 | { |
| 4470 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4471 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4472 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4473 | } |
| 4474 | if (!skip) { |
| 4475 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4476 | ->GetPhysicalDeviceExternalSemaphorePropertiesKHX(physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties); |
| 4477 | } |
| 4478 | } |
| 4479 | |
| 4480 | // VK_KHX_external_semaphore_fd Extension |
| 4481 | VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreFdKHX(VkDevice device, const VkImportSemaphoreFdInfoKHX *pImportSemaphoreFdInfo) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4482 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4483 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4484 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4485 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4486 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4487 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4488 | } |
| 4489 | VkResult result = VK_SUCCESS; |
| 4490 | result = get_dispatch_table(ot_device_table_map, device)->ImportSemaphoreFdKHX(device, pImportSemaphoreFdInfo); |
| 4491 | return result; |
| 4492 | } |
| 4493 | |
| 4494 | VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreFdKHX(VkDevice device, VkSemaphore semaphore, |
| 4495 | VkExternalSemaphoreHandleTypeFlagBitsKHX handleType, int *pFd) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4496 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4497 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4498 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4499 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4500 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4501 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4502 | } |
| 4503 | VkResult result = VK_SUCCESS; |
| 4504 | result = get_dispatch_table(ot_device_table_map, device)->GetSemaphoreFdKHX(device, semaphore, handleType, pFd); |
| 4505 | return result; |
| 4506 | } |
| 4507 | |
| 4508 | // VK_KHX_external_semaphore_win32 Extension |
Jamie Madill | c9a7692 | 2017-03-21 13:46:11 -0400 | [diff] [blame] | 4509 | #ifdef VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4510 | VKAPI_ATTR VkResult VKAPI_CALL |
| 4511 | ImportSemaphoreWin32HandleKHX(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHX *pImportSemaphoreWin32HandleInfo) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4512 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4513 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4514 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4515 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4516 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4517 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4518 | } |
| 4519 | VkResult result = VK_SUCCESS; |
| 4520 | result = |
| 4521 | get_dispatch_table(ot_device_table_map, device)->ImportSemaphoreWin32HandleKHX(device, pImportSemaphoreWin32HandleInfo); |
| 4522 | return result; |
| 4523 | } |
| 4524 | |
| 4525 | VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreWin32HandleKHX(VkDevice device, VkSemaphore semaphore, |
| 4526 | VkExternalSemaphoreHandleTypeFlagBitsKHX handleType, HANDLE *pHandle) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4527 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4528 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4529 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4530 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4531 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4532 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4533 | } |
| 4534 | VkResult result = VK_SUCCESS; |
| 4535 | result = get_dispatch_table(ot_device_table_map, device)->GetSemaphoreWin32HandleKHX(device, semaphore, handleType, pHandle); |
| 4536 | return result; |
| 4537 | } |
Jamie Madill | c9a7692 | 2017-03-21 13:46:11 -0400 | [diff] [blame] | 4538 | #endif // VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4539 | |
| 4540 | // VK_EXT_acquire_xlib_display Extension |
| 4541 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT |
| 4542 | VKAPI_ATTR VkResult VKAPI_CALL AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, VkDisplayKHR display) { |
| 4543 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 4544 | bool skip = false; |
| 4545 | { |
| 4546 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4547 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4548 | VALIDATION_ERROR_UNDEFINED); |
| 4549 | skip |= ValidateObject(physicalDevice, display, kVulkanObjectTypeDisplayKHR, false, VALIDATION_ERROR_UNDEFINED, |
| 4550 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4551 | } |
| 4552 | if (skip) { |
| 4553 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4554 | } |
| 4555 | result = get_dispatch_table(ot_instance_table_map, physicalDevice)->AcquireXlibDisplayEXT(physicalDevice, dpy, display); |
| 4556 | |
| 4557 | return result; |
| 4558 | } |
| 4559 | |
| 4560 | VKAPI_ATTR VkResult VKAPI_CALL GetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, RROutput rrOutput, |
| 4561 | VkDisplayKHR *pDisplay) { |
| 4562 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 4563 | bool skip = false; |
| 4564 | { |
| 4565 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4566 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4567 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4568 | } |
| 4569 | if (skip) { |
| 4570 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4571 | } |
| 4572 | result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4573 | ->GetRandROutputDisplayEXT(physicalDevice, dpy, rrOutput, pDisplay); |
| 4574 | if (result == VK_SUCCESS && pDisplay != NULL) { |
| 4575 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4576 | CreateObject(physicalDevice, pDisplay, kVulkanObjectTypeDisplayKHR, nullptr); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4577 | } |
| 4578 | |
| 4579 | return result; |
| 4580 | } |
| 4581 | #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT |
| 4582 | |
| 4583 | // VK_EXT_debug_marker Extension |
| 4584 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT(VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4585 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4586 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4587 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_02007, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4588 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4589 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4590 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4591 | } |
| 4592 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4593 | VkResult result = dev_data->dispatch_table.DebugMarkerSetObjectTagEXT(device, pTagInfo); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4594 | return result; |
| 4595 | } |
| 4596 | |
| 4597 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT(VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4598 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4599 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4600 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_01999, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4601 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4602 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4603 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4604 | } |
| 4605 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4606 | VkResult result = dev_data->dispatch_table.DebugMarkerSetObjectNameEXT(device, pNameInfo); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4607 | return result; |
| 4608 | } |
| 4609 | |
| 4610 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4611 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4612 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4613 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_02014, |
| 4614 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4615 | lock.unlock(); |
| 4616 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4617 | if (!skip && dev_data->dispatch_table.CmdDebugMarkerBeginEXT) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4618 | dev_data->dispatch_table.CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo); |
| 4619 | } |
| 4620 | } |
| 4621 | |
| 4622 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerEndEXT(VkCommandBuffer commandBuffer) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4623 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4624 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4625 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_02022, |
| 4626 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4627 | lock.unlock(); |
| 4628 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4629 | if (!skip && dev_data->dispatch_table.CmdDebugMarkerEndEXT) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4630 | dev_data->dispatch_table.CmdDebugMarkerEndEXT(commandBuffer); |
| 4631 | } |
| 4632 | } |
| 4633 | |
| 4634 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4635 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4636 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4637 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_02025, |
| 4638 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4639 | lock.unlock(); |
| 4640 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4641 | if (!skip && dev_data->dispatch_table.CmdDebugMarkerInsertEXT) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4642 | dev_data->dispatch_table.CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo); |
| 4643 | } |
| 4644 | } |
| 4645 | |
| 4646 | // VK_EXT_direct_mode_display Extension |
| 4647 | VKAPI_ATTR VkResult VKAPI_CALL ReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display) { |
| 4648 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 4649 | bool skip = false; |
| 4650 | { |
| 4651 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4652 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4653 | VALIDATION_ERROR_UNDEFINED); |
| 4654 | skip |= ValidateObject(physicalDevice, display, kVulkanObjectTypeDisplayKHR, false, VALIDATION_ERROR_UNDEFINED, |
| 4655 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4656 | } |
| 4657 | if (skip) { |
| 4658 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4659 | } |
| 4660 | result = get_dispatch_table(ot_instance_table_map, physicalDevice)->ReleaseDisplayEXT(physicalDevice, display); |
| 4661 | |
| 4662 | return result; |
| 4663 | } |
| 4664 | |
| 4665 | // VK_EXT_discard_rectangles |
| 4666 | VKAPI_ATTR void VKAPI_CALL CmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, |
| 4667 | uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4668 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4669 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4670 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_UNDEFINED, |
| 4671 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4672 | lock.unlock(); |
| 4673 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4674 | if (!skip && dev_data->dispatch_table.CmdSetDiscardRectangleEXT) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4675 | dev_data->dispatch_table.CmdSetDiscardRectangleEXT(commandBuffer, firstDiscardRectangle, discardRectangleCount, |
| 4676 | pDiscardRectangles); |
| 4677 | } |
| 4678 | } |
| 4679 | |
| 4680 | // VK_EXT_display_control Extension |
| 4681 | VKAPI_ATTR VkResult VKAPI_CALL DisplayPowerControlEXT(VkDevice device, VkDisplayKHR display, |
| 4682 | const VkDisplayPowerInfoEXT *pDisplayPowerInfo) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4683 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4684 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4685 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4686 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4687 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4688 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4689 | } |
| 4690 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4691 | VkResult result = dev_data->dispatch_table.DisplayPowerControlEXT(device, display, pDisplayPowerInfo); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4692 | return result; |
| 4693 | } |
| 4694 | |
| 4695 | VKAPI_ATTR VkResult VKAPI_CALL RegisterDeviceEventEXT(VkDevice device, const VkDeviceEventInfoEXT *pDeviceEventInfo, |
| 4696 | const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4697 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4698 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4699 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4700 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4701 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4702 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4703 | } |
| 4704 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4705 | VkResult result = dev_data->dispatch_table.RegisterDeviceEventEXT(device, pDeviceEventInfo, pAllocator, pFence); |
| 4706 | if (result == VK_SUCCESS && pFence != NULL) { |
| 4707 | std::lock_guard<std::mutex> create_lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4708 | CreateObject(device, *pFence, kVulkanObjectTypeFence, pAllocator); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4709 | } |
| 4710 | return result; |
| 4711 | } |
| 4712 | |
| 4713 | VKAPI_ATTR VkResult VKAPI_CALL RegisterDisplayEventEXT(VkDevice device, VkDisplayKHR display, |
| 4714 | const VkDisplayEventInfoEXT *pDisplayEventInfo, |
| 4715 | const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4716 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4717 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4718 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4719 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4720 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4721 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4722 | } |
| 4723 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4724 | VkResult result = dev_data->dispatch_table.RegisterDisplayEventEXT(device, display, pDisplayEventInfo, pAllocator, pFence); |
| 4725 | if (result == VK_SUCCESS && pFence != NULL) { |
| 4726 | std::lock_guard<std::mutex> create_lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4727 | CreateObject(device, *pFence, kVulkanObjectTypeFence, pAllocator); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4728 | } |
| 4729 | return result; |
| 4730 | } |
| 4731 | |
| 4732 | VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainCounterEXT(VkDevice device, VkSwapchainKHR swapchain, |
| 4733 | VkSurfaceCounterFlagBitsEXT counter, uint64_t *pCounterValue) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4734 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4735 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4736 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
| 4737 | skip |= ValidateObject(device, swapchain, kVulkanObjectTypeSwapchainKHR, false, VALIDATION_ERROR_UNDEFINED, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4738 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4739 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4740 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4741 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4742 | } |
| 4743 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4744 | VkResult result = dev_data->dispatch_table.GetSwapchainCounterEXT(device, swapchain, counter, pCounterValue); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4745 | return result; |
| 4746 | } |
| 4747 | |
| 4748 | // VK_EXT_display_surface_counter Extension |
| 4749 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 4750 | VkSurfaceCapabilities2EXT *pSurfaceCapabilities) { |
| 4751 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4752 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4753 | { |
| 4754 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4755 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4756 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4757 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4758 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4759 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4760 | } |
| 4761 | result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4762 | ->GetPhysicalDeviceSurfaceCapabilities2EXT(physicalDevice, surface, pSurfaceCapabilities); |
| 4763 | |
| 4764 | return result; |
| 4765 | } |
| 4766 | |
| 4767 | // VK_AMD_draw_indirect_count Extension |
| 4768 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 4769 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, |
| 4770 | uint32_t stride) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4771 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4772 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4773 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01771, |
| 4774 | VALIDATION_ERROR_UNDEFINED); |
| 4775 | skip |= ValidateObject(commandBuffer, buffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01772, VALIDATION_ERROR_01777); |
| 4776 | skip |= |
| 4777 | ValidateObject(commandBuffer, countBuffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01773, VALIDATION_ERROR_01777); |
| 4778 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01774, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4779 | VALIDATION_ERROR_01777); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4780 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4781 | if (!skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4782 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 4783 | ->CmdDrawIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 4784 | } |
| 4785 | } |
| 4786 | |
| 4787 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 4788 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, |
| 4789 | uint32_t maxDrawCount, uint32_t stride) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4790 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4791 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4792 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_01783, |
| 4793 | VALIDATION_ERROR_UNDEFINED); |
| 4794 | skip |= ValidateObject(commandBuffer, buffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01784, VALIDATION_ERROR_01789); |
| 4795 | skip |= |
| 4796 | ValidateObject(commandBuffer, countBuffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01785, VALIDATION_ERROR_01789); |
| 4797 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeBuffer, false, VALIDATION_ERROR_01786, |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4798 | VALIDATION_ERROR_01789); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4799 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4800 | if (!skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4801 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 4802 | ->CmdDrawIndexedIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 4803 | } |
| 4804 | } |
| 4805 | |
| 4806 | // VK_NV_clip_space_w_scaling Extension |
| 4807 | VKAPI_ATTR void VKAPI_CALL CmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
| 4808 | const VkViewportWScalingNV *pViewportWScalings) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4809 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4810 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4811 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_UNDEFINED, |
| 4812 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4813 | lock.unlock(); |
| 4814 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4815 | if (!skip && dev_data->dispatch_table.CmdSetViewportWScalingNV) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4816 | dev_data->dispatch_table.CmdSetViewportWScalingNV(commandBuffer, firstViewport, viewportCount, pViewportWScalings); |
| 4817 | } |
| 4818 | } |
| 4819 | |
| 4820 | // VK_NV_external_memory_capabilities Extension |
| 4821 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceExternalImageFormatPropertiesNV( |
| 4822 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, |
| 4823 | VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, |
| 4824 | VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4825 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4826 | { |
| 4827 | std::lock_guard<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4828 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_01980, |
| 4829 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4830 | } |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4831 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4832 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4833 | } |
| 4834 | VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4835 | ->GetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice, format, type, tiling, usage, flags, |
| 4836 | externalHandleType, pExternalImageFormatProperties); |
| 4837 | return result; |
| 4838 | } |
| 4839 | |
| 4840 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 4841 | // VK_NV_external_memory_win32 Extension |
| 4842 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleNV(VkDevice device, VkDeviceMemory memory, |
| 4843 | VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE *pHandle) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4844 | bool skip = VK_FALSE; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4845 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4846 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_01725, VALIDATION_ERROR_UNDEFINED); |
| 4847 | skip |= ValidateObject(device, memory, kVulkanObjectTypeDeviceMemory, false, VALIDATION_ERROR_01726, VALIDATION_ERROR_01730); |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4848 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4849 | if (skip) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 4850 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4851 | } |
| 4852 | VkResult result = get_dispatch_table(ot_device_table_map, device)->GetMemoryWin32HandleNV(device, memory, handleType, pHandle); |
| 4853 | return result; |
| 4854 | } |
| 4855 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4856 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4857 | // VK_NVX_device_generated_commands Extension |
| 4858 | VKAPI_ATTR void VKAPI_CALL CmdProcessCommandsNVX(VkCommandBuffer commandBuffer, |
| 4859 | const VkCmdProcessCommandsInfoNVX *pProcessCommandsInfo) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4860 | bool skip = VK_FALSE; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4861 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4862 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_UNDEFINED, |
| 4863 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4864 | lock.unlock(); |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4865 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4866 | if (!skip && dev_data->dispatch_table.CmdProcessCommandsNVX) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4867 | dev_data->dispatch_table.CmdProcessCommandsNVX(commandBuffer, pProcessCommandsInfo); |
| 4868 | } |
| 4869 | } |
| 4870 | |
| 4871 | VKAPI_ATTR void VKAPI_CALL CmdReserveSpaceForCommandsNVX(VkCommandBuffer commandBuffer, |
| 4872 | const VkCmdReserveSpaceForCommandsInfoNVX *pReserveSpaceInfo) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4873 | bool skip = VK_FALSE; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4874 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4875 | skip |= ValidateObject(commandBuffer, commandBuffer, kVulkanObjectTypeCommandBuffer, false, VALIDATION_ERROR_UNDEFINED, |
| 4876 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4877 | lock.unlock(); |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4878 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4879 | if (!skip && dev_data->dispatch_table.CmdReserveSpaceForCommandsNVX) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4880 | dev_data->dispatch_table.CmdReserveSpaceForCommandsNVX(commandBuffer, pReserveSpaceInfo); |
| 4881 | } |
| 4882 | } |
| 4883 | |
| 4884 | VKAPI_ATTR VkResult VKAPI_CALL CreateIndirectCommandsLayoutNVX(VkDevice device, |
| 4885 | const VkIndirectCommandsLayoutCreateInfoNVX *pCreateInfo, |
| 4886 | const VkAllocationCallbacks *pAllocator, |
| 4887 | VkIndirectCommandsLayoutNVX *pIndirectCommandsLayout) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4888 | bool skip = VK_FALSE; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4889 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4890 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4891 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4892 | if (skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4893 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4894 | } |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4895 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4896 | VkResult result = |
| 4897 | dev_data->dispatch_table.CreateIndirectCommandsLayoutNVX(device, pCreateInfo, pAllocator, pIndirectCommandsLayout); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4898 | return result; |
| 4899 | } |
| 4900 | |
| 4901 | VKAPI_ATTR void VKAPI_CALL DestroyIndirectCommandsLayoutNVX(VkDevice device, VkIndirectCommandsLayoutNVX indirectCommandsLayout, |
| 4902 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4903 | bool skip = VK_FALSE; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4904 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4905 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4906 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4907 | if (!skip) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4908 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4909 | dev_data->dispatch_table.DestroyIndirectCommandsLayoutNVX(device, indirectCommandsLayout, pAllocator); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4910 | } |
| 4911 | } |
| 4912 | |
| 4913 | VKAPI_ATTR VkResult VKAPI_CALL CreateObjectTableNVX(VkDevice device, const VkObjectTableCreateInfoNVX *pCreateInfo, |
| 4914 | const VkAllocationCallbacks *pAllocator, VkObjectTableNVX *pObjectTable) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4915 | bool skip = VK_FALSE; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4916 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4917 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4918 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4919 | if (skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4920 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4921 | } |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4922 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4923 | VkResult result = dev_data->dispatch_table.CreateObjectTableNVX(device, pCreateInfo, pAllocator, pObjectTable); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4924 | return result; |
| 4925 | } |
| 4926 | |
| 4927 | VKAPI_ATTR void VKAPI_CALL DestroyObjectTableNVX(VkDevice device, VkObjectTableNVX objectTable, |
| 4928 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4929 | bool skip = VK_FALSE; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4930 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4931 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4932 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4933 | if (!skip) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4934 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4935 | dev_data->dispatch_table.DestroyObjectTableNVX(device, objectTable, pAllocator); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4936 | } |
| 4937 | } |
| 4938 | |
| 4939 | VKAPI_ATTR VkResult VKAPI_CALL RegisterObjectsNVX(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, |
| 4940 | const VkObjectTableEntryNVX *const *ppObjectTableEntries, |
| 4941 | const uint32_t *pObjectIndices) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4942 | bool skip = VK_FALSE; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4943 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4944 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4945 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4946 | if (skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4947 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4948 | } |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4949 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4950 | VkResult result = |
| 4951 | dev_data->dispatch_table.RegisterObjectsNVX(device, objectTable, objectCount, ppObjectTableEntries, pObjectIndices); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4952 | return result; |
| 4953 | } |
| 4954 | |
| 4955 | VKAPI_ATTR VkResult VKAPI_CALL UnregisterObjectsNVX(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, |
| 4956 | const VkObjectEntryTypeNVX *pObjectEntryTypes, const uint32_t *pObjectIndices) { |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4957 | bool skip = VK_FALSE; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4958 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4959 | skip |= ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4960 | lock.unlock(); |
Mark Lobodzinski | 14ecf02 | 2017-04-03 11:36:40 -0600 | [diff] [blame] | 4961 | if (skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4962 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 4963 | } |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4964 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 2d84f5a | 2017-04-03 11:34:36 -0600 | [diff] [blame] | 4965 | VkResult result = |
| 4966 | dev_data->dispatch_table.UnregisterObjectsNVX(device, objectTable, objectCount, pObjectEntryTypes, pObjectIndices); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4967 | return result; |
| 4968 | } |
| 4969 | |
| 4970 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceGeneratedCommandsPropertiesNVX(VkPhysicalDevice physicalDevice, |
| 4971 | VkDeviceGeneratedCommandsFeaturesNVX *pFeatures, |
| 4972 | VkDeviceGeneratedCommandsLimitsNVX *pLimits) { |
| 4973 | bool skip = false; |
| 4974 | { |
| 4975 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4976 | skip |= ValidateObject(physicalDevice, physicalDevice, kVulkanObjectTypePhysicalDevice, false, VALIDATION_ERROR_UNDEFINED, |
| 4977 | VALIDATION_ERROR_UNDEFINED); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 4978 | } |
| 4979 | if (skip) { |
| 4980 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 4981 | ->GetPhysicalDeviceGeneratedCommandsPropertiesNVX(physicalDevice, pFeatures, pLimits); |
| 4982 | } |
| 4983 | } |
| 4984 | |
Mark Lobodzinski | 1d218cc | 2017-03-14 10:12:43 -0600 | [diff] [blame] | 4985 | VKAPI_ATTR VkResult VKAPI_CALL GetPastPresentationTimingGOOGLE(VkDevice device, VkSwapchainKHR swapchain, |
| 4986 | uint32_t *pPresentationTimingCount, |
| 4987 | VkPastPresentationTimingGOOGLE *pPresentationTimings) { |
| 4988 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 4989 | bool skip = false; |
| 4990 | { |
| 4991 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 4992 | skip |= |
| 4993 | ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
| 4994 | skip |= ValidateObject(device, swapchain, kVulkanObjectTypeSwapchainKHR, false, VALIDATION_ERROR_UNDEFINED, |
Mark Lobodzinski | 1d218cc | 2017-03-14 10:12:43 -0600 | [diff] [blame] | 4995 | VALIDATION_ERROR_UNDEFINED); |
| 4996 | } |
| 4997 | |
| 4998 | if (!skip) { |
| 4999 | result = get_dispatch_table(ot_device_table_map, device) |
| 5000 | ->GetPastPresentationTimingGOOGLE(device, swapchain, pPresentationTimingCount, pPresentationTimings); |
| 5001 | } |
| 5002 | return result; |
| 5003 | } |
| 5004 | |
| 5005 | VKAPI_ATTR VkResult VKAPI_CALL GetRefreshCycleDurationGOOGLE(VkDevice device, VkSwapchainKHR swapchain, |
| 5006 | VkRefreshCycleDurationGOOGLE *pDisplayTimingProperties) { |
| 5007 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5008 | bool skip = false; |
| 5009 | { |
| 5010 | std::unique_lock<std::mutex> lock(global_lock); |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 5011 | skip |= |
| 5012 | ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
| 5013 | skip |= ValidateObject(device, swapchain, kVulkanObjectTypeSwapchainKHR, false, VALIDATION_ERROR_UNDEFINED, |
Mark Lobodzinski | 1d218cc | 2017-03-14 10:12:43 -0600 | [diff] [blame] | 5014 | VALIDATION_ERROR_UNDEFINED); |
| 5015 | } |
| 5016 | |
| 5017 | if (!skip) { |
| 5018 | result = get_dispatch_table(ot_device_table_map, device) |
| 5019 | ->GetRefreshCycleDurationGOOGLE(device, swapchain, pDisplayTimingProperties); |
| 5020 | } |
| 5021 | return result; |
| 5022 | } |
| 5023 | |
| 5024 | VKAPI_ATTR void VKAPI_CALL SetHdrMetadataEXT(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR *pSwapchains, |
| 5025 | const VkHdrMetadataEXT *pMetadata) { |
| 5026 | bool skip = false; |
| 5027 | { |
| 5028 | std::lock_guard<std::mutex> lock(global_lock); |
| 5029 | if (pSwapchains) { |
| 5030 | for (uint32_t idx0 = 0; idx0 < swapchainCount; ++idx0) { |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 5031 | skip |= ValidateObject(device, pSwapchains[idx0], kVulkanObjectTypeSwapchainKHR, false, VALIDATION_ERROR_UNDEFINED, |
| 5032 | VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 1d218cc | 2017-03-14 10:12:43 -0600 | [diff] [blame] | 5033 | } |
| 5034 | } |
Mark Lobodzinski | 558d7cb | 2017-04-11 15:37:17 -0600 | [diff] [blame] | 5035 | skip |= |
| 5036 | ValidateObject(device, device, kVulkanObjectTypeDevice, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); |
Mark Lobodzinski | 1d218cc | 2017-03-14 10:12:43 -0600 | [diff] [blame] | 5037 | } |
| 5038 | if (!skip) { |
| 5039 | get_dispatch_table(ot_device_table_map, device)->SetHdrMetadataEXT(device, swapchainCount, pSwapchains, pMetadata); |
| 5040 | } |
| 5041 | } |
| 5042 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5043 | static inline PFN_vkVoidFunction InterceptCoreDeviceCommand(const char *name) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5044 | if (!name || name[0] != 'v' || name[1] != 'k') return NULL; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5045 | |
| 5046 | name += 2; |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5047 | if (!strcmp(name, "GetDeviceProcAddr")) return (PFN_vkVoidFunction)GetDeviceProcAddr; |
| 5048 | if (!strcmp(name, "DestroyDevice")) return (PFN_vkVoidFunction)DestroyDevice; |
| 5049 | if (!strcmp(name, "GetDeviceQueue")) return (PFN_vkVoidFunction)GetDeviceQueue; |
| 5050 | if (!strcmp(name, "QueueSubmit")) return (PFN_vkVoidFunction)QueueSubmit; |
| 5051 | if (!strcmp(name, "QueueWaitIdle")) return (PFN_vkVoidFunction)QueueWaitIdle; |
| 5052 | if (!strcmp(name, "DeviceWaitIdle")) return (PFN_vkVoidFunction)DeviceWaitIdle; |
| 5053 | if (!strcmp(name, "AllocateMemory")) return (PFN_vkVoidFunction)AllocateMemory; |
| 5054 | if (!strcmp(name, "FreeMemory")) return (PFN_vkVoidFunction)FreeMemory; |
| 5055 | if (!strcmp(name, "MapMemory")) return (PFN_vkVoidFunction)MapMemory; |
| 5056 | if (!strcmp(name, "UnmapMemory")) return (PFN_vkVoidFunction)UnmapMemory; |
| 5057 | if (!strcmp(name, "FlushMappedMemoryRanges")) return (PFN_vkVoidFunction)FlushMappedMemoryRanges; |
| 5058 | if (!strcmp(name, "InvalidateMappedMemoryRanges")) return (PFN_vkVoidFunction)InvalidateMappedMemoryRanges; |
| 5059 | if (!strcmp(name, "GetDeviceMemoryCommitment")) return (PFN_vkVoidFunction)GetDeviceMemoryCommitment; |
| 5060 | if (!strcmp(name, "BindBufferMemory")) return (PFN_vkVoidFunction)BindBufferMemory; |
| 5061 | if (!strcmp(name, "BindImageMemory")) return (PFN_vkVoidFunction)BindImageMemory; |
| 5062 | if (!strcmp(name, "GetBufferMemoryRequirements")) return (PFN_vkVoidFunction)GetBufferMemoryRequirements; |
| 5063 | if (!strcmp(name, "GetImageMemoryRequirements")) return (PFN_vkVoidFunction)GetImageMemoryRequirements; |
| 5064 | if (!strcmp(name, "GetImageSparseMemoryRequirements")) return (PFN_vkVoidFunction)GetImageSparseMemoryRequirements; |
| 5065 | if (!strcmp(name, "QueueBindSparse")) return (PFN_vkVoidFunction)QueueBindSparse; |
| 5066 | if (!strcmp(name, "CreateFence")) return (PFN_vkVoidFunction)CreateFence; |
| 5067 | if (!strcmp(name, "DestroyFence")) return (PFN_vkVoidFunction)DestroyFence; |
| 5068 | if (!strcmp(name, "ResetFences")) return (PFN_vkVoidFunction)ResetFences; |
| 5069 | if (!strcmp(name, "GetFenceStatus")) return (PFN_vkVoidFunction)GetFenceStatus; |
| 5070 | if (!strcmp(name, "WaitForFences")) return (PFN_vkVoidFunction)WaitForFences; |
| 5071 | if (!strcmp(name, "CreateSemaphore")) return (PFN_vkVoidFunction)CreateSemaphore; |
| 5072 | if (!strcmp(name, "DestroySemaphore")) return (PFN_vkVoidFunction)DestroySemaphore; |
| 5073 | if (!strcmp(name, "CreateEvent")) return (PFN_vkVoidFunction)CreateEvent; |
| 5074 | if (!strcmp(name, "DestroyEvent")) return (PFN_vkVoidFunction)DestroyEvent; |
| 5075 | if (!strcmp(name, "GetEventStatus")) return (PFN_vkVoidFunction)GetEventStatus; |
| 5076 | if (!strcmp(name, "SetEvent")) return (PFN_vkVoidFunction)SetEvent; |
| 5077 | if (!strcmp(name, "ResetEvent")) return (PFN_vkVoidFunction)ResetEvent; |
| 5078 | if (!strcmp(name, "CreateQueryPool")) return (PFN_vkVoidFunction)CreateQueryPool; |
| 5079 | if (!strcmp(name, "DestroyQueryPool")) return (PFN_vkVoidFunction)DestroyQueryPool; |
| 5080 | if (!strcmp(name, "GetQueryPoolResults")) return (PFN_vkVoidFunction)GetQueryPoolResults; |
| 5081 | if (!strcmp(name, "CreateBuffer")) return (PFN_vkVoidFunction)CreateBuffer; |
| 5082 | if (!strcmp(name, "DestroyBuffer")) return (PFN_vkVoidFunction)DestroyBuffer; |
| 5083 | if (!strcmp(name, "CreateBufferView")) return (PFN_vkVoidFunction)CreateBufferView; |
| 5084 | if (!strcmp(name, "DestroyBufferView")) return (PFN_vkVoidFunction)DestroyBufferView; |
| 5085 | if (!strcmp(name, "CreateImage")) return (PFN_vkVoidFunction)CreateImage; |
| 5086 | if (!strcmp(name, "DestroyImage")) return (PFN_vkVoidFunction)DestroyImage; |
| 5087 | if (!strcmp(name, "GetImageSubresourceLayout")) return (PFN_vkVoidFunction)GetImageSubresourceLayout; |
| 5088 | if (!strcmp(name, "CreateImageView")) return (PFN_vkVoidFunction)CreateImageView; |
| 5089 | if (!strcmp(name, "DestroyImageView")) return (PFN_vkVoidFunction)DestroyImageView; |
| 5090 | if (!strcmp(name, "CreateShaderModule")) return (PFN_vkVoidFunction)CreateShaderModule; |
| 5091 | if (!strcmp(name, "DestroyShaderModule")) return (PFN_vkVoidFunction)DestroyShaderModule; |
| 5092 | if (!strcmp(name, "CreatePipelineCache")) return (PFN_vkVoidFunction)CreatePipelineCache; |
| 5093 | if (!strcmp(name, "DestroyPipelineCache")) return (PFN_vkVoidFunction)DestroyPipelineCache; |
| 5094 | if (!strcmp(name, "GetPipelineCacheData")) return (PFN_vkVoidFunction)GetPipelineCacheData; |
| 5095 | if (!strcmp(name, "MergePipelineCaches")) return (PFN_vkVoidFunction)MergePipelineCaches; |
| 5096 | if (!strcmp(name, "CreateGraphicsPipelines")) return (PFN_vkVoidFunction)CreateGraphicsPipelines; |
| 5097 | if (!strcmp(name, "CreateComputePipelines")) return (PFN_vkVoidFunction)CreateComputePipelines; |
| 5098 | if (!strcmp(name, "DestroyPipeline")) return (PFN_vkVoidFunction)DestroyPipeline; |
| 5099 | if (!strcmp(name, "CreatePipelineLayout")) return (PFN_vkVoidFunction)CreatePipelineLayout; |
| 5100 | if (!strcmp(name, "DestroyPipelineLayout")) return (PFN_vkVoidFunction)DestroyPipelineLayout; |
| 5101 | if (!strcmp(name, "CreateSampler")) return (PFN_vkVoidFunction)CreateSampler; |
| 5102 | if (!strcmp(name, "DestroySampler")) return (PFN_vkVoidFunction)DestroySampler; |
| 5103 | if (!strcmp(name, "CreateDescriptorSetLayout")) return (PFN_vkVoidFunction)CreateDescriptorSetLayout; |
| 5104 | if (!strcmp(name, "DestroyDescriptorSetLayout")) return (PFN_vkVoidFunction)DestroyDescriptorSetLayout; |
| 5105 | if (!strcmp(name, "CreateDescriptorPool")) return (PFN_vkVoidFunction)CreateDescriptorPool; |
| 5106 | if (!strcmp(name, "DestroyDescriptorPool")) return (PFN_vkVoidFunction)DestroyDescriptorPool; |
| 5107 | if (!strcmp(name, "ResetDescriptorPool")) return (PFN_vkVoidFunction)ResetDescriptorPool; |
| 5108 | if (!strcmp(name, "AllocateDescriptorSets")) return (PFN_vkVoidFunction)AllocateDescriptorSets; |
| 5109 | if (!strcmp(name, "FreeDescriptorSets")) return (PFN_vkVoidFunction)FreeDescriptorSets; |
| 5110 | if (!strcmp(name, "UpdateDescriptorSets")) return (PFN_vkVoidFunction)UpdateDescriptorSets; |
| 5111 | if (!strcmp(name, "CreateFramebuffer")) return (PFN_vkVoidFunction)CreateFramebuffer; |
| 5112 | if (!strcmp(name, "DestroyFramebuffer")) return (PFN_vkVoidFunction)DestroyFramebuffer; |
| 5113 | if (!strcmp(name, "CreateRenderPass")) return (PFN_vkVoidFunction)CreateRenderPass; |
| 5114 | if (!strcmp(name, "DestroyRenderPass")) return (PFN_vkVoidFunction)DestroyRenderPass; |
| 5115 | if (!strcmp(name, "GetRenderAreaGranularity")) return (PFN_vkVoidFunction)GetRenderAreaGranularity; |
| 5116 | if (!strcmp(name, "CreateCommandPool")) return (PFN_vkVoidFunction)CreateCommandPool; |
| 5117 | if (!strcmp(name, "DestroyCommandPool")) return (PFN_vkVoidFunction)DestroyCommandPool; |
| 5118 | if (!strcmp(name, "ResetCommandPool")) return (PFN_vkVoidFunction)ResetCommandPool; |
| 5119 | if (!strcmp(name, "AllocateCommandBuffers")) return (PFN_vkVoidFunction)AllocateCommandBuffers; |
| 5120 | if (!strcmp(name, "FreeCommandBuffers")) return (PFN_vkVoidFunction)FreeCommandBuffers; |
| 5121 | if (!strcmp(name, "BeginCommandBuffer")) return (PFN_vkVoidFunction)BeginCommandBuffer; |
| 5122 | if (!strcmp(name, "EndCommandBuffer")) return (PFN_vkVoidFunction)EndCommandBuffer; |
| 5123 | if (!strcmp(name, "ResetCommandBuffer")) return (PFN_vkVoidFunction)ResetCommandBuffer; |
| 5124 | if (!strcmp(name, "CmdBindPipeline")) return (PFN_vkVoidFunction)CmdBindPipeline; |
| 5125 | if (!strcmp(name, "CmdSetViewport")) return (PFN_vkVoidFunction)CmdSetViewport; |
| 5126 | if (!strcmp(name, "CmdSetScissor")) return (PFN_vkVoidFunction)CmdSetScissor; |
| 5127 | if (!strcmp(name, "CmdSetLineWidth")) return (PFN_vkVoidFunction)CmdSetLineWidth; |
| 5128 | if (!strcmp(name, "CmdSetDepthBias")) return (PFN_vkVoidFunction)CmdSetDepthBias; |
| 5129 | if (!strcmp(name, "CmdSetBlendConstants")) return (PFN_vkVoidFunction)CmdSetBlendConstants; |
| 5130 | if (!strcmp(name, "CmdSetDepthBounds")) return (PFN_vkVoidFunction)CmdSetDepthBounds; |
| 5131 | if (!strcmp(name, "CmdSetStencilCompareMask")) return (PFN_vkVoidFunction)CmdSetStencilCompareMask; |
| 5132 | if (!strcmp(name, "CmdSetStencilWriteMask")) return (PFN_vkVoidFunction)CmdSetStencilWriteMask; |
| 5133 | if (!strcmp(name, "CmdSetStencilReference")) return (PFN_vkVoidFunction)CmdSetStencilReference; |
| 5134 | if (!strcmp(name, "CmdBindDescriptorSets")) return (PFN_vkVoidFunction)CmdBindDescriptorSets; |
| 5135 | if (!strcmp(name, "CmdBindIndexBuffer")) return (PFN_vkVoidFunction)CmdBindIndexBuffer; |
| 5136 | if (!strcmp(name, "CmdBindVertexBuffers")) return (PFN_vkVoidFunction)CmdBindVertexBuffers; |
| 5137 | if (!strcmp(name, "CmdDraw")) return (PFN_vkVoidFunction)CmdDraw; |
| 5138 | if (!strcmp(name, "CmdDrawIndexed")) return (PFN_vkVoidFunction)CmdDrawIndexed; |
| 5139 | if (!strcmp(name, "CmdDrawIndirect")) return (PFN_vkVoidFunction)CmdDrawIndirect; |
| 5140 | if (!strcmp(name, "CmdDrawIndexedIndirect")) return (PFN_vkVoidFunction)CmdDrawIndexedIndirect; |
| 5141 | if (!strcmp(name, "CmdDispatch")) return (PFN_vkVoidFunction)CmdDispatch; |
| 5142 | if (!strcmp(name, "CmdDispatchIndirect")) return (PFN_vkVoidFunction)CmdDispatchIndirect; |
| 5143 | if (!strcmp(name, "CmdCopyBuffer")) return (PFN_vkVoidFunction)CmdCopyBuffer; |
| 5144 | if (!strcmp(name, "CmdCopyImage")) return (PFN_vkVoidFunction)CmdCopyImage; |
| 5145 | if (!strcmp(name, "CmdBlitImage")) return (PFN_vkVoidFunction)CmdBlitImage; |
| 5146 | if (!strcmp(name, "CmdCopyBufferToImage")) return (PFN_vkVoidFunction)CmdCopyBufferToImage; |
| 5147 | if (!strcmp(name, "CmdCopyImageToBuffer")) return (PFN_vkVoidFunction)CmdCopyImageToBuffer; |
| 5148 | if (!strcmp(name, "CmdUpdateBuffer")) return (PFN_vkVoidFunction)CmdUpdateBuffer; |
| 5149 | if (!strcmp(name, "CmdFillBuffer")) return (PFN_vkVoidFunction)CmdFillBuffer; |
| 5150 | if (!strcmp(name, "CmdClearColorImage")) return (PFN_vkVoidFunction)CmdClearColorImage; |
| 5151 | if (!strcmp(name, "CmdClearDepthStencilImage")) return (PFN_vkVoidFunction)CmdClearDepthStencilImage; |
| 5152 | if (!strcmp(name, "CmdClearAttachments")) return (PFN_vkVoidFunction)CmdClearAttachments; |
| 5153 | if (!strcmp(name, "CmdResolveImage")) return (PFN_vkVoidFunction)CmdResolveImage; |
| 5154 | if (!strcmp(name, "CmdSetEvent")) return (PFN_vkVoidFunction)CmdSetEvent; |
| 5155 | if (!strcmp(name, "CmdResetEvent")) return (PFN_vkVoidFunction)CmdResetEvent; |
| 5156 | if (!strcmp(name, "CmdWaitEvents")) return (PFN_vkVoidFunction)CmdWaitEvents; |
| 5157 | if (!strcmp(name, "CmdPipelineBarrier")) return (PFN_vkVoidFunction)CmdPipelineBarrier; |
| 5158 | if (!strcmp(name, "CmdBeginQuery")) return (PFN_vkVoidFunction)CmdBeginQuery; |
| 5159 | if (!strcmp(name, "CmdEndQuery")) return (PFN_vkVoidFunction)CmdEndQuery; |
| 5160 | if (!strcmp(name, "CmdResetQueryPool")) return (PFN_vkVoidFunction)CmdResetQueryPool; |
| 5161 | if (!strcmp(name, "CmdWriteTimestamp")) return (PFN_vkVoidFunction)CmdWriteTimestamp; |
| 5162 | if (!strcmp(name, "CmdCopyQueryPoolResults")) return (PFN_vkVoidFunction)CmdCopyQueryPoolResults; |
| 5163 | if (!strcmp(name, "CmdPushConstants")) return (PFN_vkVoidFunction)CmdPushConstants; |
| 5164 | if (!strcmp(name, "CmdBeginRenderPass")) return (PFN_vkVoidFunction)CmdBeginRenderPass; |
| 5165 | if (!strcmp(name, "CmdNextSubpass")) return (PFN_vkVoidFunction)CmdNextSubpass; |
| 5166 | if (!strcmp(name, "CmdEndRenderPass")) return (PFN_vkVoidFunction)CmdEndRenderPass; |
| 5167 | if (!strcmp(name, "CmdExecuteCommands")) return (PFN_vkVoidFunction)CmdExecuteCommands; |
| 5168 | if (!strcmp(name, "DebugMarkerSetObjectTagEXT")) return (PFN_vkVoidFunction)DebugMarkerSetObjectTagEXT; |
| 5169 | if (!strcmp(name, "DebugMarkerSetObjectNameEXT")) return (PFN_vkVoidFunction)DebugMarkerSetObjectNameEXT; |
| 5170 | if (!strcmp(name, "CmdDebugMarkerBeginEXT")) return (PFN_vkVoidFunction)CmdDebugMarkerBeginEXT; |
| 5171 | if (!strcmp(name, "CmdDebugMarkerEndEXT")) return (PFN_vkVoidFunction)CmdDebugMarkerEndEXT; |
| 5172 | if (!strcmp(name, "CmdDebugMarkerInsertEXT")) return (PFN_vkVoidFunction)CmdDebugMarkerInsertEXT; |
Mark Lobodzinski | 8cc72bd | 2016-09-28 12:53:27 -0600 | [diff] [blame] | 5173 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5174 | if (!strcmp(name, "GetMemoryWin32HandleNV")) return (PFN_vkVoidFunction)GetMemoryWin32HandleNV; |
| 5175 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 5176 | if (!strcmp(name, "CmdDrawIndirectCountAMD")) return (PFN_vkVoidFunction)CmdDrawIndirectCountAMD; |
| 5177 | if (!strcmp(name, "CmdDrawIndexedIndirectCountAMD")) return (PFN_vkVoidFunction)CmdDrawIndexedIndirectCountAMD; |
Mark Lobodzinski | 1d218cc | 2017-03-14 10:12:43 -0600 | [diff] [blame] | 5178 | if (!strcmp(name, "GetPastPresentationTimingGOOGLE")) return (PFN_vkVoidFunction)GetPastPresentationTimingGOOGLE; |
| 5179 | if (!strcmp(name, "GetRefreshCycleDurationGOOGLE")) return (PFN_vkVoidFunction)GetRefreshCycleDurationGOOGLE; |
| 5180 | if (!strcmp(name, "SetHdrMetadataEXT")) return (PFN_vkVoidFunction)SetHdrMetadataEXT; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5181 | |
| 5182 | return NULL; |
| 5183 | } |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5184 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5185 | static inline PFN_vkVoidFunction InterceptCoreInstanceCommand(const char *name) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5186 | if (!name || name[0] != 'v' || name[1] != 'k') return NULL; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5187 | |
| 5188 | name += 2; |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5189 | if (!strcmp(name, "CreateInstance")) return (PFN_vkVoidFunction)CreateInstance; |
| 5190 | if (!strcmp(name, "DestroyInstance")) return (PFN_vkVoidFunction)DestroyInstance; |
| 5191 | if (!strcmp(name, "EnumeratePhysicalDevices")) return (PFN_vkVoidFunction)EnumeratePhysicalDevices; |
| 5192 | if (!strcmp(name, "_layerGetPhysicalDeviceProcAddr")) return (PFN_vkVoidFunction)GetPhysicalDeviceProcAddr; |
| 5193 | if (!strcmp(name, "GetPhysicalDeviceFeatures")) return (PFN_vkVoidFunction)GetPhysicalDeviceFeatures; |
| 5194 | if (!strcmp(name, "GetPhysicalDeviceFormatProperties")) return (PFN_vkVoidFunction)GetPhysicalDeviceFormatProperties; |
| 5195 | if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties")) return (PFN_vkVoidFunction)GetPhysicalDeviceImageFormatProperties; |
| 5196 | if (!strcmp(name, "GetPhysicalDeviceProperties")) return (PFN_vkVoidFunction)GetPhysicalDeviceProperties; |
| 5197 | if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties")) return (PFN_vkVoidFunction)GetPhysicalDeviceQueueFamilyProperties; |
| 5198 | if (!strcmp(name, "GetPhysicalDeviceMemoryProperties")) return (PFN_vkVoidFunction)GetPhysicalDeviceMemoryProperties; |
| 5199 | if (!strcmp(name, "GetInstanceProcAddr")) return (PFN_vkVoidFunction)GetInstanceProcAddr; |
| 5200 | if (!strcmp(name, "CreateDevice")) return (PFN_vkVoidFunction)CreateDevice; |
| 5201 | if (!strcmp(name, "EnumerateInstanceExtensionProperties")) return (PFN_vkVoidFunction)EnumerateInstanceExtensionProperties; |
| 5202 | if (!strcmp(name, "EnumerateInstanceLayerProperties")) return (PFN_vkVoidFunction)EnumerateInstanceLayerProperties; |
| 5203 | if (!strcmp(name, "EnumerateDeviceLayerProperties")) return (PFN_vkVoidFunction)EnumerateDeviceLayerProperties; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5204 | if (!strcmp(name, "GetPhysicalDeviceSparseImageFormatProperties")) |
| 5205 | return (PFN_vkVoidFunction)GetPhysicalDeviceSparseImageFormatProperties; |
Mark Lobodzinski | 5fcb92b | 2016-09-28 12:48:56 -0600 | [diff] [blame] | 5206 | if (!strcmp(name, "GetPhysicalDeviceExternalImageFormatPropertiesNV")) |
| 5207 | return (PFN_vkVoidFunction)GetPhysicalDeviceExternalImageFormatPropertiesNV; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5208 | |
| 5209 | return NULL; |
| 5210 | } |
| 5211 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5212 | static inline PFN_vkVoidFunction InterceptInstanceExtensionCommand(const char *name) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5213 | if (!name || name[0] != 'v' || name[1] != 'k') return NULL; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5214 | |
| 5215 | name += 2; |
| 5216 | |
| 5217 | // VK_KHR_get_physical_device_properties2 Extension |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5218 | if (!strcmp(name, "GetPhysicalDeviceFeatures2KHR")) return (PFN_vkVoidFunction)GetPhysicalDeviceFeatures2KHR; |
| 5219 | if (!strcmp(name, "GetPhysicalDeviceProperties2KHR")) return (PFN_vkVoidFunction)GetPhysicalDeviceProperties2KHR; |
| 5220 | if (!strcmp(name, "GetPhysicalDeviceFormatProperties2KHR")) return (PFN_vkVoidFunction)GetPhysicalDeviceFormatProperties2KHR; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5221 | if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties2KHR")) |
| 5222 | return (PFN_vkVoidFunction)GetPhysicalDeviceImageFormatProperties2KHR; |
| 5223 | if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties2KHR")) |
| 5224 | return (PFN_vkVoidFunction)GetPhysicalDeviceQueueFamilyProperties2KHR; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5225 | // VK_KHX_device_group Extension |
| 5226 | if (!strcmp(name, "GetPhysicalDevicePresentRectanglesKHX")) return (PFN_vkVoidFunction)GetPhysicalDevicePresentRectanglesKHX; |
| 5227 | // VK_KHX_device_group_creation Extension |
| 5228 | if (!strcmp(name, "EnumeratePhysicalDeviceGroupsKHX")) return (PFN_vkVoidFunction)EnumeratePhysicalDeviceGroupsKHX; |
| 5229 | // VK_KHX_external_memory_capabilities Extension |
| 5230 | if (!strcmp(name, "GetPhysicalDeviceExternalBufferPropertiesKHX")) |
| 5231 | return (PFN_vkVoidFunction)GetPhysicalDeviceExternalBufferPropertiesKHX; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5232 | // VK_KHX_external_semaphore_capabilities Extension |
| 5233 | if (!strcmp(name, "GetPhysicalDeviceExternalSemaphorePropertiesKHX")) |
| 5234 | return (PFN_vkVoidFunction)GetPhysicalDeviceExternalSemaphorePropertiesKHX; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5235 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT |
| 5236 | // VK_EXT_acquire_xlib_display Extension |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5237 | if (!strcmp(name, "AcquireXlibDisplayEXT")) return (PFN_vkVoidFunction)AcquireXlibDisplayEXT; |
| 5238 | if (!strcmp(name, "GetRandROutputDisplayEXT")) return (PFN_vkVoidFunction)GetRandROutputDisplayEXT; |
| 5239 | #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5240 | // VK_EXT_direct_mode_display Extension |
| 5241 | if (!strcmp(name, "ReleaseDisplayEXT")) return (PFN_vkVoidFunction)ReleaseDisplayEXT; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5242 | // VK_EXT_display_surface_counter Extension |
| 5243 | if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilities2EXT")) |
| 5244 | return (PFN_vkVoidFunction)GetPhysicalDeviceSurfaceCapabilities2EXT; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5245 | // VK_NV_clip_space_w_scaling Extension |
| 5246 | if (!strcmp(name, "CmdSetViewportWScalingNV")) return (PFN_vkVoidFunction)CmdSetViewportWScalingNV; |
| 5247 | // VK_NVX_device_generated_commands Extension |
| 5248 | if (!strcmp(name, "GetPhysicalDeviceGeneratedCommandsPropertiesNVX")) |
| 5249 | return (PFN_vkVoidFunction)GetPhysicalDeviceGeneratedCommandsPropertiesNVX; |
| 5250 | |
| 5251 | return NULL; |
| 5252 | } |
| 5253 | |
| 5254 | static inline PFN_vkVoidFunction InterceptDeviceExtensionCommand(const char *name, VkDevice device) { |
| 5255 | if (device) { |
| 5256 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5257 | |
| 5258 | if (!name || name[0] != 'v' || name[1] != 'k') return NULL; |
| 5259 | |
| 5260 | name += 2; |
| 5261 | |
| 5262 | if (device_data->enables.khr_descriptor_update_template) { |
| 5263 | if (!strcmp(name, "CreateDescriptorUpdateTemplateKHR")) return (PFN_vkVoidFunction)CreateDescriptorUpdateTemplateKHR; |
| 5264 | if (!strcmp(name, "DestroyDescriptorUpdateTemplateKHR")) return (PFN_vkVoidFunction)DestroyDescriptorUpdateTemplateKHR; |
| 5265 | if (!strcmp(name, "UpdateDescriptorSetWithTemplateKHR")) return (PFN_vkVoidFunction)UpdateDescriptorSetWithTemplateKHR; |
| 5266 | if (!strcmp(name, "CmdPushDescriptorSetWithTemplateKHR")) |
| 5267 | return (PFN_vkVoidFunction)CmdPushDescriptorSetWithTemplateKHR; |
| 5268 | } |
| 5269 | if (device_data->enables.khr_maintenance1) { |
| 5270 | if (!strcmp(name, "TrimCommandPoolKHR")) return (PFN_vkVoidFunction)TrimCommandPoolKHR; |
| 5271 | } |
| 5272 | if (device_data->enables.khr_push_descriptor) { |
| 5273 | if (!strcmp(name, "CmdPushDescriptorSetKHR")) return (PFN_vkVoidFunction)CmdPushDescriptorSetKHR; |
| 5274 | } |
| 5275 | if (device_data->enables.khx_device_group) { |
| 5276 | // VK_KHX_device_group Extension |
| 5277 | if (!strcmp(name, "GetDeviceGroupPeerMemoryFeaturesKHX")) |
| 5278 | return (PFN_vkVoidFunction)GetDeviceGroupPeerMemoryFeaturesKHX; |
| 5279 | if (!strcmp(name, "BindBufferMemory2KHX")) return (PFN_vkVoidFunction)BindBufferMemory2KHX; |
| 5280 | if (!strcmp(name, "BindImageMemory2KHX")) return (PFN_vkVoidFunction)BindImageMemory2KHX; |
| 5281 | if (!strcmp(name, "CmdSetDeviceMaskKHX")) return (PFN_vkVoidFunction)CmdSetDeviceMaskKHX; |
| 5282 | if (!strcmp(name, "GetDeviceGroupPresentCapabilitiesKHX")) |
| 5283 | return (PFN_vkVoidFunction)GetDeviceGroupPresentCapabilitiesKHX; |
| 5284 | if (!strcmp(name, "GetDeviceGroupSurfacePresentModesKHX")) |
| 5285 | return (PFN_vkVoidFunction)GetDeviceGroupSurfacePresentModesKHX; |
| 5286 | if (!strcmp(name, "AcquireNextImage2KHX")) return (PFN_vkVoidFunction)AcquireNextImage2KHX; |
| 5287 | if (!strcmp(name, "CmdDispatchBaseKHX")) return (PFN_vkVoidFunction)CmdDispatchBaseKHX; |
| 5288 | } |
Jamie Madill | c9a7692 | 2017-03-21 13:46:11 -0400 | [diff] [blame] | 5289 | #ifdef VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5290 | if (device_data->enables.khx_external_memory_win32) { |
| 5291 | if (!strcmp(name, "GetMemoryWin32HandleKHX")) return (PFN_vkVoidFunction)GetMemoryWin32HandleKHX; |
| 5292 | if (!strcmp(name, "GetMemoryWin32HandlePropertiesKHX")) return (PFN_vkVoidFunction)GetMemoryWin32HandlePropertiesKHX; |
| 5293 | } |
Jamie Madill | c9a7692 | 2017-03-21 13:46:11 -0400 | [diff] [blame] | 5294 | #endif // VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5295 | if (device_data->enables.khx_external_memory_fd) { |
| 5296 | if (!strcmp(name, "GetMemoryFdKHX")) return (PFN_vkVoidFunction)GetMemoryFdKHX; |
| 5297 | if (!strcmp(name, "GetMemoryFdPropertiesKHX")) return (PFN_vkVoidFunction)GetMemoryFdPropertiesKHX; |
| 5298 | } |
Jamie Madill | c9a7692 | 2017-03-21 13:46:11 -0400 | [diff] [blame] | 5299 | #ifdef VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5300 | if (device_data->enables.khx_external_semaphore_win32) { |
| 5301 | if (!strcmp(name, "ImportSemaphoreWin32HandleKHX")) return (PFN_vkVoidFunction)ImportSemaphoreWin32HandleKHX; |
| 5302 | if (!strcmp(name, "GetSemaphoreWin32HandleKHX")) return (PFN_vkVoidFunction)GetSemaphoreWin32HandleKHX; |
| 5303 | } |
Jamie Madill | c9a7692 | 2017-03-21 13:46:11 -0400 | [diff] [blame] | 5304 | #endif // VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5305 | if (device_data->enables.khx_external_semaphore_fd) { |
| 5306 | if (!strcmp(name, "ImportSemaphoreFdKHX")) return (PFN_vkVoidFunction)ImportSemaphoreFdKHX; |
| 5307 | if (!strcmp(name, "GetSemaphoreFdKHX")) return (PFN_vkVoidFunction)GetSemaphoreFdKHX; |
| 5308 | } |
| 5309 | if (device_data->enables.ext_discard_rectangles) { |
| 5310 | if (!strcmp(name, "CmdSetDiscardRectangleEXT")) return (PFN_vkVoidFunction)CmdSetDiscardRectangleEXT; |
| 5311 | } |
| 5312 | if (device_data->enables.ext_display_control) { |
| 5313 | if (!strcmp(name, "DisplayPowerControlEXT")) return (PFN_vkVoidFunction)DisplayPowerControlEXT; |
| 5314 | if (!strcmp(name, "RegisterDeviceEventEXT")) return (PFN_vkVoidFunction)RegisterDeviceEventEXT; |
| 5315 | if (!strcmp(name, "RegisterDisplayEventEXT")) return (PFN_vkVoidFunction)RegisterDisplayEventEXT; |
| 5316 | if (!strcmp(name, "GetSwapchainCounterEXT")) return (PFN_vkVoidFunction)GetSwapchainCounterEXT; |
| 5317 | } |
| 5318 | if (device_data->enables.nvx_device_generated_commands) { |
| 5319 | if (!strcmp(name, "CmdProcessCommandsNVX")) return (PFN_vkVoidFunction)CmdProcessCommandsNVX; |
| 5320 | if (!strcmp(name, "CmdReserveSpaceForCommandsNVX")) return (PFN_vkVoidFunction)CmdReserveSpaceForCommandsNVX; |
| 5321 | if (!strcmp(name, "CreateIndirectCommandsLayoutNVX")) return (PFN_vkVoidFunction)CreateIndirectCommandsLayoutNVX; |
| 5322 | if (!strcmp(name, "DestroyIndirectCommandsLayoutNVX")) return (PFN_vkVoidFunction)DestroyIndirectCommandsLayoutNVX; |
| 5323 | if (!strcmp(name, "CreateObjectTableNVX")) return (PFN_vkVoidFunction)CreateObjectTableNVX; |
| 5324 | if (!strcmp(name, "DestroyObjectTableNVX")) return (PFN_vkVoidFunction)DestroyObjectTableNVX; |
| 5325 | if (!strcmp(name, "RegisterObjectsNVX")) return (PFN_vkVoidFunction)RegisterObjectsNVX; |
| 5326 | if (!strcmp(name, "UnregisterObjectsNVX")) return (PFN_vkVoidFunction)UnregisterObjectsNVX; |
| 5327 | } |
| 5328 | } |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5329 | |
| 5330 | return NULL; |
| 5331 | } |
| 5332 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5333 | static inline PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkDevice device) { |
| 5334 | if (device) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5335 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5336 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5337 | if (device_data->enables.wsi) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5338 | if (!strcmp("vkCreateSwapchainKHR", name)) return reinterpret_cast<PFN_vkVoidFunction>(CreateSwapchainKHR); |
| 5339 | if (!strcmp("vkDestroySwapchainKHR", name)) return reinterpret_cast<PFN_vkVoidFunction>(DestroySwapchainKHR); |
| 5340 | if (!strcmp("vkGetSwapchainImagesKHR", name)) return reinterpret_cast<PFN_vkVoidFunction>(GetSwapchainImagesKHR); |
| 5341 | if (!strcmp("vkAcquireNextImageKHR", name)) return reinterpret_cast<PFN_vkVoidFunction>(AcquireNextImageKHR); |
| 5342 | if (!strcmp("vkQueuePresentKHR", name)) return reinterpret_cast<PFN_vkVoidFunction>(QueuePresentKHR); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5343 | } |
| 5344 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5345 | if (device_data->enables.wsi_display_swapchain) { |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5346 | if (!strcmp("vkCreateSharedSwapchainsKHR", name)) { |
| 5347 | return reinterpret_cast<PFN_vkVoidFunction>(CreateSharedSwapchainsKHR); |
| 5348 | } |
| 5349 | } |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 5350 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5351 | if (device_data->enables.wsi_display_extension) { |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 5352 | if (!strcmp("vkGetPhysicalDeviceDisplayPropertiesKHR", name)) |
| 5353 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceDisplayPropertiesKHR); |
| 5354 | if (!strcmp("vkGetPhysicalDeviceDisplayPlanePropertiesKHR", name)) |
| 5355 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceDisplayPlanePropertiesKHR); |
| 5356 | if (!strcmp("vkGetDisplayPlaneSupportedDisplaysKHR", name)) |
| 5357 | return reinterpret_cast<PFN_vkVoidFunction>(GetDisplayPlaneSupportedDisplaysKHR); |
| 5358 | if (!strcmp("vkGetDisplayModePropertiesKHR", name)) |
| 5359 | return reinterpret_cast<PFN_vkVoidFunction>(GetDisplayModePropertiesKHR); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5360 | if (!strcmp("vkCreateDisplayModeKHR", name)) return reinterpret_cast<PFN_vkVoidFunction>(CreateDisplayModeKHR); |
Mark Lobodzinski | 39853ea | 2016-11-14 10:00:41 -0700 | [diff] [blame] | 5361 | if (!strcmp("vkGetDisplayPlaneCapabilitiesKHR", name)) |
| 5362 | return reinterpret_cast<PFN_vkVoidFunction>(GetDisplayPlaneCapabilitiesKHR); |
| 5363 | if (!strcmp("vkCreateDisplayPlaneSurfaceKHR", name)) |
| 5364 | return reinterpret_cast<PFN_vkVoidFunction>(CreateDisplayPlaneSurfaceKHR); |
| 5365 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5366 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5367 | |
| 5368 | return nullptr; |
| 5369 | } |
| 5370 | |
| 5371 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) { |
| 5372 | PFN_vkVoidFunction addr; |
| 5373 | addr = InterceptCoreDeviceCommand(funcName); |
| 5374 | if (addr) { |
| 5375 | return addr; |
| 5376 | } |
| 5377 | assert(device); |
| 5378 | |
| 5379 | addr = InterceptWsiEnabledCommand(funcName, device); |
| 5380 | if (addr) { |
| 5381 | return addr; |
| 5382 | } |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5383 | addr = InterceptDeviceExtensionCommand(funcName, device); |
| 5384 | if (addr) { |
| 5385 | return addr; |
| 5386 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5387 | if (get_dispatch_table(ot_device_table_map, device)->GetDeviceProcAddr == NULL) { |
| 5388 | return NULL; |
| 5389 | } |
| 5390 | return get_dispatch_table(ot_device_table_map, device)->GetDeviceProcAddr(device, funcName); |
| 5391 | } |
| 5392 | |
| 5393 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char *funcName) { |
| 5394 | PFN_vkVoidFunction addr; |
| 5395 | addr = InterceptCoreInstanceCommand(funcName); |
| 5396 | if (!addr) { |
| 5397 | addr = InterceptCoreDeviceCommand(funcName); |
| 5398 | } |
| 5399 | if (!addr) { |
| 5400 | addr = InterceptWsiEnabledCommand(funcName, VkDevice(VK_NULL_HANDLE)); |
| 5401 | } |
| 5402 | if (addr) { |
| 5403 | return addr; |
| 5404 | } |
| 5405 | assert(instance); |
| 5406 | |
| 5407 | addr = InterceptMsgCallbackGetProcAddrCommand(funcName, instance); |
| 5408 | if (addr) { |
| 5409 | return addr; |
| 5410 | } |
| 5411 | addr = InterceptWsiEnabledCommand(funcName, instance); |
| 5412 | if (addr) { |
| 5413 | return addr; |
| 5414 | } |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5415 | addr = InterceptInstanceExtensionCommand(funcName); |
| 5416 | if (addr) { |
| 5417 | return addr; |
| 5418 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5419 | if (get_dispatch_table(ot_instance_table_map, instance)->GetInstanceProcAddr == NULL) { |
| 5420 | return NULL; |
| 5421 | } |
| 5422 | return get_dispatch_table(ot_instance_table_map, instance)->GetInstanceProcAddr(instance, funcName); |
| 5423 | } |
| 5424 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5425 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetPhysicalDeviceProcAddr(VkInstance instance, const char *funcName) { |
| 5426 | assert(instance); |
| 5427 | |
| 5428 | if (get_dispatch_table(ot_instance_table_map, instance)->GetPhysicalDeviceProcAddr == NULL) { |
| 5429 | return NULL; |
| 5430 | } |
| 5431 | return get_dispatch_table(ot_instance_table_map, instance)->GetPhysicalDeviceProcAddr(instance, funcName); |
| 5432 | } |
| 5433 | |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5434 | } // namespace object_tracker |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 5435 | |
| 5436 | // vk_layer_logging.h expects these to be defined |
| 5437 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(VkInstance instance, |
| 5438 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 5439 | const VkAllocationCallbacks *pAllocator, |
| 5440 | VkDebugReportCallbackEXT *pMsgCallback) { |
| 5441 | return object_tracker::CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); |
| 5442 | } |
| 5443 | |
| 5444 | VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, |
| 5445 | const VkAllocationCallbacks *pAllocator) { |
| 5446 | object_tracker::DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
| 5447 | } |
| 5448 | |
| 5449 | VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 5450 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 5451 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
| 5452 | object_tracker::DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
| 5453 | } |
| 5454 | |
| 5455 | // Loader-layer interface v0, just wrappers since there is only a layer |
| 5456 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 5457 | VkExtensionProperties *pProperties) { |
| 5458 | return object_tracker::EnumerateInstanceExtensionProperties(pLayerName, pCount, pProperties); |
| 5459 | } |
| 5460 | |
| 5461 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pCount, |
| 5462 | VkLayerProperties *pProperties) { |
| 5463 | return object_tracker::EnumerateInstanceLayerProperties(pCount, pProperties); |
| 5464 | } |
| 5465 | |
| 5466 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 5467 | VkLayerProperties *pProperties) { |
| 5468 | // The layer command handles VK_NULL_HANDLE just fine internally |
| 5469 | assert(physicalDevice == VK_NULL_HANDLE); |
| 5470 | return object_tracker::EnumerateDeviceLayerProperties(VK_NULL_HANDLE, pCount, pProperties); |
| 5471 | } |
| 5472 | |
| 5473 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice dev, const char *funcName) { |
| 5474 | return object_tracker::GetDeviceProcAddr(dev, funcName); |
| 5475 | } |
| 5476 | |
| 5477 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *funcName) { |
| 5478 | return object_tracker::GetInstanceProcAddr(instance, funcName); |
| 5479 | } |
| 5480 | |
| 5481 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, |
| 5482 | const char *pLayerName, uint32_t *pCount, |
| 5483 | VkExtensionProperties *pProperties) { |
| 5484 | // The layer command handles VK_NULL_HANDLE just fine internally |
| 5485 | assert(physicalDevice == VK_NULL_HANDLE); |
| 5486 | return object_tracker::EnumerateDeviceExtensionProperties(VK_NULL_HANDLE, pLayerName, pCount, pProperties); |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 5487 | } |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5488 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5489 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_layerGetPhysicalDeviceProcAddr(VkInstance instance, |
| 5490 | const char *funcName) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5491 | return object_tracker::GetPhysicalDeviceProcAddr(instance, funcName); |
| 5492 | } |
| 5493 | |
| 5494 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *pVersionStruct) { |
| 5495 | assert(pVersionStruct != NULL); |
| 5496 | assert(pVersionStruct->sType == LAYER_NEGOTIATE_INTERFACE_STRUCT); |
| 5497 | |
| 5498 | // Fill in the function pointers if our version is at least capable of having the structure contain them. |
| 5499 | if (pVersionStruct->loaderLayerInterfaceVersion >= 2) { |
| 5500 | pVersionStruct->pfnGetInstanceProcAddr = vkGetInstanceProcAddr; |
| 5501 | pVersionStruct->pfnGetDeviceProcAddr = vkGetDeviceProcAddr; |
| 5502 | pVersionStruct->pfnGetPhysicalDeviceProcAddr = vk_layerGetPhysicalDeviceProcAddr; |
| 5503 | } |
| 5504 | |
| 5505 | if (pVersionStruct->loaderLayerInterfaceVersion < CURRENT_LOADER_LAYER_INTERFACE_VERSION) { |
| 5506 | object_tracker::loader_layer_if_version = pVersionStruct->loaderLayerInterfaceVersion; |
| 5507 | } else if (pVersionStruct->loaderLayerInterfaceVersion > CURRENT_LOADER_LAYER_INTERFACE_VERSION) { |
| 5508 | pVersionStruct->loaderLayerInterfaceVersion = CURRENT_LOADER_LAYER_INTERFACE_VERSION; |
| 5509 | } |
| 5510 | |
| 5511 | return VK_SUCCESS; |
| 5512 | } |