Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2016 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2016 Valve Corporation |
| 3 | * Copyright (c) 2015-2016 LunarG, Inc. |
| 4 | * Copyright (C) 2015-2016 Google Inc. |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 5 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 9 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 11 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
Courtney Goeltzenleuchter | 0555952 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 17 | * |
| 18 | * Author: Jeremy Hayes <jeremy@lunarg.com> |
| 19 | * Author: Tony Barbour <tony@LunarG.com> |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 20 | * Author: Mark Lobodzinski <mark@LunarG.com> |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 21 | * Author: Dustin Graves <dustin@lunarg.com> |
Chris Forbes | b93e59e | 2016-11-24 14:52:24 +1300 | [diff] [blame] | 22 | * Author: Chris Forbes <chrisforbes@google.com> |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 23 | */ |
| 24 | |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 25 | #define NOMINMAX |
| 26 | |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 27 | #include <limits.h> |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 28 | #include <math.h> |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 29 | #include <stdio.h> |
| 30 | #include <stdlib.h> |
| 31 | #include <string.h> |
| 32 | |
| 33 | #include <iostream> |
| 34 | #include <string> |
| 35 | #include <sstream> |
Mark Lobodzinski | 2eed1eb | 2015-05-26 10:58:40 -0500 | [diff] [blame] | 36 | #include <unordered_map> |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 37 | #include <unordered_set> |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 38 | #include <vector> |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 39 | |
Chris Forbes | f90cef9 | 2016-11-29 09:49:19 +1300 | [diff] [blame] | 40 | #include "vk_loader_platform.h" |
| 41 | #include "vulkan/vk_layer.h" |
| 42 | #include "vk_layer_config.h" |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 43 | #include "vk_dispatch_table_helper.h" |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 44 | |
Tobin Ehlis | a0cb02e | 2015-07-03 10:15:26 -0600 | [diff] [blame] | 45 | #include "vk_layer_table.h" |
| 46 | #include "vk_layer_data.h" |
| 47 | #include "vk_layer_logging.h" |
Courtney Goeltzenleuchter | f13293f | 2015-07-07 11:02:42 -0600 | [diff] [blame] | 48 | #include "vk_layer_extension_utils.h" |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 49 | #include "vk_layer_utils.h" |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 50 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 51 | #include "parameter_name.h" |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 52 | #include "parameter_validation.h" |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 53 | |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 54 | namespace parameter_validation { |
Dustin Graves | b83fc2d | 2016-05-04 12:56:08 -0600 | [diff] [blame] | 55 | |
Chris Forbes | 7b58a71 | 2016-11-24 11:35:31 +1300 | [diff] [blame] | 56 | struct instance_layer_data { |
Chris Forbes | 7b57a39 | 2016-11-02 17:56:50 +1300 | [diff] [blame] | 57 | VkInstance instance = VK_NULL_HANDLE; |
Chia-I Wu | a570b7c | 2016-05-16 07:48:14 +0800 | [diff] [blame] | 58 | |
Chris Forbes | 7b57a39 | 2016-11-02 17:56:50 +1300 | [diff] [blame] | 59 | debug_report_data *report_data = nullptr; |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 60 | std::vector<VkDebugReportCallbackEXT> logging_callback; |
Cody Northrop | 55443ef | 2015-09-28 15:09:32 -0600 | [diff] [blame] | 61 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 62 | // The following are for keeping track of the temporary callbacks that can |
| 63 | // be used in vkCreateInstance and vkDestroyInstance: |
Chris Forbes | 7b57a39 | 2016-11-02 17:56:50 +1300 | [diff] [blame] | 64 | uint32_t num_tmp_callbacks = 0; |
| 65 | VkDebugReportCallbackCreateInfoEXT *tmp_dbg_create_infos = nullptr; |
| 66 | VkDebugReportCallbackEXT *tmp_callbacks = nullptr; |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 67 | instance_extension_enables extensions = {}; |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 68 | |
| 69 | VkLayerInstanceDispatchTable dispatch_table = {}; |
Chris Forbes | 7b58a71 | 2016-11-24 11:35:31 +1300 | [diff] [blame] | 70 | }; |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 71 | |
Chris Forbes | 7b58a71 | 2016-11-24 11:35:31 +1300 | [diff] [blame] | 72 | struct layer_data { |
Chris Forbes | 7b58a71 | 2016-11-24 11:35:31 +1300 | [diff] [blame] | 73 | debug_report_data *report_data = nullptr; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 74 | // Map for queue family index to queue count |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 75 | std::unordered_map<uint32_t, uint32_t> queueFamilyIndexMap; |
Chris Forbes | 7b57a39 | 2016-11-02 17:56:50 +1300 | [diff] [blame] | 76 | VkPhysicalDeviceLimits device_limits = {}; |
| 77 | VkPhysicalDeviceFeatures physical_device_features = {}; |
| 78 | VkPhysicalDevice physical_device = VK_NULL_HANDLE; |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 79 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 80 | union loader_device_extension_enables { |
| 81 | struct { |
| 82 | bool khr_swapchain_enabled : 1; |
| 83 | bool khr_display_swapchain_enabled : 1; |
| 84 | bool khr_maintenance1 : 1; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 85 | bool khr_push_descriptor : 1; |
| 86 | bool khr_descriptor_update_template : 1; |
| 87 | bool khx_device_group : 1; |
| 88 | bool khx_external_memory_fd : 1; |
| 89 | bool khx_external_memory_win32 : 1; |
| 90 | bool khx_external_semaphore_fd : 1; |
| 91 | bool khx_external_semaphore_win32 : 1; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 92 | bool ext_debug_marker : 1; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 93 | bool ext_discard_rectangles : 1; |
| 94 | bool ext_display_control : 1; |
| 95 | bool amd_draw_indirect_count : 1; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 96 | bool amd_negative_viewport_height : 1; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 97 | bool nv_clip_space_w_scaling : 1; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 98 | bool nv_external_memory : 1; |
| 99 | bool nv_external_memory_win32 : 1; |
| 100 | bool nvx_device_generated_commands : 1; |
| 101 | }; |
| 102 | uint64_t padding[4]; |
| 103 | } enables; |
| 104 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 105 | layer_data() { memset(enables.padding, 0, sizeof(uint64_t) * 4); } |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 106 | |
| 107 | VkLayerDispatchTable dispatch_table = {}; |
Cody Northrop | 55443ef | 2015-09-28 15:09:32 -0600 | [diff] [blame] | 108 | }; |
Mark Lobodzinski | 2eed1eb | 2015-05-26 10:58:40 -0500 | [diff] [blame] | 109 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 110 | static uint32_t loader_layer_if_version = CURRENT_LOADER_LAYER_INTERFACE_VERSION; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 111 | static std::unordered_map<void *, layer_data *> layer_data_map; |
Chris Forbes | 7b58a71 | 2016-11-24 11:35:31 +1300 | [diff] [blame] | 112 | static std::unordered_map<void *, instance_layer_data *> instance_layer_data_map; |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 113 | |
Chris Forbes | 7b58a71 | 2016-11-24 11:35:31 +1300 | [diff] [blame] | 114 | static void init_parameter_validation(instance_layer_data *my_data, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 115 | layer_debug_actions(my_data->report_data, my_data->logging_callback, pAllocator, "lunarg_parameter_validation"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 116 | } |
| 117 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 118 | VKAPI_ATTR VkResult VKAPI_CALL CreateDebugReportCallbackEXT(VkInstance instance, |
| 119 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 120 | const VkAllocationCallbacks *pAllocator, |
| 121 | VkDebugReportCallbackEXT *pMsgCallback) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 122 | auto data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 123 | VkResult result = data->dispatch_table.CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 124 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 125 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 97c4d51 | 2016-05-19 15:27:18 -0600 | [diff] [blame] | 126 | result = layer_create_msg_callback(data->report_data, false, pCreateInfo, pAllocator, pMsgCallback); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | return result; |
| 130 | } |
| 131 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 132 | VKAPI_ATTR void VKAPI_CALL DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 133 | const VkAllocationCallbacks *pAllocator) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 134 | auto data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 135 | data->dispatch_table.DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
| 136 | |
Courtney Goeltzenleuchter | 05854bf | 2015-11-30 12:13:14 -0700 | [diff] [blame] | 137 | layer_destroy_msg_callback(data->report_data, msgCallback, pAllocator); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 138 | } |
| 139 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 140 | VKAPI_ATTR void VKAPI_CALL DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 141 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 142 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 143 | auto data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 144 | data->dispatch_table.DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
Courtney Goeltzenleuchter | f0de724 | 2015-12-01 14:10:55 -0700 | [diff] [blame] | 145 | } |
| 146 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 147 | static const VkExtensionProperties instance_extensions[] = {{VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}}; |
Tony Barbour | 59a4732 | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 148 | |
Chia-I Wu | 3384db8 | 2016-05-16 07:30:58 +0800 | [diff] [blame] | 149 | static const VkLayerProperties global_layer = { |
Jon Ashburn | dc9111c | 2016-03-22 12:57:13 -0600 | [diff] [blame] | 150 | "VK_LAYER_LUNARG_parameter_validation", VK_LAYER_API_VERSION, 1, "LunarG Validation Layer", |
Chia-I Wu | 3384db8 | 2016-05-16 07:30:58 +0800 | [diff] [blame] | 151 | }; |
Courtney Goeltzenleuchter | 5285766 | 2015-12-01 14:08:28 -0700 | [diff] [blame] | 152 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 153 | static bool ValidateEnumerator(VkFormatFeatureFlagBits const &enumerator) { |
Courtney Goeltzenleuchter | f1ece60 | 2015-09-10 16:25:49 -0600 | [diff] [blame] | 154 | VkFormatFeatureFlagBits allFlags = (VkFormatFeatureFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 155 | VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT | VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | |
| 156 | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT | |
| 157 | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT | VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | |
| 158 | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | |
| 159 | VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT | |
Jon Ashburn | 766866a | 2016-01-22 15:39:20 -0700 | [diff] [blame] | 160 | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 161 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 162 | return false; |
| 163 | } |
| 164 | |
| 165 | return true; |
| 166 | } |
| 167 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 168 | static std::string EnumeratorString(VkFormatFeatureFlagBits const &enumerator) { |
| 169 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 170 | return "unrecognized enumerator"; |
| 171 | } |
| 172 | |
| 173 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 174 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 175 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT"); |
| 176 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 177 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 178 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT"); |
| 179 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 180 | if (enumerator & VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 181 | strings.push_back("VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT"); |
| 182 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 183 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 184 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT"); |
| 185 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 186 | if (enumerator & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 187 | strings.push_back("VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT"); |
| 188 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 189 | if (enumerator & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 190 | strings.push_back("VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT"); |
| 191 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 192 | if (enumerator & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 193 | strings.push_back("VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT"); |
| 194 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 195 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 196 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT"); |
| 197 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 198 | if (enumerator & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 199 | strings.push_back("VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT"); |
| 200 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 201 | if (enumerator & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 202 | strings.push_back("VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
| 203 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 204 | if (enumerator & VK_FORMAT_FEATURE_BLIT_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 205 | strings.push_back("VK_FORMAT_FEATURE_BLIT_SRC_BIT"); |
Cody Northrop | 61d6dd6 | 2015-08-18 14:58:29 -0600 | [diff] [blame] | 206 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 207 | if (enumerator & VK_FORMAT_FEATURE_BLIT_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 208 | strings.push_back("VK_FORMAT_FEATURE_BLIT_DST_BIT"); |
Cody Northrop | 61d6dd6 | 2015-08-18 14:58:29 -0600 | [diff] [blame] | 209 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 210 | if (enumerator & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) { |
Jon Ashburn | 766866a | 2016-01-22 15:39:20 -0700 | [diff] [blame] | 211 | strings.push_back("VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT"); |
| 212 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 213 | |
| 214 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 215 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 216 | enumeratorString += string; |
| 217 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 218 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 219 | enumeratorString += '|'; |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | return enumeratorString; |
| 224 | } |
| 225 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 226 | static bool ValidateEnumerator(VkImageUsageFlagBits const &enumerator) { |
| 227 | VkImageUsageFlagBits allFlags = (VkImageUsageFlagBits)( |
| 228 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | |
| 229 | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | |
| 230 | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT); |
| 231 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 232 | return false; |
| 233 | } |
| 234 | |
| 235 | return true; |
| 236 | } |
| 237 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 238 | static std::string EnumeratorString(VkImageUsageFlagBits const &enumerator) { |
| 239 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 240 | return "unrecognized enumerator"; |
| 241 | } |
| 242 | |
| 243 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 244 | if (enumerator & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 245 | strings.push_back("VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT"); |
| 246 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 247 | if (enumerator & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) { |
Courtney Goeltzenleuchter | 660f0ca | 2015-09-10 14:14:11 -0600 | [diff] [blame] | 248 | strings.push_back("VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 249 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 250 | if (enumerator & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 251 | strings.push_back("VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT"); |
| 252 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 253 | if (enumerator & VK_IMAGE_USAGE_STORAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 254 | strings.push_back("VK_IMAGE_USAGE_STORAGE_BIT"); |
| 255 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 256 | if (enumerator & VK_IMAGE_USAGE_SAMPLED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 257 | strings.push_back("VK_IMAGE_USAGE_SAMPLED_BIT"); |
| 258 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 259 | if (enumerator & VK_IMAGE_USAGE_TRANSFER_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 260 | strings.push_back("VK_IMAGE_USAGE_TRANSFER_DST_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 261 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 262 | if (enumerator & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 263 | strings.push_back("VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT"); |
| 264 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 265 | if (enumerator & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 266 | strings.push_back("VK_IMAGE_USAGE_TRANSFER_SRC_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 267 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 268 | |
| 269 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 270 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 271 | enumeratorString += string; |
| 272 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 273 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 274 | enumeratorString += '|'; |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | return enumeratorString; |
| 279 | } |
| 280 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 281 | static bool ValidateEnumerator(VkQueueFlagBits const &enumerator) { |
| 282 | VkQueueFlagBits allFlags = |
| 283 | (VkQueueFlagBits)(VK_QUEUE_TRANSFER_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_SPARSE_BINDING_BIT | VK_QUEUE_GRAPHICS_BIT); |
| 284 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 285 | return false; |
| 286 | } |
| 287 | |
| 288 | return true; |
| 289 | } |
| 290 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 291 | static std::string EnumeratorString(VkQueueFlagBits const &enumerator) { |
| 292 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 293 | return "unrecognized enumerator"; |
| 294 | } |
| 295 | |
| 296 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 297 | if (enumerator & VK_QUEUE_TRANSFER_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 298 | strings.push_back("VK_QUEUE_TRANSFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 299 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 300 | if (enumerator & VK_QUEUE_COMPUTE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 301 | strings.push_back("VK_QUEUE_COMPUTE_BIT"); |
| 302 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 303 | if (enumerator & VK_QUEUE_SPARSE_BINDING_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 304 | strings.push_back("VK_QUEUE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 305 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 306 | if (enumerator & VK_QUEUE_GRAPHICS_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 307 | strings.push_back("VK_QUEUE_GRAPHICS_BIT"); |
| 308 | } |
| 309 | |
| 310 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 311 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 312 | enumeratorString += string; |
| 313 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 314 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 315 | enumeratorString += '|'; |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | return enumeratorString; |
| 320 | } |
| 321 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 322 | static bool ValidateEnumerator(VkMemoryPropertyFlagBits const &enumerator) { |
| 323 | VkMemoryPropertyFlagBits allFlags = (VkMemoryPropertyFlagBits)( |
| 324 | VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | |
| 325 | VK_MEMORY_PROPERTY_HOST_CACHED_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); |
| 326 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 327 | return false; |
| 328 | } |
| 329 | |
| 330 | return true; |
| 331 | } |
| 332 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 333 | static std::string EnumeratorString(VkMemoryPropertyFlagBits const &enumerator) { |
| 334 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 335 | return "unrecognized enumerator"; |
| 336 | } |
| 337 | |
| 338 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 339 | if (enumerator & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 340 | strings.push_back("VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT"); |
| 341 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 342 | if (enumerator & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 343 | strings.push_back("VK_MEMORY_PROPERTY_HOST_COHERENT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 344 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 345 | if (enumerator & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 346 | strings.push_back("VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT"); |
| 347 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 348 | if (enumerator & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 349 | strings.push_back("VK_MEMORY_PROPERTY_HOST_CACHED_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 350 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 351 | if (enumerator & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 352 | strings.push_back("VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 356 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 357 | enumeratorString += string; |
| 358 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 359 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 360 | enumeratorString += '|'; |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | return enumeratorString; |
| 365 | } |
| 366 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 367 | static bool ValidateEnumerator(VkMemoryHeapFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 368 | VkMemoryHeapFlagBits allFlags = (VkMemoryHeapFlagBits)(VK_MEMORY_HEAP_DEVICE_LOCAL_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 369 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 370 | return false; |
| 371 | } |
| 372 | |
| 373 | return true; |
| 374 | } |
| 375 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 376 | static std::string EnumeratorString(VkMemoryHeapFlagBits const &enumerator) { |
| 377 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 378 | return "unrecognized enumerator"; |
| 379 | } |
| 380 | |
| 381 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 382 | if (enumerator & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 383 | strings.push_back("VK_MEMORY_HEAP_DEVICE_LOCAL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 384 | } |
| 385 | |
| 386 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 387 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 388 | enumeratorString += string; |
| 389 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 390 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 391 | enumeratorString += '|'; |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | return enumeratorString; |
| 396 | } |
| 397 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 398 | static bool ValidateEnumerator(VkSparseImageFormatFlagBits const &enumerator) { |
| 399 | VkSparseImageFormatFlagBits allFlags = |
| 400 | (VkSparseImageFormatFlagBits)(VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT | |
| 401 | VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT | VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT); |
| 402 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 403 | return false; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 404 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 405 | |
| 406 | return true; |
| 407 | } |
| 408 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 409 | static std::string EnumeratorString(VkSparseImageFormatFlagBits const &enumerator) { |
| 410 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 411 | return "unrecognized enumerator"; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 412 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 413 | |
| 414 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 415 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 416 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 417 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 418 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 419 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 420 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 421 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 422 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 423 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 424 | |
| 425 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 426 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 427 | enumeratorString += string; |
| 428 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 429 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 430 | enumeratorString += '|'; |
| 431 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 432 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 433 | |
| 434 | return enumeratorString; |
| 435 | } |
| 436 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 437 | static bool ValidateEnumerator(VkFenceCreateFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 438 | VkFenceCreateFlagBits allFlags = (VkFenceCreateFlagBits)(VK_FENCE_CREATE_SIGNALED_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 439 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 440 | return false; |
| 441 | } |
| 442 | |
| 443 | return true; |
| 444 | } |
| 445 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 446 | static std::string EnumeratorString(VkFenceCreateFlagBits const &enumerator) { |
| 447 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 448 | return "unrecognized enumerator"; |
| 449 | } |
| 450 | |
| 451 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 452 | if (enumerator & VK_FENCE_CREATE_SIGNALED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 453 | strings.push_back("VK_FENCE_CREATE_SIGNALED_BIT"); |
| 454 | } |
| 455 | |
| 456 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 457 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 458 | enumeratorString += string; |
| 459 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 460 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 461 | enumeratorString += '|'; |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | return enumeratorString; |
| 466 | } |
| 467 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 468 | static bool ValidateEnumerator(VkQueryPipelineStatisticFlagBits const &enumerator) { |
| 469 | VkQueryPipelineStatisticFlagBits allFlags = (VkQueryPipelineStatisticFlagBits)( |
| 470 | VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT | VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT | |
| 471 | VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT | VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT | |
| 472 | VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT | VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT | |
| 473 | VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT | VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT | |
Courtney Goeltzenleuchter | fe1b36e | 2015-10-15 16:57:32 -0600 | [diff] [blame] | 474 | VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT | |
| 475 | VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT | |
| 476 | VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 477 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 478 | return false; |
| 479 | } |
| 480 | |
| 481 | return true; |
| 482 | } |
| 483 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 484 | static std::string EnumeratorString(VkQueryPipelineStatisticFlagBits const &enumerator) { |
| 485 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 486 | return "unrecognized enumerator"; |
| 487 | } |
| 488 | |
| 489 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 490 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 491 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 492 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 493 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 494 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 495 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 496 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 497 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 498 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 499 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 500 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 501 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 502 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 503 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 504 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 505 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 506 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 507 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 508 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 509 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 510 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 511 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 512 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 513 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 514 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 515 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 516 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 517 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 518 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 519 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 520 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 521 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 522 | } |
| 523 | |
| 524 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 525 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 526 | enumeratorString += string; |
| 527 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 528 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 529 | enumeratorString += '|'; |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | return enumeratorString; |
| 534 | } |
| 535 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 536 | static bool ValidateEnumerator(VkQueryResultFlagBits const &enumerator) { |
| 537 | VkQueryResultFlagBits allFlags = (VkQueryResultFlagBits)(VK_QUERY_RESULT_PARTIAL_BIT | VK_QUERY_RESULT_WITH_AVAILABILITY_BIT | |
| 538 | VK_QUERY_RESULT_WAIT_BIT | VK_QUERY_RESULT_64_BIT); |
| 539 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 540 | return false; |
| 541 | } |
| 542 | |
| 543 | return true; |
| 544 | } |
| 545 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 546 | static std::string EnumeratorString(VkQueryResultFlagBits const &enumerator) { |
| 547 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 548 | return "unrecognized enumerator"; |
| 549 | } |
| 550 | |
| 551 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 552 | if (enumerator & VK_QUERY_RESULT_PARTIAL_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 553 | strings.push_back("VK_QUERY_RESULT_PARTIAL_BIT"); |
| 554 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 555 | if (enumerator & VK_QUERY_RESULT_WITH_AVAILABILITY_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 556 | strings.push_back("VK_QUERY_RESULT_WITH_AVAILABILITY_BIT"); |
| 557 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 558 | if (enumerator & VK_QUERY_RESULT_WAIT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 559 | strings.push_back("VK_QUERY_RESULT_WAIT_BIT"); |
| 560 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 561 | if (enumerator & VK_QUERY_RESULT_64_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 562 | strings.push_back("VK_QUERY_RESULT_64_BIT"); |
| 563 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 564 | |
| 565 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 566 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 567 | enumeratorString += string; |
| 568 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 569 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 570 | enumeratorString += '|'; |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | return enumeratorString; |
| 575 | } |
| 576 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 577 | static bool ValidateEnumerator(VkBufferUsageFlagBits const &enumerator) { |
| 578 | VkBufferUsageFlagBits allFlags = (VkBufferUsageFlagBits)( |
| 579 | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT | |
| 580 | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | |
| 581 | VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT); |
| 582 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 583 | return false; |
| 584 | } |
| 585 | |
| 586 | return true; |
| 587 | } |
| 588 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 589 | static std::string EnumeratorString(VkBufferUsageFlagBits const &enumerator) { |
| 590 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 591 | return "unrecognized enumerator"; |
| 592 | } |
| 593 | |
| 594 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 595 | if (enumerator & VK_BUFFER_USAGE_VERTEX_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 596 | strings.push_back("VK_BUFFER_USAGE_VERTEX_BUFFER_BIT"); |
| 597 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 598 | if (enumerator & VK_BUFFER_USAGE_INDEX_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 599 | strings.push_back("VK_BUFFER_USAGE_INDEX_BUFFER_BIT"); |
| 600 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 601 | if (enumerator & VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 602 | strings.push_back("VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT"); |
| 603 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 604 | if (enumerator & VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 605 | strings.push_back("VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT"); |
| 606 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 607 | if (enumerator & VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 608 | strings.push_back("VK_BUFFER_USAGE_STORAGE_BUFFER_BIT"); |
| 609 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 610 | if (enumerator & VK_BUFFER_USAGE_TRANSFER_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 611 | strings.push_back("VK_BUFFER_USAGE_TRANSFER_DST_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 612 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 613 | if (enumerator & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 614 | strings.push_back("VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT"); |
| 615 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 616 | if (enumerator & VK_BUFFER_USAGE_TRANSFER_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 617 | strings.push_back("VK_BUFFER_USAGE_TRANSFER_SRC_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 618 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 619 | if (enumerator & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 620 | strings.push_back("VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT"); |
| 621 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 622 | |
| 623 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 624 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 625 | enumeratorString += string; |
| 626 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 627 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 628 | enumeratorString += '|'; |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | return enumeratorString; |
| 633 | } |
| 634 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 635 | static bool ValidateEnumerator(VkBufferCreateFlagBits const &enumerator) { |
| 636 | VkBufferCreateFlagBits allFlags = (VkBufferCreateFlagBits)( |
| 637 | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT | VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT | VK_BUFFER_CREATE_SPARSE_BINDING_BIT); |
| 638 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 639 | return false; |
| 640 | } |
| 641 | |
| 642 | return true; |
| 643 | } |
| 644 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 645 | static std::string EnumeratorString(VkBufferCreateFlagBits const &enumerator) { |
| 646 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 647 | return "unrecognized enumerator"; |
| 648 | } |
| 649 | |
| 650 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 651 | if (enumerator & VK_BUFFER_CREATE_SPARSE_ALIASED_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 652 | strings.push_back("VK_BUFFER_CREATE_SPARSE_ALIASED_BIT"); |
| 653 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 654 | if (enumerator & VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 655 | strings.push_back("VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT"); |
| 656 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 657 | if (enumerator & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) { |
Courtney Goeltzenleuchter | 8134da0 | 2015-09-10 17:00:22 -0600 | [diff] [blame] | 658 | strings.push_back("VK_BUFFER_CREATE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 659 | } |
| 660 | |
| 661 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 662 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 663 | enumeratorString += string; |
| 664 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 665 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 666 | enumeratorString += '|'; |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | return enumeratorString; |
| 671 | } |
| 672 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 673 | static bool ValidateEnumerator(VkImageCreateFlagBits const &enumerator) { |
| 674 | VkImageCreateFlagBits allFlags = (VkImageCreateFlagBits)( |
| 675 | VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | |
| 676 | VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_SPARSE_BINDING_BIT); |
| 677 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 678 | return false; |
| 679 | } |
| 680 | |
| 681 | return true; |
| 682 | } |
| 683 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 684 | static std::string EnumeratorString(VkImageCreateFlagBits const &enumerator) { |
| 685 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 686 | return "unrecognized enumerator"; |
| 687 | } |
| 688 | |
| 689 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 690 | if (enumerator & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 691 | strings.push_back("VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT"); |
| 692 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 693 | if (enumerator & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 694 | strings.push_back("VK_IMAGE_CREATE_SPARSE_ALIASED_BIT"); |
| 695 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 696 | if (enumerator & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 697 | strings.push_back("VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT"); |
| 698 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 699 | if (enumerator & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 700 | strings.push_back("VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT"); |
| 701 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 702 | if (enumerator & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) { |
Courtney Goeltzenleuchter | 8134da0 | 2015-09-10 17:00:22 -0600 | [diff] [blame] | 703 | strings.push_back("VK_IMAGE_CREATE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 704 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 705 | |
| 706 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 707 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 708 | enumeratorString += string; |
| 709 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 710 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 711 | enumeratorString += '|'; |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | return enumeratorString; |
| 716 | } |
| 717 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 718 | static bool ValidateEnumerator(VkColorComponentFlagBits const &enumerator) { |
| 719 | VkColorComponentFlagBits allFlags = (VkColorComponentFlagBits)(VK_COLOR_COMPONENT_A_BIT | VK_COLOR_COMPONENT_B_BIT | |
| 720 | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_R_BIT); |
| 721 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 722 | return false; |
| 723 | } |
| 724 | |
| 725 | return true; |
| 726 | } |
| 727 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 728 | static std::string EnumeratorString(VkColorComponentFlagBits const &enumerator) { |
| 729 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 730 | return "unrecognized enumerator"; |
| 731 | } |
| 732 | |
| 733 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 734 | if (enumerator & VK_COLOR_COMPONENT_A_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 735 | strings.push_back("VK_COLOR_COMPONENT_A_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 736 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 737 | if (enumerator & VK_COLOR_COMPONENT_B_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 738 | strings.push_back("VK_COLOR_COMPONENT_B_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 739 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 740 | if (enumerator & VK_COLOR_COMPONENT_G_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 741 | strings.push_back("VK_COLOR_COMPONENT_G_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 742 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 743 | if (enumerator & VK_COLOR_COMPONENT_R_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 744 | strings.push_back("VK_COLOR_COMPONENT_R_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 745 | } |
| 746 | |
| 747 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 748 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 749 | enumeratorString += string; |
| 750 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 751 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 752 | enumeratorString += '|'; |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | return enumeratorString; |
| 757 | } |
| 758 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 759 | static bool ValidateEnumerator(VkPipelineCreateFlagBits const &enumerator) { |
| 760 | VkPipelineCreateFlagBits allFlags = (VkPipelineCreateFlagBits)( |
| 761 | VK_PIPELINE_CREATE_DERIVATIVE_BIT | VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT | VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT); |
| 762 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 763 | return false; |
| 764 | } |
| 765 | |
| 766 | return true; |
| 767 | } |
| 768 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 769 | static std::string EnumeratorString(VkPipelineCreateFlagBits const &enumerator) { |
| 770 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 771 | return "unrecognized enumerator"; |
| 772 | } |
| 773 | |
| 774 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 775 | if (enumerator & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 776 | strings.push_back("VK_PIPELINE_CREATE_DERIVATIVE_BIT"); |
| 777 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 778 | if (enumerator & VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 779 | strings.push_back("VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT"); |
| 780 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 781 | if (enumerator & VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 782 | strings.push_back("VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 783 | } |
| 784 | |
| 785 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 786 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 787 | enumeratorString += string; |
| 788 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 789 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 790 | enumeratorString += '|'; |
| 791 | } |
| 792 | } |
| 793 | |
| 794 | return enumeratorString; |
| 795 | } |
| 796 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 797 | static bool ValidateEnumerator(VkShaderStageFlagBits const &enumerator) { |
| 798 | VkShaderStageFlagBits allFlags = (VkShaderStageFlagBits)( |
| 799 | VK_SHADER_STAGE_ALL | VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_GEOMETRY_BIT | VK_SHADER_STAGE_COMPUTE_BIT | |
| 800 | VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT | VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT | VK_SHADER_STAGE_VERTEX_BIT); |
| 801 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 802 | return false; |
| 803 | } |
| 804 | |
| 805 | return true; |
| 806 | } |
| 807 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 808 | static std::string EnumeratorString(VkShaderStageFlagBits const &enumerator) { |
| 809 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 810 | return "unrecognized enumerator"; |
| 811 | } |
| 812 | |
| 813 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 814 | if (enumerator & VK_SHADER_STAGE_ALL) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 815 | strings.push_back("VK_SHADER_STAGE_ALL"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 816 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 817 | if (enumerator & VK_SHADER_STAGE_FRAGMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 818 | strings.push_back("VK_SHADER_STAGE_FRAGMENT_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 819 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 820 | if (enumerator & VK_SHADER_STAGE_GEOMETRY_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 821 | strings.push_back("VK_SHADER_STAGE_GEOMETRY_BIT"); |
| 822 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 823 | if (enumerator & VK_SHADER_STAGE_COMPUTE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 824 | strings.push_back("VK_SHADER_STAGE_COMPUTE_BIT"); |
| 825 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 826 | if (enumerator & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 827 | strings.push_back("VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 828 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 829 | if (enumerator & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 830 | strings.push_back("VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 831 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 832 | if (enumerator & VK_SHADER_STAGE_VERTEX_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 833 | strings.push_back("VK_SHADER_STAGE_VERTEX_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 834 | } |
| 835 | |
| 836 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 837 | for (auto const &string : strings) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 838 | enumeratorString += string; |
| 839 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 840 | if (string != strings.back()) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 841 | enumeratorString += '|'; |
| 842 | } |
| 843 | } |
| 844 | |
| 845 | return enumeratorString; |
| 846 | } |
| 847 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 848 | static bool ValidateEnumerator(VkPipelineStageFlagBits const &enumerator) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 849 | VkPipelineStageFlagBits allFlags = (VkPipelineStageFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 850 | VK_PIPELINE_STAGE_ALL_COMMANDS_BIT | VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | VK_PIPELINE_STAGE_HOST_BIT | |
| 851 | VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | |
| 852 | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | |
| 853 | VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | |
| 854 | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT | |
| 855 | VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_VERTEX_INPUT_BIT | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | |
Jon Ashburn | 4bf8ba4 | 2015-12-31 12:14:37 -0700 | [diff] [blame] | 856 | VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 857 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 858 | return false; |
| 859 | } |
| 860 | |
| 861 | return true; |
| 862 | } |
| 863 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 864 | static std::string EnumeratorString(VkPipelineStageFlagBits const &enumerator) { |
| 865 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 866 | return "unrecognized enumerator"; |
| 867 | } |
| 868 | |
| 869 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 870 | if (enumerator & VK_PIPELINE_STAGE_ALL_COMMANDS_BIT) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 871 | strings.push_back("VK_PIPELINE_STAGE_ALL_COMMANDS_BIT"); |
| 872 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 873 | if (enumerator & VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 874 | strings.push_back("VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 875 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 876 | if (enumerator & VK_PIPELINE_STAGE_HOST_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 877 | strings.push_back("VK_PIPELINE_STAGE_HOST_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 878 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 879 | if (enumerator & VK_PIPELINE_STAGE_TRANSFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 880 | strings.push_back("VK_PIPELINE_STAGE_TRANSFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 881 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 882 | if (enumerator & VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 883 | strings.push_back("VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 884 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 885 | if (enumerator & VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT) { |
Jon Ashburn | 4bf8ba4 | 2015-12-31 12:14:37 -0700 | [diff] [blame] | 886 | strings.push_back("VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 887 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 888 | if (enumerator & VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 889 | strings.push_back("VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 890 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 891 | if (enumerator & VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 892 | strings.push_back("VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 893 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 894 | if (enumerator & VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 895 | strings.push_back("VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 896 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 897 | if (enumerator & VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 898 | strings.push_back("VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 899 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 900 | if (enumerator & VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 901 | strings.push_back("VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT"); |
| 902 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 903 | if (enumerator & VK_PIPELINE_STAGE_VERTEX_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 904 | strings.push_back("VK_PIPELINE_STAGE_VERTEX_SHADER_BIT"); |
| 905 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 906 | if (enumerator & VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 907 | strings.push_back("VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 908 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 909 | if (enumerator & VK_PIPELINE_STAGE_VERTEX_INPUT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 910 | strings.push_back("VK_PIPELINE_STAGE_VERTEX_INPUT_BIT"); |
| 911 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 912 | if (enumerator & VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 913 | strings.push_back("VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT"); |
| 914 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 915 | if (enumerator & VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 916 | strings.push_back("VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT"); |
| 917 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 918 | if (enumerator & VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 919 | strings.push_back("VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 920 | } |
| 921 | |
| 922 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 923 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 924 | enumeratorString += string; |
| 925 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 926 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 927 | enumeratorString += '|'; |
| 928 | } |
| 929 | } |
| 930 | |
| 931 | return enumeratorString; |
| 932 | } |
| 933 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 934 | static bool ValidateEnumerator(VkAccessFlagBits const &enumerator) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 935 | VkAccessFlagBits allFlags = (VkAccessFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 936 | VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_INDEX_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | |
| 937 | VK_ACCESS_UNIFORM_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT | VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT | |
| 938 | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | |
| 939 | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT | |
| 940 | VK_ACCESS_HOST_READ_BIT | VK_ACCESS_HOST_WRITE_BIT | VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT); |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 941 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 942 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 943 | return false; |
| 944 | } |
| 945 | |
| 946 | return true; |
| 947 | } |
| 948 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 949 | static std::string EnumeratorString(VkAccessFlagBits const &enumerator) { |
| 950 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 951 | return "unrecognized enumerator"; |
| 952 | } |
| 953 | |
| 954 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 955 | if (enumerator & VK_ACCESS_INDIRECT_COMMAND_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 956 | strings.push_back("VK_ACCESS_INDIRECT_COMMAND_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 957 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 958 | if (enumerator & VK_ACCESS_INDEX_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 959 | strings.push_back("VK_ACCESS_INDEX_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 960 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 961 | if (enumerator & VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 962 | strings.push_back("VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 963 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 964 | if (enumerator & VK_ACCESS_UNIFORM_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 965 | strings.push_back("VK_ACCESS_UNIFORM_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 966 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 967 | if (enumerator & VK_ACCESS_INPUT_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 968 | strings.push_back("VK_ACCESS_INPUT_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 969 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 970 | if (enumerator & VK_ACCESS_SHADER_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 971 | strings.push_back("VK_ACCESS_SHADER_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 972 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 973 | if (enumerator & VK_ACCESS_SHADER_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 974 | strings.push_back("VK_ACCESS_SHADER_WRITE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 975 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 976 | if (enumerator & VK_ACCESS_COLOR_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 977 | strings.push_back("VK_ACCESS_COLOR_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 978 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 979 | if (enumerator & VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 980 | strings.push_back("VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 981 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 982 | if (enumerator & VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 983 | strings.push_back("VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 984 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 985 | if (enumerator & VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 986 | strings.push_back("VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 987 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 988 | if (enumerator & VK_ACCESS_TRANSFER_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 989 | strings.push_back("VK_ACCESS_TRANSFER_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 990 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 991 | if (enumerator & VK_ACCESS_TRANSFER_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 992 | strings.push_back("VK_ACCESS_TRANSFER_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 993 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 994 | if (enumerator & VK_ACCESS_HOST_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 995 | strings.push_back("VK_ACCESS_HOST_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 996 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 997 | if (enumerator & VK_ACCESS_HOST_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 998 | strings.push_back("VK_ACCESS_HOST_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 999 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1000 | if (enumerator & VK_ACCESS_MEMORY_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 1001 | strings.push_back("VK_ACCESS_MEMORY_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1002 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1003 | if (enumerator & VK_ACCESS_MEMORY_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 1004 | strings.push_back("VK_ACCESS_MEMORY_WRITE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1005 | } |
| 1006 | |
| 1007 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1008 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1009 | enumeratorString += string; |
| 1010 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1011 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1012 | enumeratorString += '|'; |
| 1013 | } |
| 1014 | } |
| 1015 | |
| 1016 | return enumeratorString; |
| 1017 | } |
| 1018 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1019 | static bool ValidateEnumerator(VkCommandPoolCreateFlagBits const &enumerator) { |
| 1020 | VkCommandPoolCreateFlagBits allFlags = |
| 1021 | (VkCommandPoolCreateFlagBits)(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT | VK_COMMAND_POOL_CREATE_TRANSIENT_BIT); |
| 1022 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1023 | return false; |
| 1024 | } |
| 1025 | |
| 1026 | return true; |
| 1027 | } |
| 1028 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1029 | static std::string EnumeratorString(VkCommandPoolCreateFlagBits const &enumerator) { |
| 1030 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1031 | return "unrecognized enumerator"; |
| 1032 | } |
| 1033 | |
| 1034 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1035 | if (enumerator & VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1036 | strings.push_back("VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1037 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1038 | if (enumerator & VK_COMMAND_POOL_CREATE_TRANSIENT_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1039 | strings.push_back("VK_COMMAND_POOL_CREATE_TRANSIENT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1040 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1041 | |
| 1042 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1043 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1044 | enumeratorString += string; |
| 1045 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1046 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1047 | enumeratorString += '|'; |
| 1048 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1049 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1050 | |
| 1051 | return enumeratorString; |
| 1052 | } |
| 1053 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1054 | static bool ValidateEnumerator(VkCommandPoolResetFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1055 | VkCommandPoolResetFlagBits allFlags = (VkCommandPoolResetFlagBits)(VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1056 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1057 | return false; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1058 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1059 | |
| 1060 | return true; |
| 1061 | } |
| 1062 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1063 | static std::string EnumeratorString(VkCommandPoolResetFlagBits const &enumerator) { |
| 1064 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1065 | return "unrecognized enumerator"; |
| 1066 | } |
| 1067 | |
| 1068 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1069 | if (enumerator & VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1070 | strings.push_back("VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1071 | } |
| 1072 | |
| 1073 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1074 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1075 | enumeratorString += string; |
| 1076 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1077 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1078 | enumeratorString += '|'; |
| 1079 | } |
| 1080 | } |
| 1081 | |
| 1082 | return enumeratorString; |
| 1083 | } |
| 1084 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1085 | static bool ValidateEnumerator(VkCommandBufferUsageFlags const &enumerator) { |
| 1086 | VkCommandBufferUsageFlags allFlags = |
| 1087 | (VkCommandBufferUsageFlags)(VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT | VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT | |
| 1088 | VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT); |
| 1089 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1090 | return false; |
| 1091 | } |
| 1092 | |
| 1093 | return true; |
| 1094 | } |
| 1095 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1096 | static std::string EnumeratorString(VkCommandBufferUsageFlags const &enumerator) { |
| 1097 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1098 | return "unrecognized enumerator"; |
| 1099 | } |
| 1100 | |
| 1101 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1102 | if (enumerator & VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1103 | strings.push_back("VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1104 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1105 | if (enumerator & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1106 | strings.push_back("VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1107 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1108 | if (enumerator & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1109 | strings.push_back("VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1110 | } |
| 1111 | |
| 1112 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1113 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1114 | enumeratorString += string; |
| 1115 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1116 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1117 | enumeratorString += '|'; |
| 1118 | } |
| 1119 | } |
| 1120 | |
| 1121 | return enumeratorString; |
| 1122 | } |
| 1123 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1124 | static bool ValidateEnumerator(VkCommandBufferResetFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1125 | VkCommandBufferResetFlagBits allFlags = (VkCommandBufferResetFlagBits)(VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1126 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1127 | return false; |
| 1128 | } |
| 1129 | |
| 1130 | return true; |
| 1131 | } |
| 1132 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1133 | static std::string EnumeratorString(VkCommandBufferResetFlagBits const &enumerator) { |
| 1134 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1135 | return "unrecognized enumerator"; |
| 1136 | } |
| 1137 | |
| 1138 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1139 | if (enumerator & VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1140 | strings.push_back("VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1141 | } |
| 1142 | |
| 1143 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1144 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1145 | enumeratorString += string; |
| 1146 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1147 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1148 | enumeratorString += '|'; |
| 1149 | } |
| 1150 | } |
| 1151 | |
| 1152 | return enumeratorString; |
| 1153 | } |
| 1154 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1155 | static bool ValidateEnumerator(VkImageAspectFlagBits const &enumerator) { |
| 1156 | VkImageAspectFlagBits allFlags = (VkImageAspectFlagBits)(VK_IMAGE_ASPECT_METADATA_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 1157 | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_COLOR_BIT); |
| 1158 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1159 | return false; |
| 1160 | } |
| 1161 | |
| 1162 | return true; |
| 1163 | } |
| 1164 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1165 | static std::string EnumeratorString(VkImageAspectFlagBits const &enumerator) { |
| 1166 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1167 | return "unrecognized enumerator"; |
| 1168 | } |
| 1169 | |
| 1170 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1171 | if (enumerator & VK_IMAGE_ASPECT_METADATA_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1172 | strings.push_back("VK_IMAGE_ASPECT_METADATA_BIT"); |
| 1173 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1174 | if (enumerator & VK_IMAGE_ASPECT_STENCIL_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1175 | strings.push_back("VK_IMAGE_ASPECT_STENCIL_BIT"); |
| 1176 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1177 | if (enumerator & VK_IMAGE_ASPECT_DEPTH_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1178 | strings.push_back("VK_IMAGE_ASPECT_DEPTH_BIT"); |
| 1179 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1180 | if (enumerator & VK_IMAGE_ASPECT_COLOR_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1181 | strings.push_back("VK_IMAGE_ASPECT_COLOR_BIT"); |
| 1182 | } |
| 1183 | |
| 1184 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1185 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1186 | enumeratorString += string; |
| 1187 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1188 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1189 | enumeratorString += '|'; |
| 1190 | } |
| 1191 | } |
| 1192 | |
| 1193 | return enumeratorString; |
| 1194 | } |
| 1195 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1196 | static bool ValidateEnumerator(VkQueryControlFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1197 | VkQueryControlFlagBits allFlags = (VkQueryControlFlagBits)(VK_QUERY_CONTROL_PRECISE_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1198 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1199 | return false; |
| 1200 | } |
| 1201 | |
| 1202 | return true; |
| 1203 | } |
| 1204 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1205 | static std::string EnumeratorString(VkQueryControlFlagBits const &enumerator) { |
| 1206 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1207 | return "unrecognized enumerator"; |
| 1208 | } |
| 1209 | |
| 1210 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1211 | if (enumerator & VK_QUERY_CONTROL_PRECISE_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 1212 | strings.push_back("VK_QUERY_CONTROL_PRECISE_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1213 | } |
| 1214 | |
| 1215 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1216 | for (auto const &string : strings) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1217 | enumeratorString += string; |
| 1218 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1219 | if (string != strings.back()) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1220 | enumeratorString += '|'; |
| 1221 | } |
| 1222 | } |
| 1223 | |
| 1224 | return enumeratorString; |
| 1225 | } |
| 1226 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1227 | static const int MaxParamCheckerStringLength = 256; |
| 1228 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 1229 | static bool validate_string(debug_report_data *report_data, const char *apiName, const ParameterName &stringName, |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1230 | const char *validateString) { |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1231 | assert(apiName != nullptr); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1232 | assert(validateString != nullptr); |
| 1233 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1234 | bool skip = false; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1235 | |
| 1236 | VkStringErrorFlags result = vk_string_validate(MaxParamCheckerStringLength, validateString); |
| 1237 | |
| 1238 | if (result == VK_STRING_ERROR_NONE) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1239 | return skip; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1240 | } else if (result & VK_STRING_ERROR_LENGTH) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1241 | skip = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1242 | INVALID_USAGE, LayerName, "%s: string %s exceeds max length %d", apiName, stringName.get_name().c_str(), |
| 1243 | MaxParamCheckerStringLength); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1244 | } else if (result & VK_STRING_ERROR_BAD_DATA) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1245 | skip = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1246 | INVALID_USAGE, LayerName, "%s: string %s contains invalid characters or is badly formed", apiName, |
| 1247 | stringName.get_name().c_str()); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1248 | } |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1249 | return skip; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1250 | } |
| 1251 | |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1252 | static bool validate_queue_family_index(layer_data *device_data, const char *function_name, const char *parameter_name, |
| 1253 | uint32_t index) { |
| 1254 | assert(device_data != nullptr); |
| 1255 | debug_report_data *report_data = device_data->report_data; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1256 | bool skip = false; |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1257 | |
| 1258 | if (index == VK_QUEUE_FAMILY_IGNORED) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1259 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1260 | "%s: %s cannot be VK_QUEUE_FAMILY_IGNORED.", function_name, parameter_name); |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1261 | } else { |
| 1262 | const auto &queue_data = device_data->queueFamilyIndexMap.find(index); |
| 1263 | if (queue_data == device_data->queueFamilyIndexMap.end()) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1264 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 1265 | "%s: %s (%d) must be one of the indices specified when the device was created, via " |
| 1266 | "the VkDeviceQueueCreateInfo structure.", |
| 1267 | function_name, parameter_name, index); |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1268 | return false; |
| 1269 | } |
| 1270 | } |
| 1271 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1272 | return skip; |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1273 | } |
| 1274 | |
| 1275 | static bool validate_queue_family_indices(layer_data *device_data, const char *function_name, const char *parameter_name, |
| 1276 | const uint32_t count, const uint32_t *indices) { |
| 1277 | assert(device_data != nullptr); |
| 1278 | debug_report_data *report_data = device_data->report_data; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1279 | bool skip = false; |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1280 | |
| 1281 | if (indices != nullptr) { |
| 1282 | for (uint32_t i = 0; i < count; i++) { |
| 1283 | if (indices[i] == VK_QUEUE_FAMILY_IGNORED) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1284 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1285 | LayerName, "%s: %s[%d] cannot be VK_QUEUE_FAMILY_IGNORED.", function_name, parameter_name, i); |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1286 | } else { |
| 1287 | const auto &queue_data = device_data->queueFamilyIndexMap.find(indices[i]); |
| 1288 | if (queue_data == device_data->queueFamilyIndexMap.end()) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1289 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 1290 | LayerName, |
| 1291 | "%s: %s[%d] (%d) must be one of the indices specified when the device was " |
| 1292 | "created, via the VkDeviceQueueCreateInfo structure.", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1293 | function_name, parameter_name, i, indices[i]); |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1294 | return false; |
| 1295 | } |
| 1296 | } |
| 1297 | } |
| 1298 | } |
| 1299 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1300 | return skip; |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1301 | } |
| 1302 | |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 1303 | static void CheckInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, instance_layer_data *instance_data); |
Mark Lobodzinski | 7d80ef6 | 2016-08-15 16:22:50 -0600 | [diff] [blame] | 1304 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1305 | VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 1306 | VkInstance *pInstance) { |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1307 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1308 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1309 | VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1310 | assert(chain_info != nullptr); |
| 1311 | assert(chain_info->u.pLayerInfo != nullptr); |
| 1312 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1313 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 1314 | PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)fpGetInstanceProcAddr(NULL, "vkCreateInstance"); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1315 | if (fpCreateInstance == NULL) { |
| 1316 | return VK_ERROR_INITIALIZATION_FAILED; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1317 | } |
| 1318 | |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1319 | // Advance the link info for the next element on the chain |
| 1320 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 1321 | |
| 1322 | result = fpCreateInstance(pCreateInfo, pAllocator, pInstance); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1323 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1324 | if (result == VK_SUCCESS) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1325 | auto my_instance_data = GetLayerDataPtr(get_dispatch_key(*pInstance), instance_layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1326 | assert(my_instance_data != nullptr); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1327 | |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1328 | layer_init_instance_dispatch_table(*pInstance, &my_instance_data->dispatch_table, fpGetInstanceProcAddr); |
Chia-I Wu | a570b7c | 2016-05-16 07:48:14 +0800 | [diff] [blame] | 1329 | my_instance_data->instance = *pInstance; |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1330 | my_instance_data->report_data = |
| 1331 | debug_report_create_instance(&my_instance_data->dispatch_table, *pInstance, pCreateInfo->enabledExtensionCount, |
| 1332 | pCreateInfo->ppEnabledExtensionNames); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1333 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1334 | // Look for one or more debug report create info structures |
| 1335 | // and setup a callback(s) for each one found. |
| 1336 | if (!layer_copy_tmp_callbacks(pCreateInfo->pNext, &my_instance_data->num_tmp_callbacks, |
| 1337 | &my_instance_data->tmp_dbg_create_infos, &my_instance_data->tmp_callbacks)) { |
| 1338 | if (my_instance_data->num_tmp_callbacks > 0) { |
| 1339 | // Setup the temporary callback(s) here to catch early issues: |
| 1340 | if (layer_enable_tmp_callbacks(my_instance_data->report_data, my_instance_data->num_tmp_callbacks, |
| 1341 | my_instance_data->tmp_dbg_create_infos, my_instance_data->tmp_callbacks)) { |
| 1342 | // Failure of setting up one or more of the callback. |
| 1343 | // Therefore, clean up and don't use those callbacks: |
| 1344 | layer_free_tmp_callbacks(my_instance_data->tmp_dbg_create_infos, my_instance_data->tmp_callbacks); |
| 1345 | my_instance_data->num_tmp_callbacks = 0; |
| 1346 | } |
| 1347 | } |
| 1348 | } |
| 1349 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1350 | init_parameter_validation(my_instance_data, pAllocator); |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 1351 | CheckInstanceRegisterExtensions(pCreateInfo, my_instance_data); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1352 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1353 | // Ordinarily we'd check these before calling down the chain, but none of the layer |
| 1354 | // support is in place until now, if we survive we can report the issue now. |
| 1355 | parameter_validation_vkCreateInstance(my_instance_data->report_data, pCreateInfo, pAllocator, pInstance); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1356 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1357 | if (pCreateInfo->pApplicationInfo) { |
| 1358 | if (pCreateInfo->pApplicationInfo->pApplicationName) { |
| 1359 | validate_string(my_instance_data->report_data, "vkCreateInstance", |
| 1360 | "pCreateInfo->VkApplicationInfo->pApplicationName", |
| 1361 | pCreateInfo->pApplicationInfo->pApplicationName); |
| 1362 | } |
Courtney Goeltzenleuchter | 842691b | 2016-02-10 14:00:52 -0700 | [diff] [blame] | 1363 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1364 | if (pCreateInfo->pApplicationInfo->pEngineName) { |
| 1365 | validate_string(my_instance_data->report_data, "vkCreateInstance", "pCreateInfo->VkApplicationInfo->pEngineName", |
| 1366 | pCreateInfo->pApplicationInfo->pEngineName); |
| 1367 | } |
Courtney Goeltzenleuchter | 41c5c4b | 2016-02-10 15:13:55 -0700 | [diff] [blame] | 1368 | } |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1369 | |
| 1370 | // Disable the tmp callbacks: |
| 1371 | if (my_instance_data->num_tmp_callbacks > 0) { |
| 1372 | layer_disable_tmp_callbacks(my_instance_data->report_data, my_instance_data->num_tmp_callbacks, |
| 1373 | my_instance_data->tmp_callbacks); |
| 1374 | } |
Courtney Goeltzenleuchter | 842691b | 2016-02-10 14:00:52 -0700 | [diff] [blame] | 1375 | } |
| 1376 | |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1377 | return result; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1378 | } |
| 1379 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1380 | VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1381 | // Grab the key before the instance is destroyed. |
| 1382 | dispatch_key key = get_dispatch_key(instance); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1383 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1384 | auto my_data = GetLayerDataPtr(key, instance_layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1385 | assert(my_data != NULL); |
| 1386 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1387 | // Enable the temporary callback(s) here to catch vkDestroyInstance issues: |
| 1388 | bool callback_setup = false; |
| 1389 | if (my_data->num_tmp_callbacks > 0) { |
| 1390 | if (!layer_enable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_dbg_create_infos, |
| 1391 | my_data->tmp_callbacks)) { |
| 1392 | callback_setup = true; |
| 1393 | } |
| 1394 | } |
| 1395 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1396 | skip |= parameter_validation_vkDestroyInstance(my_data->report_data, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1397 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1398 | // Disable and cleanup the temporary callback(s): |
| 1399 | if (callback_setup) { |
| 1400 | layer_disable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_callbacks); |
| 1401 | } |
| 1402 | if (my_data->num_tmp_callbacks > 0) { |
| 1403 | layer_free_tmp_callbacks(my_data->tmp_dbg_create_infos, my_data->tmp_callbacks); |
| 1404 | my_data->num_tmp_callbacks = 0; |
| 1405 | } |
| 1406 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1407 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1408 | my_data->dispatch_table.DestroyInstance(instance, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1409 | |
| 1410 | // Clean up logging callback, if any |
| 1411 | while (my_data->logging_callback.size() > 0) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1412 | VkDebugReportCallbackEXT callback = my_data->logging_callback.back(); |
| 1413 | layer_destroy_msg_callback(my_data->report_data, callback, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1414 | my_data->logging_callback.pop_back(); |
| 1415 | } |
| 1416 | |
Chris Forbes | 78a56b0 | 2016-11-02 16:13:01 +1300 | [diff] [blame] | 1417 | layer_debug_report_destroy_instance(my_data->report_data); |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1418 | instance_layer_data_map.erase(key); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1419 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1420 | } |
| 1421 | |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 1422 | VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, |
| 1423 | VkPhysicalDevice *pPhysicalDevices) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1424 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1425 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1426 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1427 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1428 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1429 | skip |= parameter_validation_vkEnumeratePhysicalDevices(my_data->report_data, pPhysicalDeviceCount, pPhysicalDevices); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1430 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1431 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1432 | result = my_data->dispatch_table.EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1433 | validate_result(my_data->report_data, "vkEnumeratePhysicalDevices", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1434 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1435 | return result; |
| 1436 | } |
| 1437 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1438 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1439 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1440 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1441 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1442 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1443 | skip |= parameter_validation_vkGetPhysicalDeviceFeatures(my_data->report_data, pFeatures); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1444 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1445 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1446 | my_data->dispatch_table.GetPhysicalDeviceFeatures(physicalDevice, pFeatures); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1447 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1448 | } |
| 1449 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1450 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 1451 | VkFormatProperties *pFormatProperties) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1452 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1453 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1454 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1455 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1456 | skip |= parameter_validation_vkGetPhysicalDeviceFormatProperties(my_data->report_data, format, pFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1457 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1458 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1459 | my_data->dispatch_table.GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1460 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1461 | } |
| 1462 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1463 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 1464 | VkImageType type, VkImageTiling tiling, |
| 1465 | VkImageUsageFlags usage, VkImageCreateFlags flags, |
| 1466 | VkImageFormatProperties *pImageFormatProperties) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1467 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1468 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1469 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1470 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1471 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1472 | skip |= parameter_validation_vkGetPhysicalDeviceImageFormatProperties(my_data->report_data, format, type, tiling, usage, flags, |
| 1473 | pImageFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1474 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1475 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1476 | result = my_data->dispatch_table.GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, |
| 1477 | pImageFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1478 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1479 | validate_result(my_data->report_data, "vkGetPhysicalDeviceImageFormatProperties", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1480 | } |
Chia-I Wu | 1724104 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 1481 | |
| 1482 | return result; |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1483 | } |
| 1484 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1485 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1486 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1487 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1488 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1489 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1490 | skip |= parameter_validation_vkGetPhysicalDeviceProperties(my_data->report_data, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1491 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1492 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1493 | my_data->dispatch_table.GetPhysicalDeviceProperties(physicalDevice, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1494 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1495 | } |
| 1496 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1497 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, |
| 1498 | uint32_t *pQueueFamilyPropertyCount, |
| 1499 | VkQueueFamilyProperties *pQueueFamilyProperties) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1500 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1501 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1502 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1503 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1504 | skip |= parameter_validation_vkGetPhysicalDeviceQueueFamilyProperties(my_data->report_data, pQueueFamilyPropertyCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1505 | pQueueFamilyProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1506 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1507 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1508 | my_data->dispatch_table.GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, |
| 1509 | pQueueFamilyProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1510 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1511 | } |
| 1512 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1513 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, |
| 1514 | VkPhysicalDeviceMemoryProperties *pMemoryProperties) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1515 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1516 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1517 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1518 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1519 | skip |= parameter_validation_vkGetPhysicalDeviceMemoryProperties(my_data->report_data, pMemoryProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1520 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1521 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1522 | my_data->dispatch_table.GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1523 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1524 | } |
| 1525 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 1526 | static void validateDeviceCreateInfo(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1527 | const std::vector<VkQueueFamilyProperties> properties) { |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 1528 | std::unordered_set<uint32_t> set; |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1529 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1530 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1531 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1532 | if ((pCreateInfo != nullptr) && (pCreateInfo->pQueueCreateInfos != nullptr)) { |
| 1533 | for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { |
| 1534 | if (set.count(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex)) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1535 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 1536 | VALIDATION_ERROR_00035, LayerName, |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1537 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueFamilyIndex, is not unique within this " |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 1538 | "structure. %s", |
| 1539 | i, validation_error_map[VALIDATION_ERROR_00035]); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1540 | } else { |
| 1541 | set.insert(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex); |
Michael Lentine | fa71bd5 | 2016-01-27 12:50:30 -0600 | [diff] [blame] | 1542 | } |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1543 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1544 | if (pCreateInfo->pQueueCreateInfos[i].pQueuePriorities != nullptr) { |
| 1545 | for (uint32_t j = 0; j < pCreateInfo->pQueueCreateInfos[i].queueCount; ++j) { |
| 1546 | if ((pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j] < 0.f) || |
| 1547 | (pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j] > 1.f)) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1548 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1549 | __LINE__, INVALID_USAGE, LayerName, |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1550 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->pQueuePriorities[%d], must be " |
| 1551 | "between 0 and 1. Actual value is %f", |
| 1552 | i, j, pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j]); |
| 1553 | } |
| 1554 | } |
| 1555 | } |
| 1556 | |
| 1557 | if (pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex >= properties.size()) { |
| 1558 | log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1559 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1560 | INVALID_USAGE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1561 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueFamilyIndex cannot be more than the number " |
| 1562 | "of queue families.", |
| 1563 | i); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1564 | } else if (pCreateInfo->pQueueCreateInfos[i].queueCount > |
| 1565 | properties[pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex].queueCount) { |
| 1566 | log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1567 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1568 | INVALID_USAGE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1569 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueCount cannot be more than the number of " |
| 1570 | "queues for the given family index.", |
| 1571 | i); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1572 | } |
Michael Lentine | 774704f | 2016-01-27 13:36:46 -0600 | [diff] [blame] | 1573 | } |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 1574 | } |
| 1575 | } |
| 1576 | |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 1577 | static void CheckInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, instance_layer_data *instance_data) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1578 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 1579 | auto name = pCreateInfo->ppEnabledExtensionNames[i]; |
| 1580 | |
| 1581 | if (strcmp(name, VK_KHR_SURFACE_EXTENSION_NAME) == 0) { |
| 1582 | instance_data->extensions.surface_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1583 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1584 | } else if (strcmp(name, VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) { |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 1585 | instance_data->extensions.xlib_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1586 | #endif |
| 1587 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1588 | } else if (strcmp(name, VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) { |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 1589 | instance_data->extensions.xcb_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1590 | #endif |
| 1591 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1592 | } else if (strcmp(name, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) { |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 1593 | instance_data->extensions.wayland_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1594 | #endif |
| 1595 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1596 | } else if (strcmp(name, VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) { |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 1597 | instance_data->extensions.mir_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1598 | #endif |
| 1599 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1600 | } else if (strcmp(name, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) { |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 1601 | instance_data->extensions.android_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1602 | #endif |
| 1603 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1604 | } else if (strcmp(name, VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) { |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 1605 | instance_data->extensions.win32_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1606 | #endif |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1607 | } else if (strcmp(name, VK_KHR_DISPLAY_EXTENSION_NAME) == 0) { |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 1608 | instance_data->extensions.display_enabled = true; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1609 | } else if (strcmp(name, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME) == 0) { |
| 1610 | instance_data->extensions.khr_get_phys_dev_properties2_enabled = true; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1611 | } else if (strcmp(name, VK_KHX_DEVICE_GROUP_CREATION_EXTENSION_NAME) == 0) { |
| 1612 | instance_data->extensions.khx_device_group_creation_enabled = true; |
| 1613 | } else if (strcmp(name, VK_KHX_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME) == 0) { |
| 1614 | instance_data->extensions.khx_external_memory_capabilities_enabled = true; |
| 1615 | } else if (strcmp(name, VK_KHX_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME) == 0) { |
| 1616 | instance_data->extensions.khx_external_semaphore_capabilities_enabled = true; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1617 | } else if (strcmp(name, VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME) == 0) { |
| 1618 | instance_data->extensions.nv_external_memory_capabilities_enabled = true; |
| 1619 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT |
| 1620 | } else if (strcmp(name, VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME) == 0) { |
| 1621 | instance_data->extensions.ext_acquire_xlib_display_enabled = true; |
| 1622 | #endif |
| 1623 | } else if (strcmp(name, VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME) == 0) { |
| 1624 | instance_data->extensions.ext_direct_mode_display_enabled = true; |
| 1625 | } else if (strcmp(name, VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME) == 0) { |
| 1626 | instance_data->extensions.ext_display_surface_counter_enabled = true; |
| 1627 | } else if (strcmp(name, VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME) == 0) { |
| 1628 | instance_data->extensions.nv_external_memory_capabilities_enabled = true; |
Chris Forbes | 2e47f43 | 2016-11-03 10:18:18 +1300 | [diff] [blame] | 1629 | } |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1630 | } |
| 1631 | } |
| 1632 | |
| 1633 | static void CheckDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, VkDevice device) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1634 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1635 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
| 1636 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1637 | device_data->enables.khr_swapchain_enabled = true; |
| 1638 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME) == 0) { |
| 1639 | device_data->enables.khr_display_swapchain_enabled = true; |
| 1640 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MAINTENANCE1_EXTENSION_NAME) == 0) { |
| 1641 | device_data->enables.khr_maintenance1 = true; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1642 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME) == 0) { |
| 1643 | device_data->enables.khr_push_descriptor = true; |
| 1644 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME) == 0) { |
| 1645 | device_data->enables.khr_descriptor_update_template = true; |
| 1646 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHX_DEVICE_GROUP_EXTENSION_NAME) == 0) { |
| 1647 | device_data->enables.khx_device_group = true; |
| 1648 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHX_EXTERNAL_MEMORY_FD_EXTENSION_NAME) == 0) { |
| 1649 | device_data->enables.khx_external_memory_fd = true; |
| 1650 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHX_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME) == 0) { |
| 1651 | device_data->enables.khx_external_semaphore_fd = true; |
Jamie Madill | 0f94144 | 2017-03-16 12:53:42 -0400 | [diff] [blame] | 1652 | #ifdef VK_USE_PLATFORM_WIN32_KHX |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1653 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHX_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME) == 0) { |
| 1654 | device_data->enables.khx_external_memory_win32 = true; |
| 1655 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHX_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME) == 0) { |
| 1656 | device_data->enables.khx_external_semaphore_win32 = true; |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1657 | #endif |
| 1658 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DEBUG_MARKER_EXTENSION_NAME) == 0) { |
| 1659 | device_data->enables.ext_debug_marker = true; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1660 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME) == 0) { |
| 1661 | device_data->enables.ext_discard_rectangles = true; |
Mark Lobodzinski | 099b3b6 | 2017-02-08 16:04:35 -0700 | [diff] [blame] | 1662 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME) == 0) { |
| 1663 | device_data->enables.ext_display_control = true; |
| 1664 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME) == 0) { |
| 1665 | device_data->enables.amd_draw_indirect_count = true; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1666 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME) == 0) { |
| 1667 | device_data->enables.amd_negative_viewport_height = true; |
| 1668 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME) == 0) { |
| 1669 | device_data->enables.nv_clip_space_w_scaling = true; |
| 1670 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME) == 0) { |
| 1671 | device_data->enables.nv_external_memory = true; |
| 1672 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 1673 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME) == 0) { |
| 1674 | device_data->enables.nv_external_memory_win32 = true; |
| 1675 | #endif |
| 1676 | } else if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME) == 0) { |
| 1677 | device_data->enables.nvx_device_generated_commands = true; |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 1678 | } |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1679 | } |
| 1680 | } |
| 1681 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1682 | void storeCreateDeviceData(VkDevice device, const VkDeviceCreateInfo *pCreateInfo) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1683 | layer_data *my_device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1684 | |
| 1685 | if ((pCreateInfo != nullptr) && (pCreateInfo->pQueueCreateInfos != nullptr)) { |
| 1686 | for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { |
| 1687 | my_device_data->queueFamilyIndexMap.insert( |
| 1688 | std::make_pair(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex, pCreateInfo->pQueueCreateInfos[i].queueCount)); |
| 1689 | } |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1690 | } |
| 1691 | } |
| 1692 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1693 | VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1694 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { |
Courtney Goeltzenleuchter | bafcdf3 | 2015-09-08 17:42:57 -0600 | [diff] [blame] | 1695 | /* |
Courtney Goeltzenleuchter | bafcdf3 | 2015-09-08 17:42:57 -0600 | [diff] [blame] | 1696 | * NOTE: We do not validate physicalDevice or any dispatchable |
| 1697 | * object as the first parameter. We couldn't get here if it was wrong! |
| 1698 | */ |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1699 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1700 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1701 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1702 | auto my_instance_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1703 | assert(my_instance_data != nullptr); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1704 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1705 | skip |= parameter_validation_vkCreateDevice(my_instance_data->report_data, pCreateInfo, pAllocator, pDevice); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1706 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1707 | if (pCreateInfo != NULL) { |
| 1708 | if ((pCreateInfo->enabledLayerCount > 0) && (pCreateInfo->ppEnabledLayerNames != NULL)) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 1709 | for (size_t i = 0; i < pCreateInfo->enabledLayerCount; i++) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1710 | skip |= validate_string(my_instance_data->report_data, "vkCreateDevice", "pCreateInfo->ppEnabledLayerNames", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1711 | pCreateInfo->ppEnabledLayerNames[i]); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1712 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1713 | } |
Michael Lentine | 774704f | 2016-01-27 13:36:46 -0600 | [diff] [blame] | 1714 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1715 | if ((pCreateInfo->enabledExtensionCount > 0) && (pCreateInfo->ppEnabledExtensionNames != NULL)) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 1716 | for (size_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1717 | skip |= validate_string(my_instance_data->report_data, "vkCreateDevice", "pCreateInfo->ppEnabledExtensionNames", |
| 1718 | pCreateInfo->ppEnabledExtensionNames[i]); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1719 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1720 | } |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 1721 | if (pCreateInfo->pNext != NULL && pCreateInfo->pEnabledFeatures) { |
| 1722 | // Check for get_physical_device_properties2 struct |
| 1723 | struct std_header { |
| 1724 | VkStructureType sType; |
| 1725 | const void *pNext; |
| 1726 | }; |
| 1727 | std_header *cur_pnext = (std_header *)pCreateInfo->pNext; |
| 1728 | while (cur_pnext) { |
| 1729 | if (VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR == cur_pnext->sType) { |
| 1730 | // Cannot include VkPhysicalDeviceFeatures2KHR and have non-null pEnabledFeatures |
| 1731 | skip |= log_msg(my_instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, |
| 1732 | VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, LayerName, |
| 1733 | "VkDeviceCreateInfo->pNext includes a VkPhysicalDeviceFeatures2KHR struct when " |
| 1734 | "pCreateInfo->pEnabledFeatures is non-NULL."); |
| 1735 | break; |
| 1736 | } |
| 1737 | cur_pnext = (std_header *)cur_pnext->pNext; |
| 1738 | } |
| 1739 | } |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1740 | if (pCreateInfo->pNext != NULL && pCreateInfo->pEnabledFeatures) { |
| 1741 | // Check for get_physical_device_properties2 struct |
| 1742 | struct std_header { |
| 1743 | VkStructureType sType; |
| 1744 | const void *pNext; |
| 1745 | }; |
| 1746 | std_header *cur_pnext = (std_header *)pCreateInfo->pNext; |
| 1747 | while (cur_pnext) { |
| 1748 | if (VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR == cur_pnext->sType) { |
| 1749 | // Cannot include VkPhysicalDeviceFeatures2KHR and have non-null pEnabledFeatures |
| 1750 | skip |= log_msg(my_instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, |
| 1751 | VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, LayerName, |
| 1752 | "VkDeviceCreateInfo->pNext includes a VkPhysicalDeviceFeatures2KHR struct when " |
| 1753 | "pCreateInfo->pEnabledFeatures is non-NULL."); |
| 1754 | break; |
| 1755 | } |
| 1756 | cur_pnext = (std_header *)cur_pnext->pNext; |
| 1757 | } |
| 1758 | } |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1759 | } |
| 1760 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1761 | if (!skip) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1762 | VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1763 | assert(chain_info != nullptr); |
| 1764 | assert(chain_info->u.pLayerInfo != nullptr); |
| 1765 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1766 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 1767 | PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; |
Chia-I Wu | a570b7c | 2016-05-16 07:48:14 +0800 | [diff] [blame] | 1768 | PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(my_instance_data->instance, "vkCreateDevice"); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1769 | if (fpCreateDevice == NULL) { |
| 1770 | return VK_ERROR_INITIALIZATION_FAILED; |
| 1771 | } |
| 1772 | |
| 1773 | // Advance the link info for the next element on the chain |
| 1774 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 1775 | |
| 1776 | result = fpCreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1777 | |
| 1778 | validate_result(my_instance_data->report_data, "vkCreateDevice", result); |
| 1779 | |
| 1780 | if (result == VK_SUCCESS) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1781 | layer_data *my_device_data = GetLayerDataPtr(get_dispatch_key(*pDevice), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1782 | assert(my_device_data != nullptr); |
| 1783 | |
| 1784 | my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 1785 | layer_init_device_dispatch_table(*pDevice, &my_device_data->dispatch_table, fpGetDeviceProcAddr); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1786 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1787 | CheckDeviceRegisterExtensions(pCreateInfo, *pDevice); |
| 1788 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1789 | uint32_t count; |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1790 | my_instance_data->dispatch_table.GetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, nullptr); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1791 | std::vector<VkQueueFamilyProperties> properties(count); |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1792 | my_instance_data->dispatch_table.GetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, &properties[0]); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1793 | |
| 1794 | validateDeviceCreateInfo(physicalDevice, pCreateInfo, properties); |
| 1795 | storeCreateDeviceData(*pDevice, pCreateInfo); |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 1796 | |
| 1797 | // Query and save physical device limits for this device |
| 1798 | VkPhysicalDeviceProperties device_properties = {}; |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 1799 | my_instance_data->dispatch_table.GetPhysicalDeviceProperties(physicalDevice, &device_properties); |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 1800 | memcpy(&my_device_data->device_limits, &device_properties.limits, sizeof(VkPhysicalDeviceLimits)); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 1801 | my_device_data->physical_device = physicalDevice; |
Mark Lobodzinski | 7bdd9f2 | 2016-08-09 13:41:09 -0600 | [diff] [blame] | 1802 | |
| 1803 | // Save app-enabled features in this device's layer_data structure |
| 1804 | if (pCreateInfo->pEnabledFeatures) { |
| 1805 | my_device_data->physical_device_features = *pCreateInfo->pEnabledFeatures; |
| 1806 | } else { |
| 1807 | memset(&my_device_data->physical_device_features, 0, sizeof(VkPhysicalDeviceFeatures)); |
| 1808 | } |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1809 | } |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1810 | } |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 1811 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1812 | return result; |
| 1813 | } |
| 1814 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1815 | VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1816 | dispatch_key key = get_dispatch_key(device); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1817 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1818 | layer_data *my_data = GetLayerDataPtr(key, layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1819 | assert(my_data != NULL); |
| 1820 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1821 | skip |= parameter_validation_vkDestroyDevice(my_data->report_data, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1822 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1823 | if (!skip) { |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1824 | layer_debug_report_destroy_device(device); |
| 1825 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1826 | #if DISPATCH_MAP_DEBUG |
Mark Mueller | aab3650 | 2016-05-03 13:17:29 -0600 | [diff] [blame] | 1827 | fprintf(stderr, "Device: 0x%p, key: 0x%p\n", device, key); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1828 | #endif |
| 1829 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 1830 | my_data->dispatch_table.DestroyDevice(device, pAllocator); |
Tony Barbour | d4eb06d | 2016-03-29 15:14:59 -0600 | [diff] [blame] | 1831 | layer_data_map.erase(key); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1832 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1833 | } |
| 1834 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 1835 | static bool PreGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1836 | layer_data *my_device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1837 | assert(my_device_data != nullptr); |
| 1838 | |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1839 | validate_queue_family_index(my_device_data, "vkGetDeviceQueue", "queueFamilyIndex", queueFamilyIndex); |
Mark Lobodzinski | f20f094 | 2016-03-22 10:07:26 -0600 | [diff] [blame] | 1840 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1841 | const auto &queue_data = my_device_data->queueFamilyIndexMap.find(queueFamilyIndex); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1842 | if (queue_data->second <= queueIndex) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 1843 | log_msg( |
| 1844 | my_device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 1845 | VALIDATION_ERROR_00061, LayerName, |
| 1846 | "vkGetDeviceQueue() parameter, uint32_t queueIndex %d, must be less than the number of queues given when the device " |
| 1847 | "was created. %s", |
| 1848 | queueIndex, validation_error_map[VALIDATION_ERROR_00061]); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1849 | return false; |
| 1850 | } |
| 1851 | return true; |
| 1852 | } |
| 1853 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1854 | VKAPI_ATTR void VKAPI_CALL GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1855 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1856 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1857 | assert(my_data != NULL); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1858 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1859 | skip |= parameter_validation_vkGetDeviceQueue(my_data->report_data, queueFamilyIndex, queueIndex, pQueue); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1860 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1861 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1862 | PreGetDeviceQueue(device, queueFamilyIndex, queueIndex); |
| 1863 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 1864 | my_data->dispatch_table.GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1865 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1866 | } |
| 1867 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1868 | VKAPI_ATTR VkResult VKAPI_CALL QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1869 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1870 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1871 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1872 | assert(my_data != NULL); |
| 1873 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1874 | skip |= parameter_validation_vkQueueSubmit(my_data->report_data, submitCount, pSubmits, fence); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1875 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1876 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 1877 | result = my_data->dispatch_table.QueueSubmit(queue, submitCount, pSubmits, fence); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1878 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1879 | validate_result(my_data->report_data, "vkQueueSubmit", result); |
Courtney Goeltzenleuchter | 646b907 | 2015-10-20 18:04:07 -0600 | [diff] [blame] | 1880 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1881 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1882 | return result; |
| 1883 | } |
| 1884 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1885 | VKAPI_ATTR VkResult VKAPI_CALL QueueWaitIdle(VkQueue queue) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1886 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1887 | assert(my_data != NULL); |
| 1888 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 1889 | VkResult result = my_data->dispatch_table.QueueWaitIdle(queue); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1890 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1891 | validate_result(my_data->report_data, "vkQueueWaitIdle", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1892 | |
| 1893 | return result; |
| 1894 | } |
| 1895 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1896 | VKAPI_ATTR VkResult VKAPI_CALL DeviceWaitIdle(VkDevice device) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1897 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1898 | assert(my_data != NULL); |
| 1899 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 1900 | VkResult result = my_data->dispatch_table.DeviceWaitIdle(device); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1901 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1902 | validate_result(my_data->report_data, "vkDeviceWaitIdle", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1903 | |
| 1904 | return result; |
| 1905 | } |
| 1906 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1907 | VKAPI_ATTR VkResult VKAPI_CALL AllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1908 | const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1909 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1910 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1911 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1912 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1913 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1914 | skip |= parameter_validation_vkAllocateMemory(my_data->report_data, pAllocateInfo, pAllocator, pMemory); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1915 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1916 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 1917 | result = my_data->dispatch_table.AllocateMemory(device, pAllocateInfo, pAllocator, pMemory); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1918 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1919 | validate_result(my_data->report_data, "vkAllocateMemory", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1920 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1921 | |
| 1922 | return result; |
| 1923 | } |
| 1924 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1925 | VKAPI_ATTR void VKAPI_CALL FreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1926 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1927 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1928 | assert(my_data != NULL); |
| 1929 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1930 | skip |= parameter_validation_vkFreeMemory(my_data->report_data, memory, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1931 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1932 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 1933 | my_data->dispatch_table.FreeMemory(device, memory, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1934 | } |
| 1935 | } |
| 1936 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1937 | VKAPI_ATTR VkResult VKAPI_CALL MapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, |
| 1938 | VkMemoryMapFlags flags, void **ppData) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1939 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1940 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1941 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1942 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1943 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1944 | skip |= parameter_validation_vkMapMemory(my_data->report_data, memory, offset, size, flags, ppData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1945 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1946 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 1947 | result = my_data->dispatch_table.MapMemory(device, memory, offset, size, flags, ppData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1948 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1949 | validate_result(my_data->report_data, "vkMapMemory", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1950 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1951 | |
| 1952 | return result; |
| 1953 | } |
| 1954 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1955 | VKAPI_ATTR void VKAPI_CALL UnmapMemory(VkDevice device, VkDeviceMemory memory) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1956 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1957 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1958 | assert(my_data != NULL); |
| 1959 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1960 | skip |= parameter_validation_vkUnmapMemory(my_data->report_data, memory); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1961 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1962 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 1963 | my_data->dispatch_table.UnmapMemory(device, memory); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1964 | } |
| 1965 | } |
| 1966 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1967 | VKAPI_ATTR VkResult VKAPI_CALL FlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, |
| 1968 | const VkMappedMemoryRange *pMemoryRanges) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1969 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1970 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1971 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1972 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1973 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1974 | skip |= parameter_validation_vkFlushMappedMemoryRanges(my_data->report_data, memoryRangeCount, pMemoryRanges); |
Tony Barbour | b125054 | 2015-04-16 19:23:13 -0600 | [diff] [blame] | 1975 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1976 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 1977 | result = my_data->dispatch_table.FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1978 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1979 | validate_result(my_data->report_data, "vkFlushMappedMemoryRanges", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1980 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1981 | |
Courtney Goeltzenleuchter | f69f8a2 | 2015-04-29 17:16:21 -0600 | [diff] [blame] | 1982 | return result; |
| 1983 | } |
| 1984 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1985 | VKAPI_ATTR VkResult VKAPI_CALL InvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, |
| 1986 | const VkMappedMemoryRange *pMemoryRanges) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1987 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1988 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 1989 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1990 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1991 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1992 | skip |= parameter_validation_vkInvalidateMappedMemoryRanges(my_data->report_data, memoryRangeCount, pMemoryRanges); |
Courtney Goeltzenleuchter | f69f8a2 | 2015-04-29 17:16:21 -0600 | [diff] [blame] | 1993 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 1994 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1995 | result = my_data->dispatch_table.InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1996 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1997 | validate_result(my_data->report_data, "vkInvalidateMappedMemoryRanges", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1998 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1999 | |
Tony Barbour | b125054 | 2015-04-16 19:23:13 -0600 | [diff] [blame] | 2000 | return result; |
| 2001 | } |
| 2002 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2003 | VKAPI_ATTR void VKAPI_CALL GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, |
| 2004 | VkDeviceSize *pCommittedMemoryInBytes) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2005 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2006 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2007 | assert(my_data != NULL); |
Courtney Goeltzenleuchter | fb71f22 | 2015-07-09 21:57:28 -0600 | [diff] [blame] | 2008 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2009 | skip |= parameter_validation_vkGetDeviceMemoryCommitment(my_data->report_data, memory, pCommittedMemoryInBytes); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2010 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2011 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2012 | my_data->dispatch_table.GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2013 | } |
Courtney Goeltzenleuchter | fb71f22 | 2015-07-09 21:57:28 -0600 | [diff] [blame] | 2014 | } |
| 2015 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2016 | VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, |
| 2017 | VkDeviceSize memoryOffset) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2018 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2019 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2020 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2021 | assert(my_data != NULL); |
| 2022 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2023 | skip |= parameter_validation_vkBindBufferMemory(my_data->report_data, buffer, memory, memoryOffset); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2024 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2025 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2026 | result = my_data->dispatch_table.BindBufferMemory(device, buffer, memory, memoryOffset); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2027 | |
| 2028 | validate_result(my_data->report_data, "vkBindBufferMemory", result); |
| 2029 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2030 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 2031 | return result; |
| 2032 | } |
| 2033 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2034 | VKAPI_ATTR VkResult VKAPI_CALL BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2035 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2036 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2037 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2038 | assert(my_data != NULL); |
| 2039 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2040 | skip |= parameter_validation_vkBindImageMemory(my_data->report_data, image, memory, memoryOffset); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2041 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2042 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2043 | result = my_data->dispatch_table.BindImageMemory(device, image, memory, memoryOffset); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2044 | |
| 2045 | validate_result(my_data->report_data, "vkBindImageMemory", result); |
| 2046 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2047 | |
| 2048 | return result; |
| 2049 | } |
| 2050 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2051 | VKAPI_ATTR void VKAPI_CALL GetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, |
| 2052 | VkMemoryRequirements *pMemoryRequirements) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2053 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2054 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2055 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2056 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2057 | skip |= parameter_validation_vkGetBufferMemoryRequirements(my_data->report_data, buffer, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2058 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2059 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2060 | my_data->dispatch_table.GetBufferMemoryRequirements(device, buffer, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2061 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2062 | } |
| 2063 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2064 | VKAPI_ATTR void VKAPI_CALL GetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2065 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2066 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2067 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2068 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2069 | skip |= parameter_validation_vkGetImageMemoryRequirements(my_data->report_data, image, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2070 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2071 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2072 | my_data->dispatch_table.GetImageMemoryRequirements(device, image, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2073 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2074 | } |
| 2075 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 2076 | static bool PostGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pNumRequirements, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2077 | VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2078 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2079 | if (pSparseMemoryRequirements != nullptr) { |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 2080 | if ((pSparseMemoryRequirements->formatProperties.aspectMask & |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2081 | (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 2082 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 2083 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2084 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2085 | "vkGetImageSparseMemoryRequirements parameter, VkImageAspect " |
| 2086 | "pSparseMemoryRequirements->formatProperties.aspectMask, is an unrecognized enumerator"); |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 2087 | return false; |
| 2088 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2089 | } |
| 2090 | |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2091 | return true; |
| 2092 | } |
| 2093 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2094 | VKAPI_ATTR void VKAPI_CALL GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, |
| 2095 | VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2096 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2097 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2098 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2099 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2100 | skip |= parameter_validation_vkGetImageSparseMemoryRequirements(my_data->report_data, image, pSparseMemoryRequirementCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2101 | pSparseMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2102 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2103 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2104 | my_data->dispatch_table.GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, |
| 2105 | pSparseMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2106 | |
| 2107 | PostGetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 2108 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2109 | } |
| 2110 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 2111 | static bool PostGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2112 | VkSampleCountFlagBits samples, VkImageUsageFlags usage, |
| 2113 | VkImageTiling tiling, uint32_t *pNumProperties, |
| 2114 | VkSparseImageFormatProperties *pProperties) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2115 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2116 | if (pProperties != nullptr) { |
| 2117 | if ((pProperties->aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 2118 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 2119 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, 1, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2120 | LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2121 | "vkGetPhysicalDeviceSparseImageFormatProperties parameter, VkImageAspect pProperties->aspectMask, is an " |
| 2122 | "unrecognized enumerator"); |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 2123 | return false; |
| 2124 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2125 | } |
| 2126 | |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2127 | return true; |
| 2128 | } |
| 2129 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2130 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 2131 | VkImageType type, VkSampleCountFlagBits samples, |
| 2132 | VkImageUsageFlags usage, VkImageTiling tiling, |
| 2133 | uint32_t *pPropertyCount, |
| 2134 | VkSparseImageFormatProperties *pProperties) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2135 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2136 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2137 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2138 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2139 | skip |= parameter_validation_vkGetPhysicalDeviceSparseImageFormatProperties(my_data->report_data, format, type, samples, usage, |
| 2140 | tiling, pPropertyCount, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2141 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2142 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 2143 | my_data->dispatch_table.GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, |
| 2144 | pPropertyCount, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2145 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2146 | PostGetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, |
| 2147 | pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2148 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2149 | } |
| 2150 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2151 | VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, |
| 2152 | VkFence fence) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2153 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2154 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2155 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2156 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2157 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2158 | skip |= parameter_validation_vkQueueBindSparse(my_data->report_data, bindInfoCount, pBindInfo, fence); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2159 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2160 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2161 | result = my_data->dispatch_table.QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2162 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2163 | validate_result(my_data->report_data, "vkQueueBindSparse", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2164 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2165 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 2166 | return result; |
| 2167 | } |
| 2168 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2169 | VKAPI_ATTR VkResult VKAPI_CALL CreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, |
| 2170 | const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2171 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2172 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2173 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2174 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2175 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2176 | skip |= parameter_validation_vkCreateFence(my_data->report_data, pCreateInfo, pAllocator, pFence); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2177 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2178 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2179 | result = my_data->dispatch_table.CreateFence(device, pCreateInfo, pAllocator, pFence); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2180 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2181 | validate_result(my_data->report_data, "vkCreateFence", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2182 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2183 | |
| 2184 | return result; |
| 2185 | } |
| 2186 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2187 | VKAPI_ATTR void VKAPI_CALL DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2188 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2189 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2190 | assert(my_data != NULL); |
| 2191 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2192 | skip |= parameter_validation_vkDestroyFence(my_data->report_data, fence, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2193 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2194 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2195 | my_data->dispatch_table.DestroyFence(device, fence, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2196 | } |
| 2197 | } |
| 2198 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2199 | VKAPI_ATTR VkResult VKAPI_CALL ResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2200 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2201 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2202 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2203 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2204 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2205 | skip |= parameter_validation_vkResetFences(my_data->report_data, fenceCount, pFences); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2206 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2207 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2208 | result = my_data->dispatch_table.ResetFences(device, fenceCount, pFences); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2209 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2210 | validate_result(my_data->report_data, "vkResetFences", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2211 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2212 | |
| 2213 | return result; |
| 2214 | } |
| 2215 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2216 | VKAPI_ATTR VkResult VKAPI_CALL GetFenceStatus(VkDevice device, VkFence fence) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2217 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2218 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2219 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2220 | assert(my_data != NULL); |
| 2221 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2222 | skip |= parameter_validation_vkGetFenceStatus(my_data->report_data, fence); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2223 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2224 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2225 | result = my_data->dispatch_table.GetFenceStatus(device, fence); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2226 | |
| 2227 | validate_result(my_data->report_data, "vkGetFenceStatus", result); |
| 2228 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2229 | |
| 2230 | return result; |
| 2231 | } |
| 2232 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2233 | VKAPI_ATTR VkResult VKAPI_CALL WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, |
| 2234 | uint64_t timeout) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2235 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2236 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2237 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2238 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2239 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2240 | skip |= parameter_validation_vkWaitForFences(my_data->report_data, fenceCount, pFences, waitAll, timeout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2241 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2242 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2243 | result = my_data->dispatch_table.WaitForFences(device, fenceCount, pFences, waitAll, timeout); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2244 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2245 | validate_result(my_data->report_data, "vkWaitForFences", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2246 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2247 | |
| 2248 | return result; |
| 2249 | } |
| 2250 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2251 | VKAPI_ATTR VkResult VKAPI_CALL CreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2252 | const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2253 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2254 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2255 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2256 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2257 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2258 | skip |= parameter_validation_vkCreateSemaphore(my_data->report_data, pCreateInfo, pAllocator, pSemaphore); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2259 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2260 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2261 | result = my_data->dispatch_table.CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2262 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2263 | validate_result(my_data->report_data, "vkCreateSemaphore", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2264 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2265 | |
| 2266 | return result; |
| 2267 | } |
| 2268 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2269 | VKAPI_ATTR void VKAPI_CALL DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2270 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2271 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2272 | assert(my_data != NULL); |
| 2273 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2274 | skip |= parameter_validation_vkDestroySemaphore(my_data->report_data, semaphore, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2275 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2276 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2277 | my_data->dispatch_table.DestroySemaphore(device, semaphore, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2278 | } |
| 2279 | } |
| 2280 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2281 | VKAPI_ATTR VkResult VKAPI_CALL CreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, |
| 2282 | const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2283 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2284 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2285 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2286 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2287 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2288 | skip |= parameter_validation_vkCreateEvent(my_data->report_data, pCreateInfo, pAllocator, pEvent); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2289 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2290 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2291 | result = my_data->dispatch_table.CreateEvent(device, pCreateInfo, pAllocator, pEvent); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2292 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2293 | validate_result(my_data->report_data, "vkCreateEvent", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2294 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2295 | |
| 2296 | return result; |
| 2297 | } |
| 2298 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2299 | VKAPI_ATTR void VKAPI_CALL DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2300 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2301 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2302 | assert(my_data != NULL); |
| 2303 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2304 | skip |= parameter_validation_vkDestroyEvent(my_data->report_data, event, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2305 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2306 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2307 | my_data->dispatch_table.DestroyEvent(device, event, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2308 | } |
| 2309 | } |
| 2310 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2311 | VKAPI_ATTR VkResult VKAPI_CALL GetEventStatus(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2312 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2313 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2314 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2315 | assert(my_data != NULL); |
| 2316 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2317 | skip |= parameter_validation_vkGetEventStatus(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2318 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2319 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2320 | result = my_data->dispatch_table.GetEventStatus(device, event); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2321 | |
| 2322 | validate_result(my_data->report_data, "vkGetEventStatus", result); |
| 2323 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2324 | |
| 2325 | return result; |
| 2326 | } |
| 2327 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2328 | VKAPI_ATTR VkResult VKAPI_CALL SetEvent(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2329 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2330 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2331 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2332 | assert(my_data != NULL); |
| 2333 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2334 | skip |= parameter_validation_vkSetEvent(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2335 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2336 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2337 | result = my_data->dispatch_table.SetEvent(device, event); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2338 | |
| 2339 | validate_result(my_data->report_data, "vkSetEvent", result); |
| 2340 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2341 | |
| 2342 | return result; |
| 2343 | } |
| 2344 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2345 | VKAPI_ATTR VkResult VKAPI_CALL ResetEvent(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2346 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2347 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2348 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2349 | assert(my_data != NULL); |
| 2350 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2351 | skip |= parameter_validation_vkResetEvent(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2352 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2353 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2354 | result = my_data->dispatch_table.ResetEvent(device, event); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2355 | |
| 2356 | validate_result(my_data->report_data, "vkResetEvent", result); |
| 2357 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2358 | |
| 2359 | return result; |
| 2360 | } |
| 2361 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2362 | VKAPI_ATTR VkResult VKAPI_CALL CreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2363 | const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2364 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2365 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2366 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2367 | assert(device_data != nullptr); |
| 2368 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2369 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2370 | skip |= parameter_validation_vkCreateQueryPool(device_data->report_data, pCreateInfo, pAllocator, pQueryPool); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2371 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2372 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2373 | if (pCreateInfo != nullptr) { |
| 2374 | // If queryType is VK_QUERY_TYPE_PIPELINE_STATISTICS, pipelineStatistics must be a valid combination of |
| 2375 | // VkQueryPipelineStatisticFlagBits values |
| 2376 | if ((pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS) && (pCreateInfo->pipelineStatistics != 0) && |
| 2377 | ((pCreateInfo->pipelineStatistics & (~AllVkQueryPipelineStatisticFlagBits)) != 0)) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 2378 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2379 | VALIDATION_ERROR_01007, LayerName, |
| 2380 | "vkCreateQueryPool(): if pCreateInfo->queryType is " |
| 2381 | "VK_QUERY_TYPE_PIPELINE_STATISTICS, pCreateInfo->pipelineStatistics must be " |
| 2382 | "a valid combination of VkQueryPipelineStatisticFlagBits values. %s", |
| 2383 | validation_error_map[VALIDATION_ERROR_01007]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2384 | } |
| 2385 | } |
| 2386 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2387 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2388 | result = device_data->dispatch_table.CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2389 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2390 | validate_result(report_data, "vkCreateQueryPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2391 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2392 | |
| 2393 | return result; |
| 2394 | } |
| 2395 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2396 | VKAPI_ATTR void VKAPI_CALL DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2397 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2398 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2399 | assert(my_data != NULL); |
| 2400 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2401 | skip |= parameter_validation_vkDestroyQueryPool(my_data->report_data, queryPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2402 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2403 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2404 | my_data->dispatch_table.DestroyQueryPool(device, queryPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2405 | } |
| 2406 | } |
| 2407 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2408 | VKAPI_ATTR VkResult VKAPI_CALL GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, |
| 2409 | size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2410 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2411 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2412 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2413 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2414 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2415 | skip |= parameter_validation_vkGetQueryPoolResults(my_data->report_data, queryPool, firstQuery, queryCount, dataSize, pData, |
| 2416 | stride, flags); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2417 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2418 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2419 | result = |
| 2420 | my_data->dispatch_table.GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2421 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2422 | validate_result(my_data->report_data, "vkGetQueryPoolResults", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2423 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2424 | |
| 2425 | return result; |
| 2426 | } |
| 2427 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2428 | VKAPI_ATTR VkResult VKAPI_CALL CreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, |
| 2429 | const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2430 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2431 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2432 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2433 | assert(device_data != nullptr); |
| 2434 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2435 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2436 | skip |= parameter_validation_vkCreateBuffer(report_data, pCreateInfo, pAllocator, pBuffer); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2437 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2438 | if (pCreateInfo != nullptr) { |
Maciej Jesionowski | 420b1c3 | 2016-12-14 11:01:21 +0100 | [diff] [blame] | 2439 | // Buffer size must be greater than 0 (error 00663) |
| 2440 | skip |= |
| 2441 | ValidateGreaterThan(report_data, "vkCreateBuffer", "pCreateInfo->size", static_cast<uint32_t>(pCreateInfo->size), 0u); |
| 2442 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2443 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2444 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 2445 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 2446 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2447 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2448 | VALIDATION_ERROR_00665, LayerName, |
| 2449 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2450 | "pCreateInfo->queueFamilyIndexCount must be greater than 1. %s", |
| 2451 | validation_error_map[VALIDATION_ERROR_00665]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2452 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2453 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2454 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 2455 | // queueFamilyIndexCount uint32_t values |
| 2456 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2457 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2458 | VALIDATION_ERROR_00664, LayerName, |
| 2459 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2460 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
| 2461 | "pCreateInfo->queueFamilyIndexCount uint32_t values. %s", |
| 2462 | validation_error_map[VALIDATION_ERROR_00664]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2463 | } |
| 2464 | |
| 2465 | // Ensure that the queue family indices were specified at device creation |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2466 | skip |= validate_queue_family_indices(device_data, "vkCreateBuffer", "pCreateInfo->pQueueFamilyIndices", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2467 | pCreateInfo->queueFamilyIndexCount, pCreateInfo->pQueueFamilyIndices); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2468 | } |
Maciej Jesionowski | 420b1c3 | 2016-12-14 11:01:21 +0100 | [diff] [blame] | 2469 | |
| 2470 | // If flags contains VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT or VK_BUFFER_CREATE_SPARSE_ALIASED_BIT, it must also contain |
| 2471 | // VK_BUFFER_CREATE_SPARSE_BINDING_BIT |
| 2472 | if (((pCreateInfo->flags & (VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT)) != 0) && |
| 2473 | ((pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) != VK_BUFFER_CREATE_SPARSE_BINDING_BIT)) { |
Mark Lobodzinski | 181ec3a | 2016-12-14 13:37:04 -0700 | [diff] [blame] | 2474 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2475 | VALIDATION_ERROR_00669, LayerName, |
| 2476 | "vkCreateBuffer: if pCreateInfo->flags contains VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT or " |
| 2477 | "VK_BUFFER_CREATE_SPARSE_ALIASED_BIT, it must also contain VK_BUFFER_CREATE_SPARSE_BINDING_BIT. %s", |
| 2478 | validation_error_map[VALIDATION_ERROR_00669]); |
Maciej Jesionowski | 420b1c3 | 2016-12-14 11:01:21 +0100 | [diff] [blame] | 2479 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2480 | } |
| 2481 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2482 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2483 | result = device_data->dispatch_table.CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2484 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2485 | validate_result(report_data, "vkCreateBuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2486 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2487 | |
| 2488 | return result; |
| 2489 | } |
| 2490 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2491 | VKAPI_ATTR void VKAPI_CALL DestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2492 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2493 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2494 | assert(my_data != NULL); |
| 2495 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2496 | skip |= parameter_validation_vkDestroyBuffer(my_data->report_data, buffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2497 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2498 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2499 | my_data->dispatch_table.DestroyBuffer(device, buffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2500 | } |
| 2501 | } |
| 2502 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2503 | VKAPI_ATTR VkResult VKAPI_CALL CreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, |
| 2504 | const VkAllocationCallbacks *pAllocator, VkBufferView *pView) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2505 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2506 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2507 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2508 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2509 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2510 | skip |= parameter_validation_vkCreateBufferView(my_data->report_data, pCreateInfo, pAllocator, pView); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2511 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2512 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2513 | result = my_data->dispatch_table.CreateBufferView(device, pCreateInfo, pAllocator, pView); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2514 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2515 | validate_result(my_data->report_data, "vkCreateBufferView", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2516 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2517 | |
| 2518 | return result; |
| 2519 | } |
| 2520 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2521 | VKAPI_ATTR void VKAPI_CALL DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2522 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2523 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2524 | assert(my_data != NULL); |
| 2525 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2526 | skip |= parameter_validation_vkDestroyBufferView(my_data->report_data, bufferView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2527 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2528 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2529 | my_data->dispatch_table.DestroyBufferView(device, bufferView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2530 | } |
| 2531 | } |
| 2532 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2533 | VKAPI_ATTR VkResult VKAPI_CALL CreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, |
| 2534 | const VkAllocationCallbacks *pAllocator, VkImage *pImage) { |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2535 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2536 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2537 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2538 | assert(device_data != nullptr); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2539 | debug_report_data *report_data = device_data->report_data; |
| 2540 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2541 | skip |= parameter_validation_vkCreateImage(report_data, pCreateInfo, pAllocator, pImage); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2542 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2543 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | 7d9ef88 | 2017-03-01 16:15:02 -0700 | [diff] [blame] | 2544 | |
| 2545 | if ((device_data->physical_device_features.textureCompressionETC2 == false) && |
Dave Houlton | 1d2022c | 2017-03-29 11:43:58 -0600 | [diff] [blame] | 2546 | FormatIsCompressed_ETC2_EAC(pCreateInfo->format)) { |
Mark Lobodzinski | 7d9ef88 | 2017-03-01 16:15:02 -0700 | [diff] [blame] | 2547 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2548 | DEVICE_FEATURE, LayerName, |
| 2549 | "vkCreateImage(): Attempting to create VkImage with format %s. The textureCompressionETC2 feature is " |
| 2550 | "not enabled: neither ETC2 nor EAC formats can be used to create images.", |
| 2551 | string_VkFormat(pCreateInfo->format)); |
| 2552 | } |
| 2553 | |
Mark Lobodzinski | 846c214 | 2017-03-01 16:17:39 -0700 | [diff] [blame] | 2554 | if ((device_data->physical_device_features.textureCompressionASTC_LDR == false) && |
Dave Houlton | 1d2022c | 2017-03-29 11:43:58 -0600 | [diff] [blame] | 2555 | FormatIsCompressed_ASTC_LDR(pCreateInfo->format)) { |
Mark Lobodzinski | 846c214 | 2017-03-01 16:17:39 -0700 | [diff] [blame] | 2556 | skip |= |
| 2557 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2558 | DEVICE_FEATURE, LayerName, |
| 2559 | "vkCreateImage(): Attempting to create VkImage with format %s. The textureCompressionASTC_LDR feature is " |
| 2560 | "not enabled: ASTC formats cannot be used to create images.", |
| 2561 | string_VkFormat(pCreateInfo->format)); |
| 2562 | } |
| 2563 | |
Mark Lobodzinski | 64f374e | 2017-03-01 16:19:36 -0700 | [diff] [blame] | 2564 | if ((device_data->physical_device_features.textureCompressionBC == false) && |
Dave Houlton | 1d2022c | 2017-03-29 11:43:58 -0600 | [diff] [blame] | 2565 | FormatIsCompressed_BC(pCreateInfo->format)) { |
Mark Lobodzinski | 64f374e | 2017-03-01 16:19:36 -0700 | [diff] [blame] | 2566 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2567 | DEVICE_FEATURE, LayerName, |
| 2568 | "vkCreateImage(): Attempting to create VkImage with format %s. The textureCompressionBC feature is " |
| 2569 | "not enabled: BC compressed formats cannot be used to create images.", |
| 2570 | string_VkFormat(pCreateInfo->format)); |
| 2571 | } |
| 2572 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2573 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 2574 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2575 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 2576 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 2577 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2578 | VALIDATION_ERROR_00714, LayerName, |
| 2579 | "vkCreateImage(): if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2580 | "pCreateInfo->queueFamilyIndexCount must be greater than 1. %s", |
| 2581 | validation_error_map[VALIDATION_ERROR_00714]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2582 | } |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2583 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2584 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 2585 | // queueFamilyIndexCount uint32_t values |
| 2586 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 2587 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2588 | VALIDATION_ERROR_00713, LayerName, |
| 2589 | "vkCreateImage(): if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2590 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
| 2591 | "pCreateInfo->queueFamilyIndexCount uint32_t values. %s", |
| 2592 | validation_error_map[VALIDATION_ERROR_00713]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2593 | } |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2594 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2595 | skip |= validate_queue_family_indices(device_data, "vkCreateImage", "pCreateInfo->pQueueFamilyIndices", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2596 | pCreateInfo->queueFamilyIndexCount, pCreateInfo->pQueueFamilyIndices); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2597 | } |
| 2598 | |
| 2599 | // width, height, and depth members of extent must be greater than 0 |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2600 | skip |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.width", pCreateInfo->extent.width, 0u); |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2601 | skip |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.height", pCreateInfo->extent.height, 0u); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2602 | skip |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.depth", pCreateInfo->extent.depth, 0u); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2603 | |
| 2604 | // mipLevels must be greater than 0 |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2605 | skip |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->mipLevels", pCreateInfo->mipLevels, 0u); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2606 | |
| 2607 | // arrayLayers must be greater than 0 |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2608 | skip |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->arrayLayers", pCreateInfo->arrayLayers, 0u); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2609 | |
| 2610 | // If imageType is VK_IMAGE_TYPE_1D, both extent.height and extent.depth must be 1 |
| 2611 | if ((pCreateInfo->imageType == VK_IMAGE_TYPE_1D) && (pCreateInfo->extent.height != 1) && (pCreateInfo->extent.depth != 1)) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2612 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 2613 | VALIDATION_ERROR_02129, LayerName, |
| 2614 | "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_1D, both " |
| 2615 | "pCreateInfo->extent.height and pCreateInfo->extent.depth must be 1. %s", |
| 2616 | validation_error_map[VALIDATION_ERROR_02129]); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2617 | } |
| 2618 | |
| 2619 | if (pCreateInfo->imageType == VK_IMAGE_TYPE_2D) { |
| 2620 | // If imageType is VK_IMAGE_TYPE_2D and flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, extent.width and |
| 2621 | // extent.height must be equal |
| 2622 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) && |
| 2623 | (pCreateInfo->extent.width != pCreateInfo->extent.height)) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 2624 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 2625 | VALIDATION_ERROR_02127, LayerName, |
| 2626 | "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_2D and " |
| 2627 | "pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, " |
| 2628 | "pCreateInfo->extent.width and pCreateInfo->extent.height must be equal. %s", |
| 2629 | validation_error_map[VALIDATION_ERROR_02127]); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2630 | } |
| 2631 | |
| 2632 | if (pCreateInfo->extent.depth != 1) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 2633 | skip |= log_msg( |
| 2634 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, VALIDATION_ERROR_02130, |
| 2635 | LayerName, |
| 2636 | "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_2D, pCreateInfo->extent.depth must be 1. %s", |
| 2637 | validation_error_map[VALIDATION_ERROR_02130]); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2638 | } |
| 2639 | } |
| 2640 | |
| 2641 | // mipLevels must be less than or equal to floor(log2(max(extent.width,extent.height,extent.depth)))+1 |
| 2642 | uint32_t maxDim = std::max(std::max(pCreateInfo->extent.width, pCreateInfo->extent.height), pCreateInfo->extent.depth); |
| 2643 | if (pCreateInfo->mipLevels > (floor(log2(maxDim)) + 1)) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2644 | skip |= |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 2645 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 2646 | VALIDATION_ERROR_02131, LayerName, |
Mike Weiblen | fa0fd07 | 2017-01-06 16:20:51 -0700 | [diff] [blame] | 2647 | "vkCreateImage(): pCreateInfo->mipLevels must be less than or equal to " |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 2648 | "floor(log2(max(pCreateInfo->extent.width, pCreateInfo->extent.height, pCreateInfo->extent.depth)))+1. %s", |
| 2649 | validation_error_map[VALIDATION_ERROR_02131]); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2650 | } |
| 2651 | |
| 2652 | // If flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, it must also contain |
| 2653 | // VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
| 2654 | if (((pCreateInfo->flags & (VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT)) != 0) && |
| 2655 | ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) != VK_IMAGE_CREATE_SPARSE_BINDING_BIT)) { |
Mark Lobodzinski | 181ec3a | 2016-12-14 13:37:04 -0700 | [diff] [blame] | 2656 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 2657 | VALIDATION_ERROR_02160, LayerName, |
| 2658 | "vkCreateImage: if pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or " |
| 2659 | "VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, it must also contain VK_IMAGE_CREATE_SPARSE_BINDING_BIT. %s", |
| 2660 | validation_error_map[VALIDATION_ERROR_02160]); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2661 | } |
Dave Houlton | 7e679e2 | 2017-01-23 16:37:04 -0700 | [diff] [blame] | 2662 | |
| 2663 | // Check for combinations of attributes that are incompatible with having VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT set |
| 2664 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) != 0) { |
| 2665 | // Linear tiling is unsupported |
| 2666 | if (VK_IMAGE_TILING_LINEAR == pCreateInfo->tiling) { |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 2667 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 2668 | INVALID_USAGE, LayerName, |
| 2669 | "vkCreateImage: if pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT " |
| 2670 | "then image tiling of VK_IMAGE_TILING_LINEAR is not supported"); |
Dave Houlton | 7e679e2 | 2017-01-23 16:37:04 -0700 | [diff] [blame] | 2671 | } |
| 2672 | |
| 2673 | // Sparse 1D image isn't valid |
| 2674 | if (VK_IMAGE_TYPE_1D == pCreateInfo->imageType) { |
| 2675 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 2676 | VALIDATION_ERROR_02352, LayerName, |
| 2677 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 1D image. %s", |
| 2678 | validation_error_map[VALIDATION_ERROR_02352]); |
Dave Houlton | 7e679e2 | 2017-01-23 16:37:04 -0700 | [diff] [blame] | 2679 | } |
| 2680 | |
Dave Houlton | 7e679e2 | 2017-01-23 16:37:04 -0700 | [diff] [blame] | 2681 | // Sparse 2D image when device doesn't support it |
| 2682 | if ((VK_FALSE == device_data->physical_device_features.sparseResidencyImage2D) && |
| 2683 | (VK_IMAGE_TYPE_2D == pCreateInfo->imageType)) { |
| 2684 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 2685 | VALIDATION_ERROR_02144, LayerName, |
| 2686 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 2D image if corresponding " |
| 2687 | "feature is not enabled on the device. %s", |
| 2688 | validation_error_map[VALIDATION_ERROR_02144]); |
| 2689 | } |
| 2690 | |
| 2691 | // Sparse 3D image when device doesn't support it |
| 2692 | if ((VK_FALSE == device_data->physical_device_features.sparseResidencyImage3D) && |
| 2693 | (VK_IMAGE_TYPE_3D == pCreateInfo->imageType)) { |
| 2694 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 2695 | VALIDATION_ERROR_02145, LayerName, |
| 2696 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 3D image if corresponding " |
| 2697 | "feature is not enabled on the device. %s", |
| 2698 | validation_error_map[VALIDATION_ERROR_02145]); |
| 2699 | } |
| 2700 | |
| 2701 | // Multi-sample 2D image when device doesn't support it |
| 2702 | if (VK_IMAGE_TYPE_2D == pCreateInfo->imageType) { |
| 2703 | if ((VK_FALSE == device_data->physical_device_features.sparseResidency2Samples) && |
| 2704 | (VK_SAMPLE_COUNT_2_BIT == pCreateInfo->samples)) { |
| 2705 | skip |= log_msg( |
| 2706 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 2707 | VALIDATION_ERROR_02146, LayerName, |
| 2708 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 2-sample image if corresponding " |
| 2709 | "feature is not enabled on the device. %s", |
| 2710 | validation_error_map[VALIDATION_ERROR_02146]); |
| 2711 | } else if ((VK_FALSE == device_data->physical_device_features.sparseResidency4Samples) && |
| 2712 | (VK_SAMPLE_COUNT_4_BIT == pCreateInfo->samples)) { |
| 2713 | skip |= log_msg( |
| 2714 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 2715 | VALIDATION_ERROR_02147, LayerName, |
| 2716 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 4-sample image if corresponding " |
| 2717 | "feature is not enabled on the device. %s", |
| 2718 | validation_error_map[VALIDATION_ERROR_02147]); |
| 2719 | } else if ((VK_FALSE == device_data->physical_device_features.sparseResidency8Samples) && |
| 2720 | (VK_SAMPLE_COUNT_8_BIT == pCreateInfo->samples)) { |
| 2721 | skip |= log_msg( |
| 2722 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 2723 | VALIDATION_ERROR_02148, LayerName, |
| 2724 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 8-sample image if corresponding " |
| 2725 | "feature is not enabled on the device. %s", |
| 2726 | validation_error_map[VALIDATION_ERROR_02148]); |
| 2727 | } else if ((VK_FALSE == device_data->physical_device_features.sparseResidency16Samples) && |
| 2728 | (VK_SAMPLE_COUNT_16_BIT == pCreateInfo->samples)) { |
| 2729 | skip |= log_msg( |
| 2730 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 2731 | VALIDATION_ERROR_02149, LayerName, |
| 2732 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 16-sample image if corresponding " |
| 2733 | "feature is not enabled on the device. %s", |
| 2734 | validation_error_map[VALIDATION_ERROR_02149]); |
| 2735 | } |
| 2736 | } |
| 2737 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2738 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2739 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2740 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2741 | result = device_data->dispatch_table.CreateImage(device, pCreateInfo, pAllocator, pImage); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2742 | |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2743 | validate_result(report_data, "vkCreateImage", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2744 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2745 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 2746 | return result; |
| 2747 | } |
| 2748 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2749 | VKAPI_ATTR void VKAPI_CALL DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2750 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2751 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2752 | assert(my_data != NULL); |
| 2753 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2754 | skip |= parameter_validation_vkDestroyImage(my_data->report_data, image, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2755 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2756 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2757 | my_data->dispatch_table.DestroyImage(device, image, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2758 | } |
| 2759 | } |
| 2760 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 2761 | static bool PreGetImageSubresourceLayout(VkDevice device, const VkImageSubresource *pSubresource) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2762 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2763 | if (pSubresource != nullptr) { |
| 2764 | if ((pSubresource->aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 2765 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 2766 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2767 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2768 | "vkGetImageSubresourceLayout parameter, VkImageAspect pSubresource->aspectMask, is an unrecognized enumerator"); |
| 2769 | return false; |
| 2770 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2771 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2772 | |
| 2773 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2774 | } |
| 2775 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2776 | VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, |
| 2777 | VkSubresourceLayout *pLayout) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2778 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2779 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2780 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2781 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2782 | skip |= parameter_validation_vkGetImageSubresourceLayout(my_data->report_data, image, pSubresource, pLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2783 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2784 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2785 | PreGetImageSubresourceLayout(device, pSubresource); |
| 2786 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2787 | my_data->dispatch_table.GetImageSubresourceLayout(device, image, pSubresource, pLayout); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2788 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2789 | } |
| 2790 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2791 | VKAPI_ATTR VkResult VKAPI_CALL CreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, |
| 2792 | const VkAllocationCallbacks *pAllocator, VkImageView *pView) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2793 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2794 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2795 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2796 | assert(my_data != NULL); |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2797 | debug_report_data *report_data = my_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2798 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2799 | skip |= parameter_validation_vkCreateImageView(report_data, pCreateInfo, pAllocator, pView); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2800 | |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2801 | if (pCreateInfo != nullptr) { |
| 2802 | if ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D) || (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_2D)) { |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2803 | if ((pCreateInfo->subresourceRange.layerCount != 1) && |
| 2804 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2805 | skip |= |
| 2806 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 2807 | "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_%dD, " |
| 2808 | "pCreateInfo->subresourceRange.layerCount must be 1", |
| 2809 | ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D) ? 1 : 2)); |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2810 | } |
| 2811 | } else if ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY) || |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2812 | (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_2D_ARRAY)) { |
| 2813 | if ((pCreateInfo->subresourceRange.layerCount < 1) && |
| 2814 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2815 | skip |= |
| 2816 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 2817 | "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_%dD_ARRAY, " |
| 2818 | "pCreateInfo->subresourceRange.layerCount must be >= 1", |
| 2819 | ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY) ? 1 : 2)); |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2820 | } |
| 2821 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE) { |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2822 | if ((pCreateInfo->subresourceRange.layerCount != 6) && |
| 2823 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2824 | skip |= |
| 2825 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 2826 | "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_CUBE, " |
| 2827 | "pCreateInfo->subresourceRange.layerCount must be 6"); |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2828 | } |
| 2829 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY) { |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2830 | if (((pCreateInfo->subresourceRange.layerCount == 0) || ((pCreateInfo->subresourceRange.layerCount % 6) != 0)) && |
| 2831 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2832 | skip |= |
| 2833 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 2834 | "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_CUBE_ARRAY, " |
| 2835 | "pCreateInfo->subresourceRange.layerCount must be a multiple of 6"); |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2836 | } |
Mark Lobodzinski | 3d7e6b5 | 2017-02-28 13:45:20 -0700 | [diff] [blame] | 2837 | if (!my_data->physical_device_features.imageCubeArray) { |
| 2838 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2839 | LayerName, "vkCreateImageView: Device feature imageCubeArray not enabled."); |
| 2840 | } |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2841 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_3D) { |
| 2842 | if (pCreateInfo->subresourceRange.baseArrayLayer != 0) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2843 | skip |= |
| 2844 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 2845 | "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_3D, " |
| 2846 | "pCreateInfo->subresourceRange.baseArrayLayer must be 0"); |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2847 | } |
| 2848 | |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2849 | if ((pCreateInfo->subresourceRange.layerCount != 1) && |
| 2850 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2851 | skip |= |
| 2852 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 2853 | "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_3D, " |
| 2854 | "pCreateInfo->subresourceRange.layerCount must be 1"); |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2855 | } |
| 2856 | } |
| 2857 | } |
| 2858 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2859 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2860 | result = my_data->dispatch_table.CreateImageView(device, pCreateInfo, pAllocator, pView); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2861 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2862 | validate_result(my_data->report_data, "vkCreateImageView", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2863 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2864 | |
| 2865 | return result; |
| 2866 | } |
| 2867 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2868 | VKAPI_ATTR void VKAPI_CALL DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2869 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2870 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2871 | assert(my_data != NULL); |
| 2872 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2873 | skip |= parameter_validation_vkDestroyImageView(my_data->report_data, imageView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2874 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2875 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2876 | my_data->dispatch_table.DestroyImageView(device, imageView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2877 | } |
| 2878 | } |
| 2879 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2880 | VKAPI_ATTR VkResult VKAPI_CALL CreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2881 | const VkAllocationCallbacks *pAllocator, VkShaderModule *pShaderModule) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2882 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2883 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2884 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2885 | assert(my_data != NULL); |
| 2886 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2887 | skip |= parameter_validation_vkCreateShaderModule(my_data->report_data, pCreateInfo, pAllocator, pShaderModule); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2888 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2889 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2890 | result = my_data->dispatch_table.CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2891 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2892 | validate_result(my_data->report_data, "vkCreateShaderModule", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2893 | } |
| 2894 | |
Michael Lentine | 03d8e57 | 2015-09-15 14:59:14 -0500 | [diff] [blame] | 2895 | return result; |
| 2896 | } |
| 2897 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2898 | VKAPI_ATTR void VKAPI_CALL DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, |
| 2899 | const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2900 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2901 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2902 | assert(my_data != NULL); |
| 2903 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2904 | skip |= parameter_validation_vkDestroyShaderModule(my_data->report_data, shaderModule, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2905 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2906 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2907 | my_data->dispatch_table.DestroyShaderModule(device, shaderModule, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2908 | } |
| 2909 | } |
| 2910 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2911 | VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2912 | const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2913 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2914 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2915 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2916 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2917 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2918 | skip |= parameter_validation_vkCreatePipelineCache(my_data->report_data, pCreateInfo, pAllocator, pPipelineCache); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2919 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2920 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2921 | result = my_data->dispatch_table.CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2922 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2923 | validate_result(my_data->report_data, "vkCreatePipelineCache", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2924 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2925 | |
| 2926 | return result; |
| 2927 | } |
| 2928 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2929 | VKAPI_ATTR void VKAPI_CALL DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, |
| 2930 | const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2931 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2932 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2933 | assert(my_data != NULL); |
| 2934 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2935 | skip |= parameter_validation_vkDestroyPipelineCache(my_data->report_data, pipelineCache, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2936 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2937 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2938 | my_data->dispatch_table.DestroyPipelineCache(device, pipelineCache, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2939 | } |
| 2940 | } |
| 2941 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2942 | VKAPI_ATTR VkResult VKAPI_CALL GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, |
| 2943 | void *pData) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2944 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2945 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2946 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2947 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2948 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2949 | skip |= parameter_validation_vkGetPipelineCacheData(my_data->report_data, pipelineCache, pDataSize, pData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2950 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2951 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2952 | result = my_data->dispatch_table.GetPipelineCacheData(device, pipelineCache, pDataSize, pData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2953 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2954 | validate_result(my_data->report_data, "vkGetPipelineCacheData", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2955 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2956 | |
| 2957 | return result; |
| 2958 | } |
| 2959 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2960 | VKAPI_ATTR VkResult VKAPI_CALL MergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, |
| 2961 | const VkPipelineCache *pSrcCaches) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2962 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2963 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2964 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2965 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2966 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2967 | skip |= parameter_validation_vkMergePipelineCaches(my_data->report_data, dstCache, srcCacheCount, pSrcCaches); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2968 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 2969 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 2970 | result = my_data->dispatch_table.MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2971 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2972 | validate_result(my_data->report_data, "vkMergePipelineCaches", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2973 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2974 | |
| 2975 | return result; |
| 2976 | } |
| 2977 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 2978 | static bool PreCreateGraphicsPipelines(VkDevice device, const VkGraphicsPipelineCreateInfo *pCreateInfos) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 2979 | layer_data *data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 2980 | bool skip = false; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 2981 | |
| 2982 | // TODO: Handle count |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2983 | if (pCreateInfos != nullptr) { |
Maks Naumov | 34f52a1 | 2016-12-28 01:15:17 +0200 | [diff] [blame] | 2984 | if (pCreateInfos->flags & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2985 | if (pCreateInfos->basePipelineIndex != -1) { |
| 2986 | if (pCreateInfos->basePipelineHandle != VK_NULL_HANDLE) { |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 2987 | skip |= log_msg( |
| 2988 | data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2989 | VALIDATION_ERROR_00526, LayerName, |
| 2990 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineHandle, must be VK_NULL_HANDLE if " |
| 2991 | "pCreateInfos->flags " |
| 2992 | "contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and pCreateInfos->basePipelineIndex is not -1. %s", |
| 2993 | validation_error_map[VALIDATION_ERROR_00526]); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2994 | } |
| 2995 | } |
| 2996 | |
| 2997 | if (pCreateInfos->basePipelineHandle != VK_NULL_HANDLE) { |
| 2998 | if (pCreateInfos->basePipelineIndex != -1) { |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 2999 | skip |= log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 3000 | data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mike Weiblen | 9858d96 | 2016-10-31 23:59:10 -0600 | [diff] [blame] | 3001 | VALIDATION_ERROR_00528, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3002 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineIndex, must be -1 if pCreateInfos->flags " |
| 3003 | "contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and pCreateInfos->basePipelineHandle is not " |
Mike Weiblen | 9858d96 | 2016-10-31 23:59:10 -0600 | [diff] [blame] | 3004 | "VK_NULL_HANDLE. %s", |
| 3005 | validation_error_map[VALIDATION_ERROR_00528]); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3006 | } |
Jeremy Hayes | 2fdaaf2 | 2016-03-01 17:51:54 -0700 | [diff] [blame] | 3007 | } |
| 3008 | } |
| 3009 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3010 | if (pCreateInfos->pRasterizationState != nullptr) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3011 | if (pCreateInfos->pRasterizationState->cullMode & ~VK_CULL_MODE_FRONT_AND_BACK) { |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 3012 | skip |= |
| 3013 | log_msg(data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3014 | UNRECOGNIZED_VALUE, LayerName, |
| 3015 | "vkCreateGraphicsPipelines parameter, VkCullMode pCreateInfos->pRasterizationState->cullMode, is an " |
| 3016 | "unrecognized enumerator"); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3017 | } |
Mark Lobodzinski | 2e67fdb | 2016-08-09 13:10:51 -0600 | [diff] [blame] | 3018 | |
| 3019 | if ((pCreateInfos->pRasterizationState->polygonMode != VK_POLYGON_MODE_FILL) && |
| 3020 | (data->physical_device_features.fillModeNonSolid == false)) { |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 3021 | skip |= log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 3022 | data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | 2e67fdb | 2016-08-09 13:10:51 -0600 | [diff] [blame] | 3023 | DEVICE_FEATURE, LayerName, |
| 3024 | "vkCreateGraphicsPipelines parameter, VkPolygonMode pCreateInfos->pRasterizationState->polygonMode cannot be " |
| 3025 | "VK_POLYGON_MODE_POINT or VK_POLYGON_MODE_LINE if VkPhysicalDeviceFeatures->fillModeNonSolid is false."); |
Mark Lobodzinski | 2e67fdb | 2016-08-09 13:10:51 -0600 | [diff] [blame] | 3026 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3027 | } |
Jeremy Hayes | 2fdaaf2 | 2016-03-01 17:51:54 -0700 | [diff] [blame] | 3028 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3029 | size_t i = 0; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3030 | for (size_t j = 0; j < pCreateInfos[i].stageCount; j++) { |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 3031 | skip |= validate_string(data->report_data, "vkCreateGraphicsPipelines", |
| 3032 | ParameterName("pCreateInfos[%i].pStages[%i].pName", ParameterName::IndexVector{i, j}), |
| 3033 | pCreateInfos[i].pStages[j].pName); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3034 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3035 | } |
| 3036 | |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 3037 | return skip; |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3038 | } |
| 3039 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3040 | VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 3041 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
| 3042 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3043 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3044 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3045 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3046 | assert(device_data != nullptr); |
| 3047 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3048 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3049 | skip |= parameter_validation_vkCreateGraphicsPipelines(report_data, pipelineCache, createInfoCount, pCreateInfos, pAllocator, |
| 3050 | pPipelines); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3051 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3052 | if (pCreateInfos != nullptr) { |
| 3053 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
| 3054 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3055 | if (pCreateInfos[i].pTessellationState == nullptr) { |
| 3056 | if (pCreateInfos[i].pStages != nullptr) { |
| 3057 | // If pStages includes a tessellation control shader stage and a tessellation evaluation shader stage, |
| 3058 | // pTessellationState must not be NULL |
| 3059 | bool has_control = false; |
| 3060 | bool has_eval = false; |
| 3061 | |
| 3062 | for (uint32_t stage_index = 0; stage_index < pCreateInfos[i].stageCount; ++stage_index) { |
| 3063 | if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { |
| 3064 | has_control = true; |
| 3065 | } else if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { |
| 3066 | has_eval = true; |
| 3067 | } |
| 3068 | } |
| 3069 | |
| 3070 | if (has_control && has_eval) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3071 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mike Weiblen | 9858d96 | 2016-10-31 23:59:10 -0600 | [diff] [blame] | 3072 | __LINE__, VALIDATION_ERROR_00536, LayerName, |
| 3073 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pStages includes a tessellation " |
| 3074 | "control shader stage and a tessellation evaluation shader stage, " |
| 3075 | "pCreateInfos[%d].pTessellationState must not be NULL. %s", |
| 3076 | i, i, validation_error_map[VALIDATION_ERROR_00536]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3077 | } |
| 3078 | } |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3079 | } else { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3080 | skip |= validate_struct_pnext( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3081 | report_data, "vkCreateGraphicsPipelines", |
| 3082 | ParameterName("pCreateInfos[%i].pTessellationState->pNext", ParameterName::IndexVector{i}), NULL, |
| 3083 | pCreateInfos[i].pTessellationState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3084 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3085 | skip |= validate_reserved_flags( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3086 | report_data, "vkCreateGraphicsPipelines", |
| 3087 | ParameterName("pCreateInfos[%i].pTessellationState->flags", ParameterName::IndexVector{i}), |
| 3088 | pCreateInfos[i].pTessellationState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3089 | |
| 3090 | if (pCreateInfos[i].pTessellationState->sType != VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3091 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mike Weiblen | 9858d96 | 2016-10-31 23:59:10 -0600 | [diff] [blame] | 3092 | __LINE__, VALIDATION_ERROR_00538, LayerName, |
| 3093 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pTessellationState->sType must be " |
| 3094 | "VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO. %s", |
| 3095 | i, validation_error_map[VALIDATION_ERROR_00538]); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3096 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3097 | } |
| 3098 | |
| 3099 | if (pCreateInfos[i].pViewportState == nullptr) { |
| 3100 | // If the rasterizerDiscardEnable member of pRasterizationState is VK_FALSE, pViewportState must be a pointer to a |
| 3101 | // valid VkPipelineViewportStateCreateInfo structure |
| 3102 | if ((pCreateInfos[i].pRasterizationState != nullptr) && |
| 3103 | (pCreateInfos[i].pRasterizationState->rasterizerDiscardEnable == VK_FALSE)) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3104 | skip |= log_msg( |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3105 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mike Weiblen | 9858d96 | 2016-10-31 23:59:10 -0600 | [diff] [blame] | 3106 | VALIDATION_ERROR_02113, LayerName, |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3107 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pRasterizationState->rasterizerDiscardEnable is VK_FALSE, " |
Mike Weiblen | 9858d96 | 2016-10-31 23:59:10 -0600 | [diff] [blame] | 3108 | "pCreateInfos[%d].pViewportState must be a pointer to a valid VkPipelineViewportStateCreateInfo structure. " |
| 3109 | "%s", |
| 3110 | i, i, validation_error_map[VALIDATION_ERROR_02113]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3111 | } |
| 3112 | } else { |
Mark Lobodzinski | b81000e | 2016-12-16 13:08:00 -0700 | [diff] [blame] | 3113 | if (pCreateInfos[i].pViewportState->scissorCount != pCreateInfos[i].pViewportState->viewportCount) { |
| 3114 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
| 3115 | VALIDATION_ERROR_01434, LayerName, |
| 3116 | "Graphics Pipeline viewport count (%u) must match scissor count (%u). %s", |
| 3117 | pCreateInfos[i].pViewportState->viewportCount, pCreateInfos[i].pViewportState->scissorCount, |
| 3118 | validation_error_map[VALIDATION_ERROR_01434]); |
| 3119 | } |
| 3120 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3121 | skip |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3122 | validate_struct_pnext(report_data, "vkCreateGraphicsPipelines", |
| 3123 | ParameterName("pCreateInfos[%i].pViewportState->pNext", ParameterName::IndexVector{i}), |
| 3124 | NULL, pCreateInfos[i].pViewportState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3125 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3126 | skip |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3127 | validate_reserved_flags(report_data, "vkCreateGraphicsPipelines", |
| 3128 | ParameterName("pCreateInfos[%i].pViewportState->flags", ParameterName::IndexVector{i}), |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3129 | pCreateInfos[i].pViewportState->flags); |
| 3130 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3131 | if (pCreateInfos[i].pViewportState->sType != VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3132 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3133 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 3134 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pViewportState->sType must be " |
| 3135 | "VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO", |
| 3136 | i); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3137 | } |
| 3138 | |
Mark Lobodzinski | d40eeb1 | 2016-12-18 09:43:01 -0700 | [diff] [blame] | 3139 | if (device_data->physical_device_features.multiViewport == false) { |
| 3140 | if (pCreateInfos[i].pViewportState->viewportCount != 1) { |
| 3141 | skip |= |
| 3142 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3143 | __LINE__, VALIDATION_ERROR_01430, LayerName, |
| 3144 | "vkCreateGraphicsPipelines: The multiViewport feature is not enabled, so " |
| 3145 | "pCreateInfos[%d].pViewportState->viewportCount must be 1 but is %d. %s", |
| 3146 | i, pCreateInfos[i].pViewportState->viewportCount, validation_error_map[VALIDATION_ERROR_01430]); |
| 3147 | } |
| 3148 | if (pCreateInfos[i].pViewportState->scissorCount != 1) { |
| 3149 | skip |= |
| 3150 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3151 | __LINE__, VALIDATION_ERROR_01431, LayerName, |
| 3152 | "vkCreateGraphicsPipelines: The multiViewport feature is not enabled, so " |
| 3153 | "pCreateInfos[%d].pViewportState->scissorCount must be 1 but is %d. %s", |
| 3154 | i, pCreateInfos[i].pViewportState->scissorCount, validation_error_map[VALIDATION_ERROR_01431]); |
| 3155 | } |
| 3156 | } else { |
| 3157 | if ((pCreateInfos[i].pViewportState->viewportCount < 1) || |
| 3158 | (pCreateInfos[i].pViewportState->viewportCount > device_data->device_limits.maxViewports)) { |
| 3159 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3160 | __LINE__, VALIDATION_ERROR_01432, LayerName, |
| 3161 | "vkCreateGraphicsPipelines: multiViewport feature is enabled; " |
| 3162 | "pCreateInfos[%d].pViewportState->viewportCount is %d but must be between 1 and " |
| 3163 | "maxViewports (%d), inclusive. %s", |
| 3164 | i, pCreateInfos[i].pViewportState->viewportCount, device_data->device_limits.maxViewports, |
| 3165 | validation_error_map[VALIDATION_ERROR_01432]); |
| 3166 | } |
| 3167 | if ((pCreateInfos[i].pViewportState->scissorCount < 1) || |
| 3168 | (pCreateInfos[i].pViewportState->scissorCount > device_data->device_limits.maxViewports)) { |
| 3169 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3170 | __LINE__, VALIDATION_ERROR_01433, LayerName, |
| 3171 | "vkCreateGraphicsPipelines: multiViewport feature is enabled; " |
| 3172 | "pCreateInfos[%d].pViewportState->scissorCount is %d but must be between 1 and " |
| 3173 | "maxViewports (%d), inclusive. %s", |
| 3174 | i, pCreateInfos[i].pViewportState->scissorCount, device_data->device_limits.maxViewports, |
| 3175 | validation_error_map[VALIDATION_ERROR_01433]); |
| 3176 | } |
| 3177 | } |
| 3178 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3179 | if (pCreateInfos[i].pDynamicState != nullptr) { |
| 3180 | bool has_dynamic_viewport = false; |
| 3181 | bool has_dynamic_scissor = false; |
| 3182 | |
| 3183 | for (uint32_t state_index = 0; state_index < pCreateInfos[i].pDynamicState->dynamicStateCount; ++state_index) { |
| 3184 | if (pCreateInfos[i].pDynamicState->pDynamicStates[state_index] == VK_DYNAMIC_STATE_VIEWPORT) { |
| 3185 | has_dynamic_viewport = true; |
| 3186 | } else if (pCreateInfos[i].pDynamicState->pDynamicStates[state_index] == VK_DYNAMIC_STATE_SCISSOR) { |
| 3187 | has_dynamic_scissor = true; |
| 3188 | } |
| 3189 | } |
| 3190 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3191 | // If no element of the pDynamicStates member of pDynamicState is VK_DYNAMIC_STATE_VIEWPORT, the pViewports |
| 3192 | // member of pViewportState must be a pointer to an array of pViewportState->viewportCount VkViewport structures |
| 3193 | if (!has_dynamic_viewport && (pCreateInfos[i].pViewportState->pViewports == nullptr)) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3194 | skip |= |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3195 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mike Weiblen | 9858d96 | 2016-10-31 23:59:10 -0600 | [diff] [blame] | 3196 | __LINE__, VALIDATION_ERROR_02110, LayerName, |
Tobin Ehlis | bebd316 | 2016-08-18 10:53:58 -0600 | [diff] [blame] | 3197 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates does not contain " |
Mike Weiblen | 9858d96 | 2016-10-31 23:59:10 -0600 | [diff] [blame] | 3198 | "VK_DYNAMIC_STATE_VIEWPORT, pCreateInfos[%d].pViewportState->pViewports must not be NULL. %s", |
| 3199 | i, i, validation_error_map[VALIDATION_ERROR_02110]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3200 | } |
| 3201 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3202 | // If no element of the pDynamicStates member of pDynamicState is VK_DYNAMIC_STATE_SCISSOR, the pScissors member |
| 3203 | // of pViewportState must be a pointer to an array of pViewportState->scissorCount VkRect2D structures |
| 3204 | if (!has_dynamic_scissor && (pCreateInfos[i].pViewportState->pScissors == nullptr)) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3205 | skip |= |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3206 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mike Weiblen | 9858d96 | 2016-10-31 23:59:10 -0600 | [diff] [blame] | 3207 | __LINE__, VALIDATION_ERROR_02111, LayerName, |
Tobin Ehlis | bebd316 | 2016-08-18 10:53:58 -0600 | [diff] [blame] | 3208 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates does not contain " |
Mike Weiblen | 9858d96 | 2016-10-31 23:59:10 -0600 | [diff] [blame] | 3209 | "VK_DYNAMIC_STATE_SCISSOR, pCreateInfos[%d].pViewportState->pScissors must not be NULL. %s", |
| 3210 | i, i, validation_error_map[VALIDATION_ERROR_02111]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3211 | } |
| 3212 | } |
| 3213 | } |
| 3214 | |
| 3215 | if (pCreateInfos[i].pMultisampleState == nullptr) { |
| 3216 | // If the rasterizerDiscardEnable member of pRasterizationState is VK_FALSE, pMultisampleState must be a pointer to |
| 3217 | // a valid VkPipelineMultisampleStateCreateInfo structure |
| 3218 | if ((pCreateInfos[i].pRasterizationState != nullptr) && |
| 3219 | pCreateInfos[i].pRasterizationState->rasterizerDiscardEnable == VK_FALSE) { |
Mike Weiblen | 9858d96 | 2016-10-31 23:59:10 -0600 | [diff] [blame] | 3220 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3221 | __LINE__, VALIDATION_ERROR_02114, LayerName, |
| 3222 | "vkCreateGraphicsPipelines: if " |
| 3223 | "pCreateInfos[%d].pRasterizationState->rasterizerDiscardEnable is " |
| 3224 | "VK_FALSE, pCreateInfos[%d].pMultisampleState must not be NULL. %s", |
| 3225 | i, i, validation_error_map[VALIDATION_ERROR_02114]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3226 | } |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3227 | } else { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3228 | skip |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3229 | validate_struct_pnext(report_data, "vkCreateGraphicsPipelines", |
| 3230 | ParameterName("pCreateInfos[%i].pMultisampleState->pNext", ParameterName::IndexVector{i}), |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 3231 | NULL, pCreateInfos[i].pMultisampleState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3232 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3233 | skip |= validate_reserved_flags( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3234 | report_data, "vkCreateGraphicsPipelines", |
| 3235 | ParameterName("pCreateInfos[%i].pMultisampleState->flags", ParameterName::IndexVector{i}), |
| 3236 | pCreateInfos[i].pMultisampleState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3237 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3238 | skip |= validate_bool32( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3239 | report_data, "vkCreateGraphicsPipelines", |
| 3240 | ParameterName("pCreateInfos[%i].pMultisampleState->sampleShadingEnable", ParameterName::IndexVector{i}), |
| 3241 | pCreateInfos[i].pMultisampleState->sampleShadingEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3242 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3243 | skip |= validate_array( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3244 | report_data, "vkCreateGraphicsPipelines", |
| 3245 | ParameterName("pCreateInfos[%i].pMultisampleState->rasterizationSamples", ParameterName::IndexVector{i}), |
| 3246 | ParameterName("pCreateInfos[%i].pMultisampleState->pSampleMask", ParameterName::IndexVector{i}), |
| 3247 | pCreateInfos[i].pMultisampleState->rasterizationSamples, pCreateInfos[i].pMultisampleState->pSampleMask, true, |
| 3248 | false); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3249 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3250 | skip |= validate_bool32( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3251 | report_data, "vkCreateGraphicsPipelines", |
| 3252 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToCoverageEnable", ParameterName::IndexVector{i}), |
| 3253 | pCreateInfos[i].pMultisampleState->alphaToCoverageEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3254 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3255 | skip |= validate_bool32( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3256 | report_data, "vkCreateGraphicsPipelines", |
| 3257 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToOneEnable", ParameterName::IndexVector{i}), |
| 3258 | pCreateInfos[i].pMultisampleState->alphaToOneEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3259 | |
| 3260 | if (pCreateInfos[i].pMultisampleState->sType != VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3261 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3262 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 3263 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pMultisampleState->sType must be " |
| 3264 | "VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO", |
| 3265 | i); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3266 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3267 | } |
| 3268 | |
| 3269 | // TODO: Conditional NULL check based on rasterizerDiscardEnable and subpass |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3270 | if (pCreateInfos[i].pDepthStencilState != nullptr) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3271 | skip |= validate_struct_pnext( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3272 | report_data, "vkCreateGraphicsPipelines", |
| 3273 | ParameterName("pCreateInfos[%i].pDepthStencilState->pNext", ParameterName::IndexVector{i}), NULL, |
| 3274 | pCreateInfos[i].pDepthStencilState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3275 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3276 | skip |= validate_reserved_flags( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3277 | report_data, "vkCreateGraphicsPipelines", |
| 3278 | ParameterName("pCreateInfos[%i].pDepthStencilState->flags", ParameterName::IndexVector{i}), |
| 3279 | pCreateInfos[i].pDepthStencilState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3280 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3281 | skip |= validate_bool32( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3282 | report_data, "vkCreateGraphicsPipelines", |
| 3283 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthTestEnable", ParameterName::IndexVector{i}), |
| 3284 | pCreateInfos[i].pDepthStencilState->depthTestEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3285 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3286 | skip |= validate_bool32( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3287 | report_data, "vkCreateGraphicsPipelines", |
| 3288 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthWriteEnable", ParameterName::IndexVector{i}), |
| 3289 | pCreateInfos[i].pDepthStencilState->depthWriteEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3290 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3291 | skip |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3292 | report_data, "vkCreateGraphicsPipelines", |
| 3293 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthCompareOp", ParameterName::IndexVector{i}), |
| 3294 | "VkCompareOp", VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, |
| 3295 | pCreateInfos[i].pDepthStencilState->depthCompareOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3296 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3297 | skip |= validate_bool32( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3298 | report_data, "vkCreateGraphicsPipelines", |
| 3299 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthBoundsTestEnable", ParameterName::IndexVector{i}), |
| 3300 | pCreateInfos[i].pDepthStencilState->depthBoundsTestEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3301 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3302 | skip |= validate_bool32( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3303 | report_data, "vkCreateGraphicsPipelines", |
| 3304 | ParameterName("pCreateInfos[%i].pDepthStencilState->stencilTestEnable", ParameterName::IndexVector{i}), |
| 3305 | pCreateInfos[i].pDepthStencilState->stencilTestEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3306 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3307 | skip |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3308 | report_data, "vkCreateGraphicsPipelines", |
| 3309 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.failOp", ParameterName::IndexVector{i}), |
| 3310 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3311 | pCreateInfos[i].pDepthStencilState->front.failOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3312 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3313 | skip |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3314 | report_data, "vkCreateGraphicsPipelines", |
| 3315 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.passOp", ParameterName::IndexVector{i}), |
| 3316 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3317 | pCreateInfos[i].pDepthStencilState->front.passOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3318 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3319 | skip |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3320 | report_data, "vkCreateGraphicsPipelines", |
| 3321 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.depthFailOp", ParameterName::IndexVector{i}), |
| 3322 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3323 | pCreateInfos[i].pDepthStencilState->front.depthFailOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3324 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3325 | skip |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3326 | report_data, "vkCreateGraphicsPipelines", |
| 3327 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.compareOp", ParameterName::IndexVector{i}), |
| 3328 | "VkCompareOp", VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, |
| 3329 | pCreateInfos[i].pDepthStencilState->front.compareOp); |
| 3330 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3331 | skip |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3332 | report_data, "vkCreateGraphicsPipelines", |
| 3333 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.failOp", ParameterName::IndexVector{i}), "VkStencilOp", |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3334 | VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, pCreateInfos[i].pDepthStencilState->back.failOp); |
| 3335 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3336 | skip |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3337 | report_data, "vkCreateGraphicsPipelines", |
| 3338 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.passOp", ParameterName::IndexVector{i}), "VkStencilOp", |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3339 | VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, pCreateInfos[i].pDepthStencilState->back.passOp); |
| 3340 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3341 | skip |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3342 | report_data, "vkCreateGraphicsPipelines", |
| 3343 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.depthFailOp", ParameterName::IndexVector{i}), |
| 3344 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3345 | pCreateInfos[i].pDepthStencilState->back.depthFailOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3346 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3347 | skip |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3348 | report_data, "vkCreateGraphicsPipelines", |
| 3349 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.compareOp", ParameterName::IndexVector{i}), |
| 3350 | "VkCompareOp", VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, |
| 3351 | pCreateInfos[i].pDepthStencilState->back.compareOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3352 | |
| 3353 | if (pCreateInfos[i].pDepthStencilState->sType != VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3354 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3355 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 3356 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pDepthStencilState->sType must be " |
| 3357 | "VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO", |
| 3358 | i); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3359 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3360 | } |
| 3361 | |
| 3362 | // TODO: Conditional NULL check based on rasterizerDiscardEnable and subpass |
| 3363 | if (pCreateInfos[i].pColorBlendState != nullptr) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3364 | skip |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3365 | validate_struct_pnext(report_data, "vkCreateGraphicsPipelines", |
| 3366 | ParameterName("pCreateInfos[%i].pColorBlendState->pNext", ParameterName::IndexVector{i}), |
| 3367 | NULL, pCreateInfos[i].pColorBlendState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3368 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3369 | skip |= validate_reserved_flags( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3370 | report_data, "vkCreateGraphicsPipelines", |
| 3371 | ParameterName("pCreateInfos[%i].pColorBlendState->flags", ParameterName::IndexVector{i}), |
| 3372 | pCreateInfos[i].pColorBlendState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3373 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3374 | skip |= validate_bool32( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3375 | report_data, "vkCreateGraphicsPipelines", |
| 3376 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOpEnable", ParameterName::IndexVector{i}), |
| 3377 | pCreateInfos[i].pColorBlendState->logicOpEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3378 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3379 | skip |= validate_array( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3380 | report_data, "vkCreateGraphicsPipelines", |
| 3381 | ParameterName("pCreateInfos[%i].pColorBlendState->attachmentCount", ParameterName::IndexVector{i}), |
| 3382 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments", ParameterName::IndexVector{i}), |
| 3383 | pCreateInfos[i].pColorBlendState->attachmentCount, pCreateInfos[i].pColorBlendState->pAttachments, false, true); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3384 | |
| 3385 | if (pCreateInfos[i].pColorBlendState->pAttachments != NULL) { |
| 3386 | for (uint32_t attachmentIndex = 0; attachmentIndex < pCreateInfos[i].pColorBlendState->attachmentCount; |
| 3387 | ++attachmentIndex) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3388 | skip |= validate_bool32(report_data, "vkCreateGraphicsPipelines", |
| 3389 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].blendEnable", |
| 3390 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3391 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].blendEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3392 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3393 | skip |= validate_ranged_enum( |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3394 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3395 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcColorBlendFactor", |
| 3396 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3397 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3398 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].srcColorBlendFactor); |
| 3399 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3400 | skip |= validate_ranged_enum( |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3401 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3402 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstColorBlendFactor", |
| 3403 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3404 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3405 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].dstColorBlendFactor); |
| 3406 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3407 | skip |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3408 | validate_ranged_enum(report_data, "vkCreateGraphicsPipelines", |
| 3409 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorBlendOp", |
| 3410 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3411 | "VkBlendOp", VK_BLEND_OP_BEGIN_RANGE, VK_BLEND_OP_END_RANGE, |
| 3412 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].colorBlendOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3413 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3414 | skip |= validate_ranged_enum( |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3415 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3416 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcAlphaBlendFactor", |
| 3417 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3418 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3419 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].srcAlphaBlendFactor); |
| 3420 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3421 | skip |= validate_ranged_enum( |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3422 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3423 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstAlphaBlendFactor", |
| 3424 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3425 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3426 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].dstAlphaBlendFactor); |
| 3427 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3428 | skip |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3429 | validate_ranged_enum(report_data, "vkCreateGraphicsPipelines", |
| 3430 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].alphaBlendOp", |
| 3431 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3432 | "VkBlendOp", VK_BLEND_OP_BEGIN_RANGE, VK_BLEND_OP_END_RANGE, |
| 3433 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].alphaBlendOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3434 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3435 | skip |= |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3436 | validate_flags(report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3437 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorWriteMask", |
| 3438 | ParameterName::IndexVector{i, attachmentIndex}), |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3439 | "VkColorComponentFlagBits", AllVkColorComponentFlagBits, |
| 3440 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].colorWriteMask, false); |
| 3441 | } |
| 3442 | } |
| 3443 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3444 | if (pCreateInfos[i].pColorBlendState->sType != VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3445 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3446 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 3447 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pColorBlendState->sType must be " |
| 3448 | "VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO", |
| 3449 | i); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3450 | } |
| 3451 | |
| 3452 | // If logicOpEnable is VK_TRUE, logicOp must be a valid VkLogicOp value |
| 3453 | if (pCreateInfos[i].pColorBlendState->logicOpEnable == VK_TRUE) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3454 | skip |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3455 | report_data, "vkCreateGraphicsPipelines", |
| 3456 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOp", ParameterName::IndexVector{i}), "VkLogicOp", |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3457 | VK_LOGIC_OP_BEGIN_RANGE, VK_LOGIC_OP_END_RANGE, pCreateInfos[i].pColorBlendState->logicOp); |
| 3458 | } |
| 3459 | } |
| 3460 | } |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 3461 | skip |= PreCreateGraphicsPipelines(device, pCreateInfos); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3462 | } |
| 3463 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3464 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3465 | result = device_data->dispatch_table.CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, |
| 3466 | pAllocator, pPipelines); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3467 | validate_result(report_data, "vkCreateGraphicsPipelines", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3468 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3469 | |
| 3470 | return result; |
| 3471 | } |
| 3472 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3473 | bool PreCreateComputePipelines(VkDevice device, const VkComputePipelineCreateInfo *pCreateInfos) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3474 | layer_data *data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 3475 | bool skip = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3476 | if (pCreateInfos != nullptr) { |
| 3477 | // TODO: Handle count! |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3478 | uint32_t i = 0; |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 3479 | skip |= validate_string(data->report_data, "vkCreateComputePipelines", |
| 3480 | ParameterName("pCreateInfos[%i].stage.pName", ParameterName::IndexVector{i}), |
| 3481 | pCreateInfos[i].stage.pName); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3482 | } |
| 3483 | |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 3484 | return skip; |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3485 | } |
| 3486 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3487 | VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 3488 | const VkComputePipelineCreateInfo *pCreateInfos, |
| 3489 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3490 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3491 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3492 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3493 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3494 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3495 | skip |= parameter_validation_vkCreateComputePipelines(my_data->report_data, pipelineCache, createInfoCount, pCreateInfos, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3496 | pAllocator, pPipelines); |
Mark Lobodzinski | ff6a86c | 2017-02-14 14:30:08 -0700 | [diff] [blame] | 3497 | skip |= PreCreateComputePipelines(device, pCreateInfos); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3498 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3499 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3500 | result = my_data->dispatch_table.CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, |
| 3501 | pPipelines); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3502 | validate_result(my_data->report_data, "vkCreateComputePipelines", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3503 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3504 | |
| 3505 | return result; |
| 3506 | } |
| 3507 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3508 | VKAPI_ATTR void VKAPI_CALL DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3509 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3510 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3511 | assert(my_data != NULL); |
| 3512 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3513 | skip |= parameter_validation_vkDestroyPipeline(my_data->report_data, pipeline, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3514 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3515 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3516 | my_data->dispatch_table.DestroyPipeline(device, pipeline, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3517 | } |
| 3518 | } |
| 3519 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3520 | VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, |
| 3521 | const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3522 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3523 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3524 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3525 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3526 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3527 | skip |= parameter_validation_vkCreatePipelineLayout(my_data->report_data, pCreateInfo, pAllocator, pPipelineLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3528 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3529 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3530 | result = my_data->dispatch_table.CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3531 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3532 | validate_result(my_data->report_data, "vkCreatePipelineLayout", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3533 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3534 | |
| 3535 | return result; |
| 3536 | } |
| 3537 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3538 | VKAPI_ATTR void VKAPI_CALL DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, |
| 3539 | const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3540 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3541 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3542 | assert(my_data != NULL); |
| 3543 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3544 | skip |= parameter_validation_vkDestroyPipelineLayout(my_data->report_data, pipelineLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3545 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3546 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3547 | my_data->dispatch_table.DestroyPipelineLayout(device, pipelineLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3548 | } |
| 3549 | } |
| 3550 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3551 | VKAPI_ATTR VkResult VKAPI_CALL CreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, |
| 3552 | const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3553 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3554 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3555 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3556 | assert(device_data != NULL); |
| 3557 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3558 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3559 | skip |= parameter_validation_vkCreateSampler(report_data, pCreateInfo, pAllocator, pSampler); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3560 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3561 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | 262f61f | 2017-03-01 15:52:49 -0700 | [diff] [blame] | 3562 | |
| 3563 | if ((device_data->physical_device_features.samplerAnisotropy == false) && (pCreateInfo->maxAnisotropy != 1.0)) { |
| 3564 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3565 | DEVICE_FEATURE, LayerName, |
| 3566 | "vkCreateSampler(): The samplerAnisotropy feature is not enabled, so the maxAnisotropy member of the " |
| 3567 | "VkSamplerCreateInfo structure must be 1.0 but is %f.", |
| 3568 | pCreateInfo->maxAnisotropy); |
| 3569 | } |
| 3570 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3571 | // If compareEnable is VK_TRUE, compareOp must be a valid VkCompareOp value |
| 3572 | if (pCreateInfo->compareEnable == VK_TRUE) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3573 | skip |= validate_ranged_enum(report_data, "vkCreateSampler", "pCreateInfo->compareOp", "VkCompareOp", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3574 | VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, pCreateInfo->compareOp); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3575 | } |
| 3576 | |
| 3577 | // If any of addressModeU, addressModeV or addressModeW are VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, borderColor must be a |
| 3578 | // valid VkBorderColor value |
| 3579 | if ((pCreateInfo->addressModeU == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 3580 | (pCreateInfo->addressModeV == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 3581 | (pCreateInfo->addressModeW == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3582 | skip |= validate_ranged_enum(report_data, "vkCreateSampler", "pCreateInfo->borderColor", "VkBorderColor", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3583 | VK_BORDER_COLOR_BEGIN_RANGE, VK_BORDER_COLOR_END_RANGE, pCreateInfo->borderColor); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3584 | } |
| 3585 | } |
| 3586 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3587 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3588 | result = device_data->dispatch_table.CreateSampler(device, pCreateInfo, pAllocator, pSampler); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3589 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3590 | validate_result(report_data, "vkCreateSampler", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3591 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3592 | |
| 3593 | return result; |
| 3594 | } |
| 3595 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3596 | VKAPI_ATTR void VKAPI_CALL DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3597 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3598 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3599 | assert(my_data != NULL); |
| 3600 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3601 | skip |= parameter_validation_vkDestroySampler(my_data->report_data, sampler, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3602 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3603 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3604 | my_data->dispatch_table.DestroySampler(device, sampler, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3605 | } |
| 3606 | } |
| 3607 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3608 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
| 3609 | const VkAllocationCallbacks *pAllocator, |
| 3610 | VkDescriptorSetLayout *pSetLayout) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3611 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3612 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3613 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3614 | assert(device_data != nullptr); |
| 3615 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3616 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3617 | skip |= parameter_validation_vkCreateDescriptorSetLayout(report_data, pCreateInfo, pAllocator, pSetLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3618 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3619 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3620 | if ((pCreateInfo != nullptr) && (pCreateInfo->pBindings != nullptr)) { |
| 3621 | for (uint32_t i = 0; i < pCreateInfo->bindingCount; ++i) { |
| 3622 | if (pCreateInfo->pBindings[i].descriptorCount != 0) { |
| 3623 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER or VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, and descriptorCount |
| 3624 | // is not 0 and pImmutableSamplers is not NULL, pImmutableSamplers must be a pointer to an array of descriptorCount |
| 3625 | // valid VkSampler handles |
| 3626 | if (((pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 3627 | (pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)) && |
| 3628 | (pCreateInfo->pBindings[i].pImmutableSamplers != nullptr)) { |
| 3629 | for (uint32_t descriptor_index = 0; descriptor_index < pCreateInfo->pBindings[i].descriptorCount; |
| 3630 | ++descriptor_index) { |
| 3631 | if (pCreateInfo->pBindings[i].pImmutableSamplers[descriptor_index] == VK_NULL_HANDLE) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 3632 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3633 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 3634 | "vkCreateDescriptorSetLayout: required parameter " |
| 3635 | "pCreateInfo->pBindings[%d].pImmutableSamplers[%d]" |
| 3636 | " specified as VK_NULL_HANDLE", |
| 3637 | i, descriptor_index); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3638 | } |
| 3639 | } |
| 3640 | } |
| 3641 | |
| 3642 | // If descriptorCount is not 0, stageFlags must be a valid combination of VkShaderStageFlagBits values |
| 3643 | if ((pCreateInfo->pBindings[i].stageFlags != 0) && |
| 3644 | ((pCreateInfo->pBindings[i].stageFlags & (~AllVkShaderStageFlagBits)) != 0)) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 3645 | skip |= log_msg( |
| 3646 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3647 | VALIDATION_ERROR_00853, LayerName, |
| 3648 | "vkCreateDescriptorSetLayout(): if pCreateInfo->pBindings[%d].descriptorCount is not 0, " |
| 3649 | "pCreateInfo->pBindings[%d].stageFlags must be a valid combination of VkShaderStageFlagBits values. %s", |
| 3650 | i, i, validation_error_map[VALIDATION_ERROR_00853]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3651 | } |
| 3652 | } |
| 3653 | } |
| 3654 | } |
| 3655 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3656 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3657 | result = device_data->dispatch_table.CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3658 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3659 | validate_result(report_data, "vkCreateDescriptorSetLayout", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3660 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3661 | |
| 3662 | return result; |
| 3663 | } |
| 3664 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3665 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, |
| 3666 | const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3667 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3668 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3669 | assert(my_data != NULL); |
| 3670 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3671 | skip |= parameter_validation_vkDestroyDescriptorSetLayout(my_data->report_data, descriptorSetLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3672 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3673 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3674 | my_data->dispatch_table.DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3675 | } |
| 3676 | } |
| 3677 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3678 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, |
| 3679 | const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3680 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3681 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3682 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3683 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3684 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3685 | skip |= parameter_validation_vkCreateDescriptorPool(my_data->report_data, pCreateInfo, pAllocator, pDescriptorPool); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3686 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3687 | /* TODOVV: How do we validate maxSets? Probably belongs in the limits layer? */ |
| 3688 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3689 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3690 | result = my_data->dispatch_table.CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3691 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3692 | validate_result(my_data->report_data, "vkCreateDescriptorPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3693 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3694 | |
| 3695 | return result; |
| 3696 | } |
| 3697 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3698 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 3699 | const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3700 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3701 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3702 | assert(my_data != NULL); |
| 3703 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3704 | skip |= parameter_validation_vkDestroyDescriptorPool(my_data->report_data, descriptorPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3705 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3706 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3707 | my_data->dispatch_table.DestroyDescriptorPool(device, descriptorPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3708 | } |
| 3709 | } |
| 3710 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3711 | VKAPI_ATTR VkResult VKAPI_CALL ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 3712 | VkDescriptorPoolResetFlags flags) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3713 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3714 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3715 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3716 | assert(my_data != NULL); |
| 3717 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3718 | skip |= parameter_validation_vkResetDescriptorPool(my_data->report_data, descriptorPool, flags); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3719 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3720 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3721 | result = my_data->dispatch_table.ResetDescriptorPool(device, descriptorPool, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3722 | |
| 3723 | validate_result(my_data->report_data, "vkResetDescriptorPool", result); |
| 3724 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3725 | |
| 3726 | return result; |
| 3727 | } |
| 3728 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3729 | VKAPI_ATTR VkResult VKAPI_CALL AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, |
| 3730 | VkDescriptorSet *pDescriptorSets) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3731 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3732 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3733 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3734 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3735 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3736 | skip |= parameter_validation_vkAllocateDescriptorSets(my_data->report_data, pAllocateInfo, pDescriptorSets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3737 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3738 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3739 | result = my_data->dispatch_table.AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3740 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3741 | validate_result(my_data->report_data, "vkAllocateDescriptorSets", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3742 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3743 | |
| 3744 | return result; |
| 3745 | } |
| 3746 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3747 | VKAPI_ATTR VkResult VKAPI_CALL FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3748 | const VkDescriptorSet *pDescriptorSets) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3749 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3750 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3751 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3752 | assert(device_data != nullptr); |
| 3753 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3754 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3755 | skip |= parameter_validation_vkFreeDescriptorSets(report_data, descriptorPool, descriptorSetCount, pDescriptorSets); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3756 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3757 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3758 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 3759 | // validate_array() |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3760 | skip |= validate_array(report_data, "vkFreeDescriptorSets", "descriptorSetCount", "pDescriptorSets", descriptorSetCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3761 | pDescriptorSets, true, true); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3762 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3763 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3764 | result = device_data->dispatch_table.FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3765 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3766 | validate_result(report_data, "vkFreeDescriptorSets", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3767 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3768 | |
| 3769 | return result; |
| 3770 | } |
| 3771 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3772 | VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, |
| 3773 | const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, |
| 3774 | const VkCopyDescriptorSet *pDescriptorCopies) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3775 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3776 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3777 | assert(device_data != NULL); |
| 3778 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3779 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3780 | skip |= parameter_validation_vkUpdateDescriptorSets(report_data, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, |
| 3781 | pDescriptorCopies); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3782 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3783 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3784 | if (pDescriptorWrites != NULL) { |
| 3785 | for (uint32_t i = 0; i < descriptorWriteCount; ++i) { |
| 3786 | // descriptorCount must be greater than 0 |
| 3787 | if (pDescriptorWrites[i].descriptorCount == 0) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3788 | skip |= |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3789 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 3790 | VALIDATION_ERROR_00957, LayerName, |
| 3791 | "vkUpdateDescriptorSets(): parameter pDescriptorWrites[%d].descriptorCount must be greater than 0. %s", |
| 3792 | i, validation_error_map[VALIDATION_ERROR_00957]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3793 | } |
| 3794 | |
Dustin Graves | ce68f08 | 2017-03-30 15:42:16 -0600 | [diff] [blame^] | 3795 | // dstSet must be a valid VkDescriptorSet handle |
| 3796 | skip |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
| 3797 | ParameterName("pDescriptorWrites[%i].dstSet", ParameterName::IndexVector{i}), |
| 3798 | pDescriptorWrites[i].dstSet); |
| 3799 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3800 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 3801 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || |
| 3802 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || |
| 3803 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || |
| 3804 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)) { |
| 3805 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, |
| 3806 | // VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, |
| 3807 | // pImageInfo must be a pointer to an array of descriptorCount valid VkDescriptorImageInfo structures |
| 3808 | if (pDescriptorWrites[i].pImageInfo == nullptr) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3809 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 3810 | __LINE__, VALIDATION_ERROR_00939, LayerName, |
| 3811 | "vkUpdateDescriptorSets(): if pDescriptorWrites[%d].descriptorType is " |
| 3812 | "VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, " |
| 3813 | "VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or " |
| 3814 | "VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, pDescriptorWrites[%d].pImageInfo must not be NULL. %s", |
| 3815 | i, i, validation_error_map[VALIDATION_ERROR_00939]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3816 | } else if (pDescriptorWrites[i].descriptorType != VK_DESCRIPTOR_TYPE_SAMPLER) { |
| 3817 | // If descriptorType is VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, |
| 3818 | // VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, the imageView and imageLayout |
| 3819 | // members of any given element of pImageInfo must be a valid VkImageView and VkImageLayout, respectively |
| 3820 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3821 | ++descriptor_index) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3822 | skip |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3823 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageView", |
| 3824 | ParameterName::IndexVector{i, descriptor_index}), |
| 3825 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageView); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3826 | skip |= validate_ranged_enum(report_data, "vkUpdateDescriptorSets", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3827 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageLayout", |
| 3828 | ParameterName::IndexVector{i, descriptor_index}), |
| 3829 | "VkImageLayout", VK_IMAGE_LAYOUT_BEGIN_RANGE, VK_IMAGE_LAYOUT_END_RANGE, |
| 3830 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageLayout); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3831 | } |
| 3832 | } |
| 3833 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 3834 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 3835 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || |
| 3836 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 3837 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 3838 | // VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, pBufferInfo must be a |
| 3839 | // pointer to an array of descriptorCount valid VkDescriptorBufferInfo structures |
| 3840 | if (pDescriptorWrites[i].pBufferInfo == nullptr) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3841 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 3842 | __LINE__, VALIDATION_ERROR_00941, LayerName, |
| 3843 | "vkUpdateDescriptorSets(): if pDescriptorWrites[%d].descriptorType is " |
| 3844 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, " |
| 3845 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, " |
| 3846 | "pDescriptorWrites[%d].pBufferInfo must not be NULL. %s", |
| 3847 | i, i, validation_error_map[VALIDATION_ERROR_00941]); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3848 | } else { |
| 3849 | for (uint32_t descriptorIndex = 0; descriptorIndex < pDescriptorWrites[i].descriptorCount; ++descriptorIndex) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3850 | skip |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3851 | ParameterName("pDescriptorWrites[%i].pBufferInfo[%i].buffer", |
| 3852 | ParameterName::IndexVector{i, descriptorIndex}), |
| 3853 | pDescriptorWrites[i].pBufferInfo[descriptorIndex].buffer); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3854 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3855 | } |
| 3856 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || |
| 3857 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { |
| 3858 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, |
| 3859 | // pTexelBufferView must be a pointer to an array of descriptorCount valid VkBufferView handles |
| 3860 | if (pDescriptorWrites[i].pTexelBufferView == nullptr) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3861 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 3862 | __LINE__, VALIDATION_ERROR_00940, LayerName, |
| 3863 | "vkUpdateDescriptorSets(): if pDescriptorWrites[%d].descriptorType is " |
| 3864 | "VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, " |
| 3865 | "pDescriptorWrites[%d].pTexelBufferView must not be NULL. %s", |
| 3866 | i, i, validation_error_map[VALIDATION_ERROR_00940]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3867 | } else { |
| 3868 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3869 | ++descriptor_index) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3870 | skip |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3871 | ParameterName("pDescriptorWrites[%i].pTexelBufferView[%i]", |
| 3872 | ParameterName::IndexVector{i, descriptor_index}), |
| 3873 | pDescriptorWrites[i].pTexelBufferView[descriptor_index]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3874 | } |
| 3875 | } |
| 3876 | } |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3877 | |
| 3878 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 3879 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)) { |
| 3880 | VkDeviceSize uniformAlignment = device_data->device_limits.minUniformBufferOffsetAlignment; |
| 3881 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 3882 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
Dave Houlton | 1d2022c | 2017-03-29 11:43:58 -0600 | [diff] [blame] | 3883 | if (SafeModulo(pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment) != 0) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 3884 | skip |= log_msg( |
| 3885 | device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, |
| 3886 | VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, VALIDATION_ERROR_00944, LayerName, |
| 3887 | "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 3888 | ") must be a multiple of device limit minUniformBufferOffsetAlignment 0x%" PRIxLEAST64 ". %s", |
| 3889 | i, j, pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment, |
| 3890 | validation_error_map[VALIDATION_ERROR_00944]); |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3891 | } |
| 3892 | } |
| 3893 | } |
| 3894 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 3895 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 3896 | VkDeviceSize storageAlignment = device_data->device_limits.minStorageBufferOffsetAlignment; |
| 3897 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 3898 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
Dave Houlton | 1d2022c | 2017-03-29 11:43:58 -0600 | [diff] [blame] | 3899 | if (SafeModulo(pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment) != 0) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 3900 | skip |= log_msg( |
| 3901 | device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, |
| 3902 | VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, VALIDATION_ERROR_00945, LayerName, |
| 3903 | "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 3904 | ") must be a multiple of device limit minStorageBufferOffsetAlignment 0x%" PRIxLEAST64 ". %s", |
| 3905 | i, j, pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment, |
| 3906 | validation_error_map[VALIDATION_ERROR_00945]); |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3907 | } |
| 3908 | } |
| 3909 | } |
| 3910 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3911 | } |
| 3912 | } |
| 3913 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3914 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3915 | device_data->dispatch_table.UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, |
| 3916 | pDescriptorCopies); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3917 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3918 | } |
| 3919 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3920 | VKAPI_ATTR VkResult VKAPI_CALL CreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3921 | const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3922 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3923 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3924 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3925 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3926 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3927 | skip |= parameter_validation_vkCreateFramebuffer(my_data->report_data, pCreateInfo, pAllocator, pFramebuffer); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3928 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3929 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3930 | result = my_data->dispatch_table.CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3931 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3932 | validate_result(my_data->report_data, "vkCreateFramebuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3933 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3934 | |
| 3935 | return result; |
| 3936 | } |
| 3937 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3938 | VKAPI_ATTR void VKAPI_CALL DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3939 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3940 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3941 | assert(my_data != NULL); |
| 3942 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3943 | skip |= parameter_validation_vkDestroyFramebuffer(my_data->report_data, framebuffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3944 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3945 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3946 | my_data->dispatch_table.DestroyFramebuffer(device, framebuffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3947 | } |
| 3948 | } |
| 3949 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 3950 | static bool PreCreateRenderPass(layer_data *dev_data, const VkRenderPassCreateInfo *pCreateInfo) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3951 | bool skip = false; |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3952 | uint32_t max_color_attachments = dev_data->device_limits.maxColorAttachments; |
| 3953 | |
Mark Lobodzinski | e907fe4 | 2017-01-27 14:50:23 -0700 | [diff] [blame] | 3954 | for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) { |
| 3955 | if (pCreateInfo->pAttachments[i].format == VK_FORMAT_UNDEFINED) { |
| 3956 | std::stringstream ss; |
| 3957 | ss << "vkCreateRenderPass: pCreateInfo->pAttachments[" << i << "].format is VK_FORMAT_UNDEFINED. " |
| 3958 | << validation_error_map[VALIDATION_ERROR_00336]; |
Jeremy Hayes | 632e0ab | 2017-02-09 13:32:28 -0700 | [diff] [blame] | 3959 | skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, |
Mark Lobodzinski | e907fe4 | 2017-01-27 14:50:23 -0700 | [diff] [blame] | 3960 | VALIDATION_ERROR_00336, "IMAGE", "%s", ss.str().c_str()); |
| 3961 | } |
| 3962 | } |
| 3963 | |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3964 | for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) { |
| 3965 | if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 3966 | skip |= |
| 3967 | log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3968 | VALIDATION_ERROR_00348, "DL", "Cannot create a render pass with %d color attachments. Max is %d. %s", |
| 3969 | pCreateInfo->pSubpasses[i].colorAttachmentCount, max_color_attachments, |
| 3970 | validation_error_map[VALIDATION_ERROR_00348]); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3971 | } |
| 3972 | } |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3973 | return skip; |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3974 | } |
| 3975 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3976 | VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3977 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3978 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3979 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3980 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3981 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3982 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3983 | skip |= parameter_validation_vkCreateRenderPass(my_data->report_data, pCreateInfo, pAllocator, pRenderPass); |
| 3984 | skip |= PreCreateRenderPass(my_data, pCreateInfo); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3985 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3986 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3987 | result = my_data->dispatch_table.CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3988 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3989 | validate_result(my_data->report_data, "vkCreateRenderPass", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3990 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3991 | |
| 3992 | return result; |
| 3993 | } |
| 3994 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3995 | VKAPI_ATTR void VKAPI_CALL DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3996 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3997 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3998 | assert(my_data != NULL); |
| 3999 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4000 | skip |= parameter_validation_vkDestroyRenderPass(my_data->report_data, renderPass, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4001 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4002 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4003 | my_data->dispatch_table.DestroyRenderPass(device, renderPass, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4004 | } |
| 4005 | } |
| 4006 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4007 | VKAPI_ATTR void VKAPI_CALL GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4008 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4009 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4010 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4011 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4012 | skip |= parameter_validation_vkGetRenderAreaGranularity(my_data->report_data, renderPass, pGranularity); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4013 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4014 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4015 | my_data->dispatch_table.GetRenderAreaGranularity(device, renderPass, pGranularity); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4016 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4017 | } |
| 4018 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4019 | VKAPI_ATTR VkResult VKAPI_CALL CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4020 | const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4021 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4022 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4023 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4024 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4025 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4026 | skip |= |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 4027 | validate_queue_family_index(my_data, "vkCreateCommandPool", "pCreateInfo->queueFamilyIndex", pCreateInfo->queueFamilyIndex); |
Mark Lobodzinski | f20f094 | 2016-03-22 10:07:26 -0600 | [diff] [blame] | 4028 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4029 | skip |= parameter_validation_vkCreateCommandPool(my_data->report_data, pCreateInfo, pAllocator, pCommandPool); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4030 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4031 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4032 | result = my_data->dispatch_table.CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4033 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4034 | validate_result(my_data->report_data, "vkCreateCommandPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4035 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4036 | |
| 4037 | return result; |
| 4038 | } |
| 4039 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4040 | VKAPI_ATTR void VKAPI_CALL DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4041 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4042 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4043 | assert(my_data != NULL); |
| 4044 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4045 | skip |= parameter_validation_vkDestroyCommandPool(my_data->report_data, commandPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4046 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4047 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4048 | my_data->dispatch_table.DestroyCommandPool(device, commandPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4049 | } |
| 4050 | } |
| 4051 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4052 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4053 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4054 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4055 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4056 | assert(my_data != NULL); |
| 4057 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4058 | skip |= parameter_validation_vkResetCommandPool(my_data->report_data, commandPool, flags); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4059 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4060 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4061 | result = my_data->dispatch_table.ResetCommandPool(device, commandPool, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4062 | |
| 4063 | validate_result(my_data->report_data, "vkResetCommandPool", result); |
| 4064 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4065 | |
| 4066 | return result; |
| 4067 | } |
| 4068 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4069 | VKAPI_ATTR VkResult VKAPI_CALL AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, |
| 4070 | VkCommandBuffer *pCommandBuffers) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4071 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4072 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4073 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4074 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4075 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4076 | skip |= parameter_validation_vkAllocateCommandBuffers(my_data->report_data, pAllocateInfo, pCommandBuffers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4077 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4078 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4079 | result = my_data->dispatch_table.AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4080 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4081 | validate_result(my_data->report_data, "vkAllocateCommandBuffers", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4082 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4083 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4084 | return result; |
| 4085 | } |
| 4086 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4087 | VKAPI_ATTR void VKAPI_CALL FreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4088 | const VkCommandBuffer *pCommandBuffers) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4089 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4090 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4091 | assert(device_data != nullptr); |
| 4092 | debug_report_data *report_data = device_data->report_data; |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 4093 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4094 | skip |= parameter_validation_vkFreeCommandBuffers(report_data, commandPool, commandBufferCount, pCommandBuffers); |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 4095 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4096 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 4097 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 4098 | // validate_array() |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4099 | skip |= validate_array(report_data, "vkFreeCommandBuffers", "commandBufferCount", "pCommandBuffers", commandBufferCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4100 | pCommandBuffers, true, true); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4101 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4102 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4103 | device_data->dispatch_table.FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers); |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 4104 | } |
| 4105 | } |
| 4106 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4107 | static bool PreBeginCommandBuffer(layer_data *dev_data, VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4108 | bool skip = false; |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 4109 | const VkCommandBufferInheritanceInfo *pInfo = pBeginInfo->pInheritanceInfo; |
| 4110 | |
| 4111 | if (pInfo != NULL) { |
Chris Forbes | c5554a5 | 2016-11-24 14:45:16 +1300 | [diff] [blame] | 4112 | if ((dev_data->physical_device_features.inheritedQueries == VK_FALSE) && (pInfo->occlusionQueryEnable != VK_FALSE)) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4113 | skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 4114 | reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_00116, LayerName, |
| 4115 | "Cannot set inherited occlusionQueryEnable in vkBeginCommandBuffer() when device does not support " |
| 4116 | "inheritedQueries. %s", |
| 4117 | validation_error_map[VALIDATION_ERROR_00116]); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 4118 | } |
Mark Lobodzinski | 38df456 | 2016-12-15 13:06:55 -0700 | [diff] [blame] | 4119 | // VALIDATION_ERROR_00117 check |
| 4120 | if ((dev_data->physical_device_features.inheritedQueries != VK_FALSE) && (pInfo->occlusionQueryEnable != VK_FALSE)) { |
| 4121 | skip |= validate_flags(dev_data->report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->queryFlags", |
| 4122 | "VkQueryControlFlagBits", AllVkQueryControlFlagBits, pInfo->queryFlags, false); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 4123 | } |
| 4124 | } |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4125 | return skip; |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 4126 | } |
| 4127 | |
| 4128 | VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4129 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4130 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4131 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4132 | assert(device_data != nullptr); |
| 4133 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4134 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4135 | skip |= parameter_validation_vkBeginCommandBuffer(report_data, pBeginInfo); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4136 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4137 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 4138 | // TODO: pBeginInfo->pInheritanceInfo must not be NULL if commandBuffer is a secondary command buffer |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4139 | skip |= validate_struct_type(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4140 | "VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO", pBeginInfo->pInheritanceInfo, |
| 4141 | VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, false); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4142 | |
| 4143 | if (pBeginInfo->pInheritanceInfo != NULL) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4144 | skip |= validate_struct_pnext(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->pNext", NULL, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4145 | pBeginInfo->pInheritanceInfo->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 4146 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4147 | skip |= validate_bool32(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->occlusionQueryEnable", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4148 | pBeginInfo->pInheritanceInfo->occlusionQueryEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 4149 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4150 | // TODO: This only needs to be validated when the inherited queries feature is enabled |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4151 | // skip |= validate_flags(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->queryFlags", |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4152 | // "VkQueryControlFlagBits", AllVkQueryControlFlagBits, pBeginInfo->pInheritanceInfo->queryFlags, false); |
| 4153 | |
| 4154 | // TODO: This must be 0 if the pipeline statistics queries feature is not enabled |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4155 | skip |= validate_flags(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->pipelineStatistics", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4156 | "VkQueryPipelineStatisticFlagBits", AllVkQueryPipelineStatisticFlagBits, |
| 4157 | pBeginInfo->pInheritanceInfo->pipelineStatistics, false); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4158 | } |
| 4159 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4160 | skip |= PreBeginCommandBuffer(device_data, commandBuffer, pBeginInfo); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 4161 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4162 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4163 | result = device_data->dispatch_table.BeginCommandBuffer(commandBuffer, pBeginInfo); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4164 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4165 | validate_result(report_data, "vkBeginCommandBuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4166 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4167 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4168 | return result; |
| 4169 | } |
| 4170 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4171 | VKAPI_ATTR VkResult VKAPI_CALL EndCommandBuffer(VkCommandBuffer commandBuffer) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4172 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4173 | assert(my_data != NULL); |
| 4174 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4175 | VkResult result = my_data->dispatch_table.EndCommandBuffer(commandBuffer); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4176 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4177 | validate_result(my_data->report_data, "vkEndCommandBuffer", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4178 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4179 | return result; |
| 4180 | } |
| 4181 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4182 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) { |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 4183 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4184 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4185 | assert(my_data != NULL); |
| 4186 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4187 | bool skip = parameter_validation_vkResetCommandBuffer(my_data->report_data, flags); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4188 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4189 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4190 | result = my_data->dispatch_table.ResetCommandBuffer(commandBuffer, flags); |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 4191 | |
| 4192 | validate_result(my_data->report_data, "vkResetCommandBuffer", result); |
| 4193 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4194 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4195 | return result; |
| 4196 | } |
| 4197 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4198 | VKAPI_ATTR void VKAPI_CALL CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 4199 | VkPipeline pipeline) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4200 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4201 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4202 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4203 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4204 | skip |= parameter_validation_vkCmdBindPipeline(my_data->report_data, pipelineBindPoint, pipeline); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4205 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4206 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4207 | my_data->dispatch_table.CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4208 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4209 | } |
| 4210 | |
Mark Lobodzinski | 147e692 | 2017-03-01 15:45:52 -0700 | [diff] [blame] | 4211 | static bool preCmdSetViewport(layer_data *my_data, uint32_t first_viewport, uint32_t viewport_count, const VkViewport *viewports) { |
Mike Weiblen | 2906c9a | 2016-10-31 21:04:10 -0600 | [diff] [blame] | 4212 | debug_report_data *report_data = my_data->report_data; |
| 4213 | |
Mark Lobodzinski | 5a24296 | 2016-10-28 12:57:23 -0600 | [diff] [blame] | 4214 | bool skip = |
| 4215 | validate_array(report_data, "vkCmdSetViewport", "viewportCount", "pViewports", viewport_count, viewports, true, true); |
Mike Weiblen | 2906c9a | 2016-10-31 21:04:10 -0600 | [diff] [blame] | 4216 | |
| 4217 | if (viewport_count > 0 && viewports != nullptr) { |
| 4218 | const VkPhysicalDeviceLimits &limits = my_data->device_limits; |
| 4219 | for (uint32_t viewportIndex = 0; viewportIndex < viewport_count; ++viewportIndex) { |
| 4220 | const VkViewport &viewport = viewports[viewportIndex]; |
| 4221 | |
Mark Lobodzinski | 147e692 | 2017-03-01 15:45:52 -0700 | [diff] [blame] | 4222 | if (my_data->physical_device_features.multiViewport == false) { |
| 4223 | if (viewport_count != 1) { |
| 4224 | skip |= log_msg( |
| 4225 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4226 | DEVICE_FEATURE, LayerName, |
| 4227 | "vkCmdSetViewport(): The multiViewport feature is not enabled, so viewportCount must be 1 but is %d.", |
| 4228 | viewport_count); |
| 4229 | } |
| 4230 | if (first_viewport != 0) { |
| 4231 | skip |= log_msg( |
| 4232 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4233 | DEVICE_FEATURE, LayerName, |
| 4234 | "vkCmdSetViewport(): The multiViewport feature is not enabled, so firstViewport must be 0 but is %d.", |
| 4235 | first_viewport); |
| 4236 | } |
| 4237 | } |
| 4238 | |
Mike Weiblen | 2906c9a | 2016-10-31 21:04:10 -0600 | [diff] [blame] | 4239 | if (viewport.width <= 0 || viewport.width > limits.maxViewportDimensions[0]) { |
| 4240 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4241 | VALIDATION_ERROR_01448, LayerName, |
| 4242 | "vkCmdSetViewport %d: width (%f) exceeds permitted bounds (0,%u). %s", viewportIndex, |
| 4243 | viewport.width, limits.maxViewportDimensions[0], validation_error_map[VALIDATION_ERROR_01448]); |
| 4244 | } |
| 4245 | |
| 4246 | bool invalid_height = (viewport.height <= 0 || viewport.height > limits.maxViewportDimensions[1]); |
Mark Lobodzinski | 885790e | 2017-03-09 11:54:48 -0700 | [diff] [blame] | 4247 | if ((my_data->enables.amd_negative_viewport_height || my_data->enables.khr_maintenance1) && (viewport.height < 0)) { |
Mike Weiblen | 2906c9a | 2016-10-31 21:04:10 -0600 | [diff] [blame] | 4248 | // VALIDATION_ERROR_01790 |
| 4249 | invalid_height = false; |
| 4250 | } |
| 4251 | if (invalid_height) { |
| 4252 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4253 | VALIDATION_ERROR_01449, LayerName, |
| 4254 | "vkCmdSetViewport %d: height (%f) exceeds permitted bounds (0,%u). %s", viewportIndex, |
| 4255 | viewport.height, limits.maxViewportDimensions[1], validation_error_map[VALIDATION_ERROR_01449]); |
| 4256 | } |
| 4257 | |
| 4258 | if (viewport.x < limits.viewportBoundsRange[0] || viewport.x > limits.viewportBoundsRange[1]) { |
| 4259 | skip |= |
| 4260 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4261 | VALIDATION_ERROR_01450, LayerName, "vkCmdSetViewport %d: x (%f) exceeds permitted bounds (%f,%f). %s", |
| 4262 | viewportIndex, viewport.x, limits.viewportBoundsRange[0], limits.viewportBoundsRange[1], |
| 4263 | validation_error_map[VALIDATION_ERROR_01450]); |
| 4264 | } |
| 4265 | |
| 4266 | if (viewport.y < limits.viewportBoundsRange[0] || viewport.y > limits.viewportBoundsRange[1]) { |
| 4267 | skip |= |
| 4268 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4269 | VALIDATION_ERROR_01450, LayerName, "vkCmdSetViewport %d: y (%f) exceeds permitted bounds (%f,%f). %s", |
| 4270 | viewportIndex, viewport.y, limits.viewportBoundsRange[0], limits.viewportBoundsRange[1], |
| 4271 | validation_error_map[VALIDATION_ERROR_01450]); |
| 4272 | } |
| 4273 | |
| 4274 | if (viewport.x + viewport.width > limits.viewportBoundsRange[1]) { |
| 4275 | skip |= |
| 4276 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4277 | VALIDATION_ERROR_01451, LayerName, |
| 4278 | "vkCmdSetViewport %d: x (%f) + width (%f) exceeds permitted bound (%f). %s", viewportIndex, viewport.x, |
| 4279 | viewport.width, limits.viewportBoundsRange[1], validation_error_map[VALIDATION_ERROR_01451]); |
| 4280 | } |
| 4281 | |
| 4282 | if (viewport.y + viewport.height > limits.viewportBoundsRange[1]) { |
| 4283 | skip |= |
| 4284 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4285 | VALIDATION_ERROR_01452, LayerName, |
| 4286 | "vkCmdSetViewport %d: y (%f) + height (%f) exceeds permitted bound (%f). %s", viewportIndex, viewport.y, |
| 4287 | viewport.height, limits.viewportBoundsRange[1], validation_error_map[VALIDATION_ERROR_01452]); |
| 4288 | } |
| 4289 | } |
| 4290 | } |
| 4291 | |
Mark Lobodzinski | 5a24296 | 2016-10-28 12:57:23 -0600 | [diff] [blame] | 4292 | return skip; |
| 4293 | } |
| 4294 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4295 | VKAPI_ATTR void VKAPI_CALL CmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
| 4296 | const VkViewport *pViewports) { |
Mark Lobodzinski | b79b773 | 2016-10-28 12:59:47 -0600 | [diff] [blame] | 4297 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4298 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4299 | assert(my_data != NULL); |
| 4300 | |
Mark Lobodzinski | 147e692 | 2017-03-01 15:45:52 -0700 | [diff] [blame] | 4301 | skip |= preCmdSetViewport(my_data, firstViewport, viewportCount, pViewports); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4302 | |
Mark Lobodzinski | b79b773 | 2016-10-28 12:59:47 -0600 | [diff] [blame] | 4303 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4304 | my_data->dispatch_table.CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4305 | } |
Courtney Goeltzenleuchter | 078f817 | 2015-09-21 11:44:06 -0600 | [diff] [blame] | 4306 | } |
| 4307 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4308 | VKAPI_ATTR void VKAPI_CALL CmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, |
| 4309 | const VkRect2D *pScissors) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4310 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4311 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4312 | assert(my_data != NULL); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4313 | debug_report_data *report_data = my_data->report_data; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4314 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4315 | skip |= parameter_validation_vkCmdSetScissor(my_data->report_data, firstScissor, scissorCount, pScissors); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4316 | |
Mark Lobodzinski | 147e692 | 2017-03-01 15:45:52 -0700 | [diff] [blame] | 4317 | if (my_data->physical_device_features.multiViewport == false) { |
| 4318 | if (scissorCount != 1) { |
| 4319 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4320 | DEVICE_FEATURE, LayerName, |
| 4321 | "vkCmdSetScissor(): The multiViewport feature is not enabled, so scissorCount must be 1 but is %d.", |
| 4322 | scissorCount); |
| 4323 | } |
| 4324 | if (firstScissor != 0) { |
| 4325 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4326 | DEVICE_FEATURE, LayerName, |
| 4327 | "vkCmdSetScissor(): The multiViewport feature is not enabled, so firstScissor must be 0 but is %d.", |
| 4328 | firstScissor); |
| 4329 | } |
| 4330 | } |
| 4331 | |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4332 | for (uint32_t scissorIndex = 0; scissorIndex < scissorCount; ++scissorIndex) { |
| 4333 | const VkRect2D &pScissor = pScissors[scissorIndex]; |
| 4334 | |
| 4335 | if (pScissor.offset.x < 0) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4336 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4337 | VALIDATION_ERROR_01489, LayerName, "vkCmdSetScissor %d: offset.x (%d) must not be negative. %s", |
| 4338 | scissorIndex, pScissor.offset.x, validation_error_map[VALIDATION_ERROR_01489]); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4339 | } else if (static_cast<int32_t>(pScissor.extent.width) > (INT_MAX - pScissor.offset.x)) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4340 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4341 | VALIDATION_ERROR_01490, LayerName, |
| 4342 | "vkCmdSetScissor %d: adding offset.x (%d) and extent.width (%u) will overflow. %s", scissorIndex, |
| 4343 | pScissor.offset.x, pScissor.extent.width, validation_error_map[VALIDATION_ERROR_01490]); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4344 | } |
| 4345 | |
| 4346 | if (pScissor.offset.y < 0) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4347 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4348 | VALIDATION_ERROR_01489, LayerName, "vkCmdSetScissor %d: offset.y (%d) must not be negative. %s", |
| 4349 | scissorIndex, pScissor.offset.y, validation_error_map[VALIDATION_ERROR_01489]); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4350 | } else if (static_cast<int32_t>(pScissor.extent.height) > (INT_MAX - pScissor.offset.y)) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4351 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4352 | VALIDATION_ERROR_01491, LayerName, |
| 4353 | "vkCmdSetScissor %d: adding offset.y (%d) and extent.height (%u) will overflow. %s", scissorIndex, |
| 4354 | pScissor.offset.y, pScissor.extent.height, validation_error_map[VALIDATION_ERROR_01491]); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4355 | } |
| 4356 | } |
| 4357 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4358 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4359 | my_data->dispatch_table.CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4360 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4361 | } |
| 4362 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4363 | VKAPI_ATTR void VKAPI_CALL CmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4364 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4365 | my_data->dispatch_table.CmdSetLineWidth(commandBuffer, lineWidth); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4366 | } |
| 4367 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4368 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, |
| 4369 | float depthBiasSlopeFactor) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4370 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4371 | my_data->dispatch_table.CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4372 | } |
| 4373 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4374 | VKAPI_ATTR void VKAPI_CALL CmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4375 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4376 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4377 | assert(my_data != NULL); |
| 4378 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4379 | skip |= parameter_validation_vkCmdSetBlendConstants(my_data->report_data, blendConstants); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4380 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4381 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4382 | my_data->dispatch_table.CmdSetBlendConstants(commandBuffer, blendConstants); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4383 | } |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 4384 | } |
| 4385 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4386 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4387 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4388 | my_data->dispatch_table.CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds); |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 4389 | } |
| 4390 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4391 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, |
| 4392 | uint32_t compareMask) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4393 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4394 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4395 | assert(my_data != NULL); |
| 4396 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4397 | skip |= parameter_validation_vkCmdSetStencilCompareMask(my_data->report_data, faceMask, compareMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4398 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4399 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4400 | my_data->dispatch_table.CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4401 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4402 | } |
| 4403 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4404 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4405 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4406 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4407 | assert(my_data != NULL); |
| 4408 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4409 | skip |= parameter_validation_vkCmdSetStencilWriteMask(my_data->report_data, faceMask, writeMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4410 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4411 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4412 | my_data->dispatch_table.CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4413 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4414 | } |
| 4415 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4416 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4417 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4418 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4419 | assert(my_data != NULL); |
| 4420 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4421 | skip |= parameter_validation_vkCmdSetStencilReference(my_data->report_data, faceMask, reference); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4422 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4423 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4424 | my_data->dispatch_table.CmdSetStencilReference(commandBuffer, faceMask, reference); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4425 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4426 | } |
| 4427 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4428 | VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 4429 | VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, |
| 4430 | const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, |
| 4431 | const uint32_t *pDynamicOffsets) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4432 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4433 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4434 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4435 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4436 | skip |= parameter_validation_vkCmdBindDescriptorSets(my_data->report_data, pipelineBindPoint, layout, firstSet, |
| 4437 | descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4438 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4439 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4440 | my_data->dispatch_table.CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, |
| 4441 | pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4442 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4443 | } |
| 4444 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4445 | VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 4446 | VkIndexType indexType) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4447 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4448 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4449 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4450 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4451 | skip |= parameter_validation_vkCmdBindIndexBuffer(my_data->report_data, buffer, offset, indexType); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4452 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4453 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4454 | my_data->dispatch_table.CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4455 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4456 | } |
| 4457 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4458 | VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, |
| 4459 | const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4460 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4461 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4462 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4463 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4464 | skip |= parameter_validation_vkCmdBindVertexBuffers(my_data->report_data, firstBinding, bindingCount, pBuffers, pOffsets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4465 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4466 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4467 | my_data->dispatch_table.CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4468 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4469 | } |
| 4470 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4471 | static bool PreCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4472 | uint32_t firstInstance) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4473 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4474 | if (vertexCount == 0) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4475 | // TODO: Verify against Valid Usage section. I don't see a non-zero vertexCount listed, may need to add that and make |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 4476 | // this an error or leave as is. |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4477 | log_msg(my_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4478 | REQUIRED_PARAMETER, LayerName, "vkCmdDraw parameter, uint32_t vertexCount, is 0"); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4479 | return false; |
| 4480 | } |
| 4481 | |
| 4482 | if (instanceCount == 0) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4483 | // TODO: Verify against Valid Usage section. I don't see a non-zero instanceCount listed, may need to add that and make |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 4484 | // this an error or leave as is. |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4485 | log_msg(my_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4486 | REQUIRED_PARAMETER, LayerName, "vkCmdDraw parameter, uint32_t instanceCount, is 0"); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4487 | return false; |
| 4488 | } |
| 4489 | |
| 4490 | return true; |
| 4491 | } |
| 4492 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4493 | VKAPI_ATTR void VKAPI_CALL CmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, |
| 4494 | uint32_t firstVertex, uint32_t firstInstance) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4495 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4496 | PreCmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4497 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4498 | my_data->dispatch_table.CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4499 | } |
| 4500 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4501 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, |
| 4502 | uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4503 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4504 | my_data->dispatch_table.CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4505 | } |
| 4506 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4507 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, |
| 4508 | uint32_t stride) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4509 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4510 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4511 | assert(my_data != NULL); |
| 4512 | |
Mark Lobodzinski | 33d8c9b | 2017-02-28 14:18:04 -0700 | [diff] [blame] | 4513 | if (!my_data->physical_device_features.multiDrawIndirect && ((count > 1))) { |
| 4514 | skip = log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4515 | DEVICE_FEATURE, LayerName, |
| 4516 | "CmdDrawIndirect(): Device feature multiDrawIndirect disabled: count must be 0 or 1 but is %d", count); |
| 4517 | } |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4518 | skip |= parameter_validation_vkCmdDrawIndirect(my_data->report_data, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4519 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4520 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4521 | my_data->dispatch_table.CmdDrawIndirect(commandBuffer, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4522 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4523 | } |
| 4524 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4525 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 4526 | uint32_t count, uint32_t stride) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4527 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4528 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4529 | assert(my_data != NULL); |
Mark Lobodzinski | 33d8c9b | 2017-02-28 14:18:04 -0700 | [diff] [blame] | 4530 | if (!my_data->physical_device_features.multiDrawIndirect && ((count > 1))) { |
| 4531 | skip = |
| 4532 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4533 | DEVICE_FEATURE, LayerName, |
| 4534 | "CmdDrawIndexedIndirect(): Device feature multiDrawIndirect disabled: count must be 0 or 1 but is %d", count); |
| 4535 | } |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4536 | skip |= parameter_validation_vkCmdDrawIndexedIndirect(my_data->report_data, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4537 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4538 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4539 | my_data->dispatch_table.CmdDrawIndexedIndirect(commandBuffer, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4540 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4541 | } |
| 4542 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4543 | VKAPI_ATTR void VKAPI_CALL CmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4544 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4545 | my_data->dispatch_table.CmdDispatch(commandBuffer, x, y, z); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4546 | } |
| 4547 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4548 | VKAPI_ATTR void VKAPI_CALL CmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4549 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4550 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4551 | assert(my_data != NULL); |
| 4552 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4553 | skip |= parameter_validation_vkCmdDispatchIndirect(my_data->report_data, buffer, offset); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4554 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4555 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4556 | my_data->dispatch_table.CmdDispatchIndirect(commandBuffer, buffer, offset); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4557 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4558 | } |
| 4559 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4560 | VKAPI_ATTR void VKAPI_CALL CmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, |
| 4561 | uint32_t regionCount, const VkBufferCopy *pRegions) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4562 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4563 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4564 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4565 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4566 | skip |= parameter_validation_vkCmdCopyBuffer(my_data->report_data, srcBuffer, dstBuffer, regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4567 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4568 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4569 | my_data->dispatch_table.CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4570 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4571 | } |
| 4572 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4573 | static bool PreCmdCopyImage(VkCommandBuffer commandBuffer, const VkImageCopy *pRegions) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4574 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4575 | if (pRegions != nullptr) { |
| 4576 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4577 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4578 | log_msg( |
| 4579 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4580 | VALIDATION_ERROR_01225, LayerName, |
| 4581 | "vkCmdCopyImage() parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator. %s", |
| 4582 | validation_error_map[VALIDATION_ERROR_01225]); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4583 | return false; |
| 4584 | } |
| 4585 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4586 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4587 | log_msg( |
| 4588 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4589 | VALIDATION_ERROR_01225, LayerName, |
| 4590 | "vkCmdCopyImage() parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator. %s", |
| 4591 | validation_error_map[VALIDATION_ERROR_01225]); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4592 | return false; |
| 4593 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4594 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4595 | |
| 4596 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4597 | } |
| 4598 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4599 | VKAPI_ATTR void VKAPI_CALL CmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4600 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4601 | const VkImageCopy *pRegions) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4602 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4603 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4604 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4605 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4606 | skip |= parameter_validation_vkCmdCopyImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4607 | regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4608 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4609 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4610 | PreCmdCopyImage(commandBuffer, pRegions); |
| 4611 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4612 | my_data->dispatch_table.CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, |
| 4613 | pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4614 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4615 | } |
| 4616 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4617 | static bool PreCmdBlitImage(VkCommandBuffer commandBuffer, const VkImageBlit *pRegions) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4618 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4619 | if (pRegions != nullptr) { |
| 4620 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4621 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4622 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4623 | UNRECOGNIZED_VALUE, LayerName, |
Mike Weiblen | fa0fd07 | 2017-01-06 16:20:51 -0700 | [diff] [blame] | 4624 | "vkCmdBlitImage() parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4625 | return false; |
| 4626 | } |
| 4627 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4628 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4629 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4630 | UNRECOGNIZED_VALUE, LayerName, |
Mike Weiblen | fa0fd07 | 2017-01-06 16:20:51 -0700 | [diff] [blame] | 4631 | "vkCmdBlitImage() parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4632 | return false; |
| 4633 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4634 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4635 | |
| 4636 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4637 | } |
| 4638 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4639 | VKAPI_ATTR void VKAPI_CALL CmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4640 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4641 | const VkImageBlit *pRegions, VkFilter filter) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4642 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4643 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4644 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4645 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4646 | skip |= parameter_validation_vkCmdBlitImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4647 | regionCount, pRegions, filter); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4648 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4649 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4650 | PreCmdBlitImage(commandBuffer, pRegions); |
| 4651 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4652 | my_data->dispatch_table.CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, |
| 4653 | pRegions, filter); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4654 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4655 | } |
| 4656 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4657 | static bool PreCmdCopyBufferToImage(VkCommandBuffer commandBuffer, const VkBufferImageCopy *pRegions) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4658 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4659 | if (pRegions != nullptr) { |
| 4660 | if ((pRegions->imageSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4661 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4662 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4663 | UNRECOGNIZED_VALUE, LayerName, |
Mike Weiblen | fa0fd07 | 2017-01-06 16:20:51 -0700 | [diff] [blame] | 4664 | "vkCmdCopyBufferToImage() parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4665 | "enumerator"); |
| 4666 | return false; |
| 4667 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4668 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4669 | |
| 4670 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4671 | } |
| 4672 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4673 | VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, |
| 4674 | VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4675 | const VkBufferImageCopy *pRegions) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4676 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4677 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4678 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4679 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4680 | skip |= parameter_validation_vkCmdCopyBufferToImage(my_data->report_data, srcBuffer, dstImage, dstImageLayout, regionCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4681 | pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4682 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4683 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4684 | PreCmdCopyBufferToImage(commandBuffer, pRegions); |
| 4685 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4686 | my_data->dispatch_table.CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4687 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4688 | } |
| 4689 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4690 | static bool PreCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, const VkBufferImageCopy *pRegions) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4691 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4692 | if (pRegions != nullptr) { |
| 4693 | if ((pRegions->imageSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4694 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4695 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4696 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4697 | "vkCmdCopyImageToBuffer parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
| 4698 | "enumerator"); |
| 4699 | return false; |
| 4700 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4701 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4702 | |
| 4703 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4704 | } |
| 4705 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4706 | VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4707 | VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4708 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4709 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4710 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4711 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4712 | skip |= parameter_validation_vkCmdCopyImageToBuffer(my_data->report_data, srcImage, srcImageLayout, dstBuffer, regionCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4713 | pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4714 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4715 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4716 | PreCmdCopyImageToBuffer(commandBuffer, pRegions); |
| 4717 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4718 | my_data->dispatch_table.CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4719 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4720 | } |
| 4721 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4722 | VKAPI_ATTR void VKAPI_CALL CmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
Mark Lobodzinski | a2d9384 | 2017-02-08 16:28:18 -0700 | [diff] [blame] | 4723 | VkDeviceSize dataSize, const void *pData) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4724 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4725 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4726 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4727 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4728 | skip |= parameter_validation_vkCmdUpdateBuffer(my_data->report_data, dstBuffer, dstOffset, dataSize, pData); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4729 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4730 | if (dstOffset & 3) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4731 | skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
| 4732 | VALIDATION_ERROR_01147, LayerName, |
| 4733 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4. %s", |
| 4734 | dstOffset, validation_error_map[VALIDATION_ERROR_01147]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4735 | } |
| 4736 | |
| 4737 | if ((dataSize <= 0) || (dataSize > 65536)) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4738 | skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4739 | VALIDATION_ERROR_01148, LayerName, "vkCmdUpdateBuffer() parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 |
| 4740 | "), must be greater than zero and less than or equal to 65536. %s", |
| 4741 | dataSize, validation_error_map[VALIDATION_ERROR_01148]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4742 | } else if (dataSize & 3) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4743 | skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
| 4744 | VALIDATION_ERROR_01149, LayerName, |
| 4745 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 "), is not a multiple of 4. %s", |
| 4746 | dataSize, validation_error_map[VALIDATION_ERROR_01149]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4747 | } |
| 4748 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4749 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4750 | my_data->dispatch_table.CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4751 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4752 | } |
| 4753 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4754 | VKAPI_ATTR void VKAPI_CALL CmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 4755 | VkDeviceSize size, uint32_t data) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4756 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4757 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4758 | assert(my_data != NULL); |
| 4759 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4760 | skip |= parameter_validation_vkCmdFillBuffer(my_data->report_data, dstBuffer, dstOffset, size, data); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4761 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4762 | if (dstOffset & 3) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4763 | skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
| 4764 | VALIDATION_ERROR_01133, LayerName, |
| 4765 | "vkCmdFillBuffer() parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4. %s", |
| 4766 | dstOffset, validation_error_map[VALIDATION_ERROR_01133]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4767 | } |
| 4768 | |
| 4769 | if (size != VK_WHOLE_SIZE) { |
| 4770 | if (size <= 0) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4771 | skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
| 4772 | VALIDATION_ERROR_01134, LayerName, |
| 4773 | "vkCmdFillBuffer() parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), must be greater than zero. %s", |
| 4774 | size, validation_error_map[VALIDATION_ERROR_01134]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4775 | } else if (size & 3) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4776 | skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4777 | VALIDATION_ERROR_01136, LayerName, |
| 4778 | "vkCmdFillBuffer() parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), is not a multiple of 4. %s", size, |
| 4779 | validation_error_map[VALIDATION_ERROR_01136]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4780 | } |
| 4781 | } |
| 4782 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4783 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4784 | my_data->dispatch_table.CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4785 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4786 | } |
| 4787 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4788 | VKAPI_ATTR void VKAPI_CALL CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 4789 | const VkClearColorValue *pColor, uint32_t rangeCount, |
| 4790 | const VkImageSubresourceRange *pRanges) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4791 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4792 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4793 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4794 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4795 | skip |= parameter_validation_vkCmdClearColorImage(my_data->report_data, image, imageLayout, pColor, rangeCount, pRanges); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4796 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4797 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4798 | my_data->dispatch_table.CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4799 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4800 | } |
| 4801 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4802 | VKAPI_ATTR void VKAPI_CALL CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 4803 | const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, |
| 4804 | const VkImageSubresourceRange *pRanges) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4805 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4806 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4807 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4808 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4809 | skip |= parameter_validation_vkCmdClearDepthStencilImage(my_data->report_data, image, imageLayout, pDepthStencil, rangeCount, |
| 4810 | pRanges); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4811 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4812 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4813 | my_data->dispatch_table.CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4814 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4815 | } |
| 4816 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4817 | VKAPI_ATTR void VKAPI_CALL CmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 4818 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
| 4819 | const VkClearRect *pRects) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4820 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4821 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4822 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4823 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4824 | skip |= parameter_validation_vkCmdClearAttachments(my_data->report_data, attachmentCount, pAttachments, rectCount, pRects); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4825 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4826 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4827 | my_data->dispatch_table.CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4828 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4829 | } |
| 4830 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4831 | static bool PreCmdResolveImage(VkCommandBuffer commandBuffer, const VkImageResolve *pRegions) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4832 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4833 | if (pRegions != nullptr) { |
| 4834 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4835 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 4836 | log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4837 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4838 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4839 | "vkCmdResolveImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 4840 | return false; |
| 4841 | } |
| 4842 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4843 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 4844 | log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4845 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4846 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4847 | "vkCmdResolveImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 4848 | return false; |
| 4849 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4850 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4851 | |
| 4852 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4853 | } |
| 4854 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4855 | VKAPI_ATTR void VKAPI_CALL CmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4856 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4857 | const VkImageResolve *pRegions) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4858 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4859 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4860 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4861 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4862 | skip |= parameter_validation_vkCmdResolveImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4863 | regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4864 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4865 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4866 | PreCmdResolveImage(commandBuffer, pRegions); |
| 4867 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4868 | my_data->dispatch_table.CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, |
| 4869 | pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4870 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4871 | } |
| 4872 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4873 | VKAPI_ATTR void VKAPI_CALL CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4874 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4875 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4876 | assert(my_data != NULL); |
| 4877 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4878 | skip |= parameter_validation_vkCmdSetEvent(my_data->report_data, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4879 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4880 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4881 | my_data->dispatch_table.CmdSetEvent(commandBuffer, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4882 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4883 | } |
| 4884 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4885 | VKAPI_ATTR void VKAPI_CALL CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4886 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4887 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4888 | assert(my_data != NULL); |
| 4889 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4890 | skip |= parameter_validation_vkCmdResetEvent(my_data->report_data, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4891 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4892 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4893 | my_data->dispatch_table.CmdResetEvent(commandBuffer, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4894 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4895 | } |
| 4896 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4897 | VKAPI_ATTR void VKAPI_CALL CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, |
| 4898 | VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, |
| 4899 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 4900 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 4901 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4902 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4903 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4904 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4905 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4906 | skip |= parameter_validation_vkCmdWaitEvents(my_data->report_data, eventCount, pEvents, srcStageMask, dstStageMask, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4907 | memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, |
| 4908 | pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4909 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4910 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4911 | my_data->dispatch_table.CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, |
| 4912 | pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, |
| 4913 | imageMemoryBarrierCount, pImageMemoryBarriers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4914 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4915 | } |
| 4916 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4917 | VKAPI_ATTR void VKAPI_CALL CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, |
| 4918 | VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, |
| 4919 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 4920 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 4921 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4922 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4923 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4924 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4925 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4926 | skip |= parameter_validation_vkCmdPipelineBarrier(my_data->report_data, srcStageMask, dstStageMask, dependencyFlags, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4927 | memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, |
| 4928 | pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4929 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4930 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4931 | my_data->dispatch_table.CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, |
| 4932 | pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, |
| 4933 | imageMemoryBarrierCount, pImageMemoryBarriers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4934 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4935 | } |
| 4936 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4937 | VKAPI_ATTR void VKAPI_CALL CmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot, |
| 4938 | VkQueryControlFlags flags) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4939 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4940 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4941 | assert(my_data != NULL); |
| 4942 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4943 | skip |= parameter_validation_vkCmdBeginQuery(my_data->report_data, queryPool, slot, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4944 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4945 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4946 | my_data->dispatch_table.CmdBeginQuery(commandBuffer, queryPool, slot, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4947 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4948 | } |
| 4949 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4950 | VKAPI_ATTR void VKAPI_CALL CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4951 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4952 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4953 | assert(my_data != NULL); |
| 4954 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4955 | skip |= parameter_validation_vkCmdEndQuery(my_data->report_data, queryPool, slot); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4956 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4957 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4958 | my_data->dispatch_table.CmdEndQuery(commandBuffer, queryPool, slot); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4959 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4960 | } |
| 4961 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4962 | VKAPI_ATTR void VKAPI_CALL CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 4963 | uint32_t queryCount) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4964 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4965 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4966 | assert(my_data != NULL); |
| 4967 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4968 | skip |= parameter_validation_vkCmdResetQueryPool(my_data->report_data, queryPool, firstQuery, queryCount); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4969 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4970 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4971 | my_data->dispatch_table.CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4972 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4973 | } |
| 4974 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4975 | bool PostCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, |
| 4976 | uint32_t slot) { |
Chia-I Wu | 51ce5ea | 2015-10-26 19:40:27 +0800 | [diff] [blame] | 4977 | ValidateEnumerator(pipelineStage); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4978 | |
| 4979 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4980 | } |
| 4981 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4982 | VKAPI_ATTR void VKAPI_CALL CmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, |
| 4983 | VkQueryPool queryPool, uint32_t query) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4984 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4985 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4986 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4987 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4988 | skip |= parameter_validation_vkCmdWriteTimestamp(my_data->report_data, pipelineStage, queryPool, query); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4989 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4990 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4991 | my_data->dispatch_table.CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4992 | |
| 4993 | PostCmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 4994 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4995 | } |
| 4996 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4997 | VKAPI_ATTR void VKAPI_CALL CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 4998 | uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 4999 | VkDeviceSize stride, VkQueryResultFlags flags) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5000 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5001 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 5002 | assert(my_data != NULL); |
| 5003 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5004 | skip |= parameter_validation_vkCmdCopyQueryPoolResults(my_data->report_data, queryPool, firstQuery, queryCount, dstBuffer, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5005 | dstOffset, stride, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 5006 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5007 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5008 | my_data->dispatch_table.CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, |
| 5009 | stride, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 5010 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 5011 | } |
| 5012 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5013 | VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, |
| 5014 | uint32_t offset, uint32_t size, const void *pValues) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5015 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5016 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5017 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 5018 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5019 | skip |= parameter_validation_vkCmdPushConstants(my_data->report_data, layout, stageFlags, offset, size, pValues); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 5020 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5021 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5022 | my_data->dispatch_table.CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5023 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 5024 | } |
| 5025 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5026 | VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, |
| 5027 | VkSubpassContents contents) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5028 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5029 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5030 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 5031 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5032 | skip |= parameter_validation_vkCmdBeginRenderPass(my_data->report_data, pRenderPassBegin, contents); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 5033 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5034 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5035 | my_data->dispatch_table.CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5036 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 5037 | } |
| 5038 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5039 | VKAPI_ATTR void VKAPI_CALL CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5040 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5041 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 5042 | assert(my_data != NULL); |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 5043 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5044 | skip |= parameter_validation_vkCmdNextSubpass(my_data->report_data, contents); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 5045 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5046 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5047 | my_data->dispatch_table.CmdNextSubpass(commandBuffer, contents); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 5048 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 5049 | } |
| 5050 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5051 | VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5052 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5053 | my_data->dispatch_table.CmdEndRenderPass(commandBuffer); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 5054 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 5055 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5056 | VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, |
| 5057 | const VkCommandBuffer *pCommandBuffers) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5058 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5059 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5060 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 5061 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5062 | skip |= parameter_validation_vkCmdExecuteCommands(my_data->report_data, commandBufferCount, pCommandBuffers); |
Chia-I Wu | 0b50a1c | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 5063 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5064 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5065 | my_data->dispatch_table.CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5066 | } |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 5067 | } |
| 5068 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5069 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5070 | return util_GetLayerProperties(1, &global_layer, pCount, pProperties); |
| 5071 | } |
| 5072 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5073 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 5074 | VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5075 | return util_GetLayerProperties(1, &global_layer, pCount, pProperties); |
| 5076 | } |
| 5077 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5078 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 5079 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5080 | if (pLayerName && !strcmp(pLayerName, global_layer.layerName)) |
| 5081 | return util_GetExtensionProperties(1, instance_extensions, pCount, pProperties); |
| 5082 | |
| 5083 | return VK_ERROR_LAYER_NOT_PRESENT; |
| 5084 | } |
| 5085 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5086 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, |
| 5087 | uint32_t *pCount, VkExtensionProperties *pProperties) { |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5088 | /* parameter_validation does not have any physical device extensions */ |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5089 | if (pLayerName && !strcmp(pLayerName, global_layer.layerName)) return util_GetExtensionProperties(0, NULL, pCount, pProperties); |
Chia-I Wu | 76a3466 | 2016-05-16 07:34:09 +0800 | [diff] [blame] | 5090 | |
| 5091 | assert(physicalDevice); |
| 5092 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5093 | return GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map) |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5094 | ->dispatch_table.EnumerateDeviceExtensionProperties(physicalDevice, NULL, pCount, pProperties); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5095 | } |
| 5096 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5097 | static bool require_device_extension(layer_data *my_data, bool flag, char const *function_name, char const *extension_name) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5098 | if (!flag) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5099 | return log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 5100 | EXTENSION_NOT_ENABLED, LayerName, |
| 5101 | "%s() called even though the %s extension was not enabled for this VkDevice.", function_name, |
| 5102 | extension_name); |
Chris Forbes | 448ebcb | 2016-11-03 09:29:52 +1300 | [diff] [blame] | 5103 | } |
| 5104 | |
| 5105 | return false; |
| 5106 | } |
| 5107 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5108 | // WSI Extension Functions |
| 5109 | |
| 5110 | VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5111 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5112 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5113 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5114 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5115 | assert(my_data != NULL); |
| 5116 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5117 | skip |= require_device_extension(my_data, my_data->enables.khr_swapchain_enabled, "vkCreateSwapchainKHR", |
| 5118 | VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5119 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5120 | skip |= parameter_validation_vkCreateSwapchainKHR(my_data->report_data, pCreateInfo, pAllocator, pSwapchain); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5121 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5122 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5123 | result = my_data->dispatch_table.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5124 | |
| 5125 | validate_result(my_data->report_data, "vkCreateSwapchainKHR", result); |
| 5126 | } |
| 5127 | |
| 5128 | return result; |
| 5129 | } |
| 5130 | |
| 5131 | VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5132 | VkImage *pSwapchainImages) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5133 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5134 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5135 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5136 | assert(my_data != NULL); |
| 5137 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5138 | skip |= require_device_extension(my_data, my_data->enables.khr_swapchain_enabled, "vkGetSwapchainImagesKHR", |
| 5139 | VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5140 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5141 | skip |= parameter_validation_vkGetSwapchainImagesKHR(my_data->report_data, swapchain, pSwapchainImageCount, pSwapchainImages); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5142 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5143 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5144 | result = my_data->dispatch_table.GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5145 | |
| 5146 | validate_result(my_data->report_data, "vkGetSwapchainImagesKHR", result); |
| 5147 | } |
| 5148 | |
| 5149 | return result; |
| 5150 | } |
| 5151 | |
| 5152 | VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5153 | VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5154 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5155 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5156 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5157 | assert(my_data != NULL); |
| 5158 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5159 | skip |= require_device_extension(my_data, my_data->enables.khr_swapchain_enabled, "vkAcquireNextImageKHR", |
| 5160 | VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5161 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5162 | skip |= parameter_validation_vkAcquireNextImageKHR(my_data->report_data, swapchain, timeout, semaphore, fence, pImageIndex); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5163 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5164 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5165 | result = my_data->dispatch_table.AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5166 | |
| 5167 | validate_result(my_data->report_data, "vkAcquireNextImageKHR", result); |
| 5168 | } |
| 5169 | |
| 5170 | return result; |
| 5171 | } |
| 5172 | |
| 5173 | VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { |
| 5174 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5175 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5176 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5177 | assert(my_data != NULL); |
| 5178 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5179 | skip |= require_device_extension(my_data, my_data->enables.khr_swapchain_enabled, "vkQueuePresentKHR", |
| 5180 | VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5181 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5182 | skip |= parameter_validation_vkQueuePresentKHR(my_data->report_data, pPresentInfo); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5183 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5184 | result = my_data->dispatch_table.QueuePresentKHR(queue, pPresentInfo); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5185 | |
| 5186 | validate_result(my_data->report_data, "vkQueuePresentKHR", result); |
| 5187 | } |
| 5188 | |
| 5189 | return result; |
| 5190 | } |
| 5191 | |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5192 | VKAPI_ATTR void VKAPI_CALL DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5193 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5194 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5195 | assert(my_data != NULL); |
| 5196 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5197 | skip |= require_device_extension(my_data, my_data->enables.khr_swapchain_enabled, "vkDestroySwapchainKHR", |
| 5198 | VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5199 | |
| 5200 | /* No generated validation function for this call */ |
| 5201 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5202 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5203 | my_data->dispatch_table.DestroySwapchainKHR(device, swapchain, pAllocator); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5204 | } |
| 5205 | } |
| 5206 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5207 | static bool require_instance_extension(void *instance, bool instance_extension_enables::*flag, char const *function_name, |
| 5208 | char const *extension_name) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5209 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 5210 | if (!(my_data->extensions.*flag)) { |
Chris Forbes | 115f98c | 2016-11-03 09:51:48 +1300 | [diff] [blame] | 5211 | return log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, |
| 5212 | reinterpret_cast<uint64_t>(instance), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5213 | "%s() called even though the %s extension was not enabled for this VkInstance.", function_name, |
| 5214 | extension_name); |
Chris Forbes | 115f98c | 2016-11-03 09:51:48 +1300 | [diff] [blame] | 5215 | } |
| 5216 | |
| 5217 | return false; |
| 5218 | } |
| 5219 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5220 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, |
| 5221 | VkSurfaceKHR surface, VkBool32 *pSupported) { |
| 5222 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5223 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5224 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5225 | assert(my_data != NULL); |
| 5226 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5227 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::surface_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5228 | "vkGetPhysicalDeviceSurfaceSupportKHR", VK_KHR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 8a13e27 | 2016-11-02 17:43:34 +1300 | [diff] [blame] | 5229 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5230 | skip |= parameter_validation_vkGetPhysicalDeviceSurfaceSupportKHR(my_data->report_data, queueFamilyIndex, surface, pSupported); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5231 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5232 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5233 | result = my_data->dispatch_table.GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5234 | |
| 5235 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceSupportKHR", result); |
| 5236 | } |
| 5237 | |
| 5238 | return result; |
| 5239 | } |
| 5240 | |
| 5241 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 5242 | VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { |
| 5243 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5244 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5245 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5246 | assert(my_data != NULL); |
| 5247 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5248 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::surface_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5249 | "vkGetPhysicalDeviceSurfaceCapabilitiesKHR", VK_KHR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 8a13e27 | 2016-11-02 17:43:34 +1300 | [diff] [blame] | 5250 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5251 | skip |= parameter_validation_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(my_data->report_data, surface, pSurfaceCapabilities); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5252 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5253 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5254 | result = my_data->dispatch_table.GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5255 | |
| 5256 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR", result); |
| 5257 | } |
| 5258 | |
| 5259 | return result; |
| 5260 | } |
| 5261 | |
| 5262 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 5263 | uint32_t *pSurfaceFormatCount, |
| 5264 | VkSurfaceFormatKHR *pSurfaceFormats) { |
| 5265 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5266 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5267 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5268 | assert(my_data != NULL); |
| 5269 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5270 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::surface_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5271 | "vkGetPhysicalDeviceSurfaceFormatsKHR", VK_KHR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 8a13e27 | 2016-11-02 17:43:34 +1300 | [diff] [blame] | 5272 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5273 | skip |= parameter_validation_vkGetPhysicalDeviceSurfaceFormatsKHR(my_data->report_data, surface, pSurfaceFormatCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5274 | pSurfaceFormats); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5275 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5276 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5277 | result = my_data->dispatch_table.GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, |
| 5278 | pSurfaceFormats); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5279 | |
| 5280 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceFormatsKHR", result); |
| 5281 | } |
| 5282 | |
| 5283 | return result; |
| 5284 | } |
| 5285 | |
| 5286 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 5287 | uint32_t *pPresentModeCount, |
| 5288 | VkPresentModeKHR *pPresentModes) { |
| 5289 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5290 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5291 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5292 | assert(my_data != NULL); |
| 5293 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5294 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::surface_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5295 | "vkGetPhysicalDeviceSurfacePresentModesKHR", VK_KHR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 8a13e27 | 2016-11-02 17:43:34 +1300 | [diff] [blame] | 5296 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5297 | skip |= parameter_validation_vkGetPhysicalDeviceSurfacePresentModesKHR(my_data->report_data, surface, pPresentModeCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5298 | pPresentModes); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5299 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5300 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5301 | result = my_data->dispatch_table.GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, |
| 5302 | pPresentModes); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5303 | |
| 5304 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfacePresentModesKHR", result); |
| 5305 | } |
| 5306 | |
| 5307 | return result; |
| 5308 | } |
| 5309 | |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5310 | VKAPI_ATTR void VKAPI_CALL DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5311 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5312 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5313 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5314 | skip |= require_instance_extension(instance, &instance_extension_enables::surface_enabled, "vkDestroySurfaceKHR", |
| 5315 | VK_KHR_SURFACE_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5316 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5317 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5318 | my_data->dispatch_table.DestroySurfaceKHR(instance, surface, pAllocator); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5319 | } |
| 5320 | } |
| 5321 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5322 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 5323 | VKAPI_ATTR VkResult VKAPI_CALL CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
| 5324 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 5325 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5326 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5327 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5328 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5329 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5330 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5331 | skip |= require_instance_extension(instance, &instance_extension_enables::win32_enabled, "vkCreateWin32SurfaceKHR", |
| 5332 | VK_KHR_WIN32_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5333 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5334 | skip |= parameter_validation_vkCreateWin32SurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5335 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5336 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5337 | result = my_data->dispatch_table.CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5338 | } |
| 5339 | |
| 5340 | validate_result(my_data->report_data, "vkCreateWin32SurfaceKHR", result); |
| 5341 | |
| 5342 | return result; |
| 5343 | } |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5344 | |
| 5345 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5346 | uint32_t queueFamilyIndex) { |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5347 | VkBool32 result = false; |
| 5348 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5349 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5350 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5351 | bool skip = false; |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5352 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5353 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::win32_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5354 | "vkGetPhysicalDeviceWin32PresentationSupportKHR", VK_KHR_WIN32_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5355 | |
Chris Forbes | 7281a50 | 2016-11-08 08:45:03 +1300 | [diff] [blame] | 5356 | // TODO: codegen doesn't produce this function? |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5357 | // skip |= parameter_validation_vkGetPhysicalDeviceWin32PresentationSupportKHR(physicalDevice, queueFamilyIndex); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5358 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5359 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5360 | result = my_data->dispatch_table.GetPhysicalDeviceWin32PresentationSupportKHR(physicalDevice, queueFamilyIndex); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5361 | } |
| 5362 | |
| 5363 | return result; |
| 5364 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5365 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5366 | |
| 5367 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 5368 | VKAPI_ATTR VkResult VKAPI_CALL CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, |
| 5369 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 5370 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5371 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5372 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5373 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5374 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5375 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5376 | skip |= require_instance_extension(instance, &instance_extension_enables::xcb_enabled, "vkCreateXcbSurfaceKHR", |
| 5377 | VK_KHR_XCB_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5378 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5379 | skip |= parameter_validation_vkCreateXcbSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5380 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5381 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5382 | result = my_data->dispatch_table.CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5383 | } |
| 5384 | |
| 5385 | validate_result(my_data->report_data, "vkCreateXcbSurfaceKHR", result); |
| 5386 | |
| 5387 | return result; |
| 5388 | } |
| 5389 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5390 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5391 | uint32_t queueFamilyIndex, xcb_connection_t *connection, |
| 5392 | xcb_visualid_t visual_id) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5393 | VkBool32 result = false; |
| 5394 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5395 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5396 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5397 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5398 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5399 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::xcb_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5400 | "vkGetPhysicalDeviceXcbPresentationSupportKHR", VK_KHR_XCB_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5401 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5402 | skip |= parameter_validation_vkGetPhysicalDeviceXcbPresentationSupportKHR(my_data->report_data, queueFamilyIndex, connection, |
| 5403 | visual_id); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5404 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5405 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5406 | result = my_data->dispatch_table.GetPhysicalDeviceXcbPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection, |
| 5407 | visual_id); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5408 | } |
| 5409 | |
| 5410 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5411 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5412 | #endif // VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5413 | |
| 5414 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 5415 | VKAPI_ATTR VkResult VKAPI_CALL CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5416 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5417 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5418 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5419 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5420 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5421 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5422 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5423 | skip |= require_instance_extension(instance, &instance_extension_enables::xlib_enabled, "vkCreateXlibSurfaceKHR", |
| 5424 | VK_KHR_XLIB_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5425 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5426 | skip |= parameter_validation_vkCreateXlibSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5427 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5428 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5429 | result = my_data->dispatch_table.CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5430 | } |
| 5431 | |
| 5432 | validate_result(my_data->report_data, "vkCreateXlibSurfaceKHR", result); |
| 5433 | |
| 5434 | return result; |
| 5435 | } |
| 5436 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5437 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5438 | uint32_t queueFamilyIndex, Display *dpy, |
| 5439 | VisualID visualID) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5440 | VkBool32 result = false; |
| 5441 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5442 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5443 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5444 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5445 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5446 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::xlib_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5447 | "vkGetPhysicalDeviceXlibPresentationSupportKHR", VK_KHR_XLIB_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5448 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5449 | skip |= |
| 5450 | parameter_validation_vkGetPhysicalDeviceXlibPresentationSupportKHR(my_data->report_data, queueFamilyIndex, dpy, visualID); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5451 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5452 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5453 | result = |
| 5454 | my_data->dispatch_table.GetPhysicalDeviceXlibPresentationSupportKHR(physicalDevice, queueFamilyIndex, dpy, visualID); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5455 | } |
Karl Schultz | 3a41cae | 2016-09-02 10:17:05 -0600 | [diff] [blame] | 5456 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5457 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5458 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5459 | |
| 5460 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 5461 | VKAPI_ATTR VkResult VKAPI_CALL CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5462 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5463 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5464 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5465 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5466 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5467 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5468 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5469 | skip |= require_instance_extension(instance, &instance_extension_enables::mir_enabled, "vkCreateMirSurfaceKHR", |
| 5470 | VK_KHR_MIR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5471 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5472 | skip |= parameter_validation_vkCreateMirSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5473 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5474 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5475 | result = my_data->dispatch_table.CreateMirSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5476 | } |
| 5477 | |
| 5478 | validate_result(my_data->report_data, "vkCreateMirSurfaceKHR", result); |
| 5479 | |
| 5480 | return result; |
| 5481 | } |
| 5482 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5483 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5484 | uint32_t queueFamilyIndex, MirConnection *connection) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5485 | VkBool32 result = false; |
| 5486 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5487 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5488 | assert(my_data != NULL); |
| 5489 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5490 | bool skip = false; |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5491 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5492 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::mir_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5493 | "vkGetPhysicalDeviceMirPresentationSupportKHR", VK_KHR_MIR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 115f98c | 2016-11-03 09:51:48 +1300 | [diff] [blame] | 5494 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5495 | skip |= parameter_validation_vkGetPhysicalDeviceMirPresentationSupportKHR(my_data->report_data, queueFamilyIndex, connection); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5496 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5497 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5498 | result = my_data->dispatch_table.GetPhysicalDeviceMirPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5499 | } |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5500 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5501 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5502 | #endif // VK_USE_PLATFORM_MIR_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5503 | |
| 5504 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 5505 | VKAPI_ATTR VkResult VKAPI_CALL CreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5506 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5507 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5508 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5509 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5510 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5511 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5512 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5513 | skip |= require_instance_extension(instance, &instance_extension_enables::wayland_enabled, "vkCreateWaylandSurfaceKHR", |
| 5514 | VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); |
Chris Forbes | 115f98c | 2016-11-03 09:51:48 +1300 | [diff] [blame] | 5515 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5516 | skip |= parameter_validation_vkCreateWaylandSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5517 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5518 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5519 | result = my_data->dispatch_table.CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5520 | } |
| 5521 | |
| 5522 | validate_result(my_data->report_data, "vkCreateWaylandSurfaceKHR", result); |
| 5523 | |
| 5524 | return result; |
| 5525 | } |
| 5526 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5527 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5528 | uint32_t queueFamilyIndex, |
| 5529 | struct wl_display *display) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5530 | VkBool32 result = false; |
| 5531 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5532 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5533 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5534 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5535 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5536 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::wayland_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5537 | "vkGetPhysicalDeviceWaylandPresentationSupportKHR", VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); |
Chris Forbes | 115f98c | 2016-11-03 09:51:48 +1300 | [diff] [blame] | 5538 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5539 | skip |= parameter_validation_vkGetPhysicalDeviceWaylandPresentationSupportKHR(my_data->report_data, queueFamilyIndex, display); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5540 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5541 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5542 | result = my_data->dispatch_table.GetPhysicalDeviceWaylandPresentationSupportKHR(physicalDevice, queueFamilyIndex, display); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5543 | } |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5544 | |
| 5545 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5546 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5547 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5548 | |
| 5549 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 5550 | VKAPI_ATTR VkResult VKAPI_CALL CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5551 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5552 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5553 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5554 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5555 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5556 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5557 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5558 | skip |= require_instance_extension(instance, &instance_extension_enables::android_enabled, "vkCreateAndroidSurfaceKHR", |
| 5559 | VK_KHR_ANDROID_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5560 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5561 | skip |= parameter_validation_vkCreateAndroidSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5562 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5563 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5564 | result = my_data->dispatch_table.CreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5565 | } |
| 5566 | |
| 5567 | validate_result(my_data->report_data, "vkCreateAndroidSurfaceKHR", result); |
| 5568 | |
| 5569 | return result; |
| 5570 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5571 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5572 | |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5573 | VKAPI_ATTR VkResult VKAPI_CALL CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, |
| 5574 | const VkSwapchainCreateInfoKHR *pCreateInfos, |
| 5575 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) { |
| 5576 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5577 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5578 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5579 | assert(my_data != NULL); |
| 5580 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5581 | skip |= require_device_extension(my_data, my_data->enables.khr_display_swapchain_enabled, "vkCreateSharedSwapchainsKHR", |
| 5582 | VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5583 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5584 | skip |= parameter_validation_vkCreateSharedSwapchainsKHR(my_data->report_data, swapchainCount, pCreateInfos, pAllocator, |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5585 | pSwapchains); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5586 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5587 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5588 | result = my_data->dispatch_table.CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5589 | |
| 5590 | validate_result(my_data->report_data, "vkCreateSharedSwapchainsKHR", result); |
| 5591 | } |
| 5592 | |
| 5593 | return result; |
| 5594 | } |
| 5595 | |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5596 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 5597 | VkDisplayPropertiesKHR *pProperties) { |
| 5598 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5599 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5600 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5601 | assert(my_data != NULL); |
| 5602 | |
| 5603 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, |
| 5604 | "vkGetPhysicalDeviceDisplayPropertiesKHR", VK_KHR_DISPLAY_EXTENSION_NAME); |
| 5605 | |
| 5606 | // No parameter validation function for this call? |
| 5607 | |
| 5608 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5609 | result = my_data->dispatch_table.GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, pPropertyCount, pProperties); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5610 | |
| 5611 | validate_result(my_data->report_data, "vkGetPhysicalDeviceDisplayPropertiesKHR", result); |
| 5612 | } |
| 5613 | |
| 5614 | return result; |
| 5615 | } |
| 5616 | |
| 5617 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 5618 | VkDisplayPlanePropertiesKHR *pProperties) { |
| 5619 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5620 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5621 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5622 | assert(my_data != NULL); |
| 5623 | |
| 5624 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, |
| 5625 | "vkGetPhysicalDeviceDisplayPlanePropertiesKHR", VK_KHR_DISPLAY_EXTENSION_NAME); |
| 5626 | |
| 5627 | // No parameter validation function for this call? |
| 5628 | |
| 5629 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5630 | result = my_data->dispatch_table.GetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, pPropertyCount, pProperties); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5631 | |
| 5632 | validate_result(my_data->report_data, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR", result); |
| 5633 | } |
| 5634 | |
| 5635 | return result; |
| 5636 | } |
| 5637 | |
| 5638 | VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, |
| 5639 | uint32_t *pDisplayCount, VkDisplayKHR *pDisplays) { |
| 5640 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5641 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5642 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5643 | assert(my_data != NULL); |
| 5644 | |
| 5645 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, |
| 5646 | "vkGetDisplayPlaneSupportedDisplaysKHR", VK_KHR_DISPLAY_EXTENSION_NAME); |
| 5647 | |
| 5648 | // No parameter validation function for this call? |
| 5649 | |
| 5650 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5651 | result = my_data->dispatch_table.GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, pDisplayCount, pDisplays); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5652 | |
| 5653 | validate_result(my_data->report_data, "vkGetDisplayPlaneSupportedDisplaysKHR", result); |
| 5654 | } |
| 5655 | |
| 5656 | return result; |
| 5657 | } |
| 5658 | |
| 5659 | VKAPI_ATTR VkResult VKAPI_CALL GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 5660 | uint32_t *pPropertyCount, VkDisplayModePropertiesKHR *pProperties) { |
| 5661 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5662 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5663 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5664 | assert(my_data != NULL); |
| 5665 | |
| 5666 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, |
| 5667 | "vkGetDisplayModePropertiesKHR", VK_KHR_DISPLAY_EXTENSION_NAME); |
| 5668 | |
| 5669 | // No parameter validation function for this call? |
| 5670 | |
| 5671 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5672 | result = my_data->dispatch_table.GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, pProperties); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5673 | |
| 5674 | validate_result(my_data->report_data, "vkGetDisplayModePropertiesKHR", result); |
| 5675 | } |
| 5676 | |
| 5677 | return result; |
| 5678 | } |
| 5679 | |
| 5680 | VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 5681 | const VkDisplayModeCreateInfoKHR *pCreateInfo, |
| 5682 | const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) { |
| 5683 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5684 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5685 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5686 | assert(my_data != NULL); |
| 5687 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5688 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, "vkCreateDisplayModeKHR", |
| 5689 | VK_KHR_DISPLAY_EXTENSION_NAME); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5690 | |
| 5691 | // No parameter validation function for this call? |
| 5692 | |
| 5693 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5694 | result = my_data->dispatch_table.CreateDisplayModeKHR(physicalDevice, display, pCreateInfo, pAllocator, pMode); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5695 | |
| 5696 | validate_result(my_data->report_data, "vkCreateDisplayModeKHR", result); |
| 5697 | } |
| 5698 | |
| 5699 | return result; |
| 5700 | } |
| 5701 | |
| 5702 | VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, |
| 5703 | uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR *pCapabilities) { |
| 5704 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5705 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5706 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5707 | assert(my_data != NULL); |
| 5708 | |
| 5709 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, |
| 5710 | "vkGetDisplayPlaneCapabilitiesKHR", VK_KHR_DISPLAY_EXTENSION_NAME); |
| 5711 | |
| 5712 | // No parameter validation function for this call? |
| 5713 | |
| 5714 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5715 | result = my_data->dispatch_table.GetDisplayPlaneCapabilitiesKHR(physicalDevice, mode, planeIndex, pCapabilities); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5716 | |
| 5717 | validate_result(my_data->report_data, "vkGetDisplayPlaneCapabilitiesKHR", result); |
| 5718 | } |
| 5719 | |
| 5720 | return result; |
| 5721 | } |
| 5722 | |
| 5723 | VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayPlaneSurfaceKHR(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, |
| 5724 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 5725 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5726 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5727 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5728 | assert(my_data != NULL); |
| 5729 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5730 | skip |= require_instance_extension(instance, &instance_extension_enables::display_enabled, "vkCreateDisplayPlaneSurfaceKHR", |
| 5731 | VK_KHR_DISPLAY_EXTENSION_NAME); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5732 | |
| 5733 | // No parameter validation function for this call? |
| 5734 | |
| 5735 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5736 | result = my_data->dispatch_table.CreateDisplayPlaneSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5737 | |
| 5738 | validate_result(my_data->report_data, "vkCreateDisplayPlaneSurfaceKHR", result); |
| 5739 | } |
| 5740 | |
| 5741 | return result; |
| 5742 | } |
| 5743 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5744 | // Definitions for the VK_KHR_get_physical_device_properties2 extension |
| 5745 | |
| 5746 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR *pFeatures) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5747 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5748 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5749 | assert(my_data != NULL); |
| 5750 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5751 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5752 | "vkGetPhysicalDeviceFeatures2KHR", VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5753 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5754 | skip |= parameter_validation_vkGetPhysicalDeviceFeatures2KHR(my_data->report_data, pFeatures); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5755 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5756 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5757 | my_data->dispatch_table.GetPhysicalDeviceFeatures2KHR(physicalDevice, pFeatures); |
| 5758 | } |
| 5759 | } |
| 5760 | |
| 5761 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, |
| 5762 | VkPhysicalDeviceProperties2KHR *pProperties) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5763 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5764 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5765 | assert(my_data != NULL); |
| 5766 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5767 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5768 | "vkGetPhysicalDeviceProperties2KHR", VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5769 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5770 | skip |= parameter_validation_vkGetPhysicalDeviceProperties2KHR(my_data->report_data, pProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5771 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5772 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5773 | my_data->dispatch_table.GetPhysicalDeviceProperties2KHR(physicalDevice, pProperties); |
| 5774 | } |
| 5775 | } |
| 5776 | |
| 5777 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, |
| 5778 | VkFormatProperties2KHR *pFormatProperties) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5779 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5780 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5781 | assert(my_data != NULL); |
| 5782 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5783 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5784 | "vkGetPhysicalDeviceFormatProperties2KHR", |
| 5785 | VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5786 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5787 | skip |= parameter_validation_vkGetPhysicalDeviceFormatProperties2KHR(my_data->report_data, format, pFormatProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5788 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5789 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5790 | my_data->dispatch_table.GetPhysicalDeviceFormatProperties2KHR(physicalDevice, format, pFormatProperties); |
| 5791 | } |
| 5792 | } |
| 5793 | |
| 5794 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties2KHR( |
| 5795 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo, |
| 5796 | VkImageFormatProperties2KHR *pImageFormatProperties) { |
| 5797 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5798 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5799 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5800 | assert(my_data != NULL); |
| 5801 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5802 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5803 | "vkGetPhysicalDeviceImageFormatProperties2KHR", |
| 5804 | VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5805 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5806 | skip |= parameter_validation_vkGetPhysicalDeviceImageFormatProperties2KHR(my_data->report_data, pImageFormatInfo, |
| 5807 | pImageFormatProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5808 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5809 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5810 | result = my_data->dispatch_table.GetPhysicalDeviceImageFormatProperties2KHR(physicalDevice, pImageFormatInfo, |
| 5811 | pImageFormatProperties); |
| 5812 | validate_result(my_data->report_data, "vkGetPhysicalDeviceImageFormatProperties2KHR", result); |
| 5813 | } |
| 5814 | |
| 5815 | return result; |
| 5816 | } |
| 5817 | |
| 5818 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physicalDevice, |
| 5819 | uint32_t *pQueueFamilyPropertyCount, |
| 5820 | VkQueueFamilyProperties2KHR *pQueueFamilyProperties) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5821 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5822 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5823 | assert(my_data != NULL); |
| 5824 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5825 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5826 | "vkGetPhysicalDeviceQueueFamilyProperties2KHR", |
| 5827 | VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5828 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5829 | skip |= parameter_validation_vkGetPhysicalDeviceQueueFamilyProperties2KHR(my_data->report_data, pQueueFamilyPropertyCount, |
| 5830 | pQueueFamilyProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5831 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5832 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5833 | my_data->dispatch_table.GetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice, pQueueFamilyPropertyCount, |
| 5834 | pQueueFamilyProperties); |
| 5835 | } |
| 5836 | } |
| 5837 | |
| 5838 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physicalDevice, |
| 5839 | VkPhysicalDeviceMemoryProperties2KHR *pMemoryProperties) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5840 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5841 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5842 | assert(my_data != NULL); |
| 5843 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5844 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5845 | "vkGetPhysicalDeviceMemoryProperties2KHR", |
| 5846 | VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5847 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5848 | skip |= parameter_validation_vkGetPhysicalDeviceMemoryProperties2KHR(my_data->report_data, pMemoryProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5849 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5850 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5851 | my_data->dispatch_table.GetPhysicalDeviceMemoryProperties2KHR(physicalDevice, pMemoryProperties); |
| 5852 | } |
| 5853 | } |
| 5854 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5855 | static bool PostGetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, |
| 5856 | const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, |
| 5857 | uint32_t *pPropertyCount, |
| 5858 | VkSparseImageFormatProperties2KHR *pProperties) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5859 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5860 | if (pProperties != nullptr) { |
| 5861 | for (uint32_t i = 0; i < *pPropertyCount; ++i) { |
| 5862 | if ((pProperties[i].properties.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 5863 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 5864 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 5865 | 1, LayerName, |
| 5866 | "vkGetPhysicalDeviceSparseImageFormatProperties2KHR parameter, VkImageAspect " |
| 5867 | "pProperties[%i].properties.aspectMask, is an " |
| 5868 | "unrecognized enumerator", |
| 5869 | i); |
| 5870 | return false; |
| 5871 | } |
| 5872 | } |
| 5873 | } |
| 5874 | return true; |
| 5875 | } |
| 5876 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5877 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties2KHR( |
| 5878 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, uint32_t *pPropertyCount, |
| 5879 | VkSparseImageFormatProperties2KHR *pProperties) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5880 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5881 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5882 | assert(my_data != NULL); |
| 5883 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5884 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5885 | "vkGetPhysicalDeviceSparseImageFormatProperties2KHR", |
| 5886 | VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5887 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5888 | skip |= parameter_validation_vkGetPhysicalDeviceSparseImageFormatProperties2KHR(my_data->report_data, pFormatInfo, |
| 5889 | pPropertyCount, pProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5890 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5891 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5892 | my_data->dispatch_table.GetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice, pFormatInfo, pPropertyCount, |
| 5893 | pProperties); |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5894 | PostGetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice, pFormatInfo, pPropertyCount, pProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5895 | } |
| 5896 | } |
| 5897 | |
| 5898 | // Definitions for the VK_KHR_maintenance1 extension |
| 5899 | |
| 5900 | VKAPI_ATTR void VKAPI_CALL TrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlagsKHR flags) { |
| 5901 | bool skip_call = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5902 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5903 | assert(my_data != NULL); |
| 5904 | |
| 5905 | skip_call |= require_device_extension(my_data, my_data->enables.khr_maintenance1, "vkTrimCommandPoolKHR", |
| 5906 | VK_KHR_MAINTENANCE1_EXTENSION_NAME); |
| 5907 | |
| 5908 | skip_call |= parameter_validation_vkTrimCommandPoolKHR(my_data->report_data, commandPool, flags); |
| 5909 | |
| 5910 | if (!skip_call) { |
| 5911 | my_data->dispatch_table.TrimCommandPoolKHR(device, commandPool, flags); |
| 5912 | } |
| 5913 | } |
| 5914 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5915 | // Definitions for the VK_KHR_push_descriptor extension |
| 5916 | |
| 5917 | VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 5918 | VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, |
| 5919 | const VkWriteDescriptorSet *pDescriptorWrites) { |
| 5920 | bool skip_call = false; |
| 5921 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5922 | assert(my_data != NULL); |
| 5923 | |
| 5924 | skip_call |= require_device_extension(my_data, my_data->enables.khr_push_descriptor, "vkCmdPushDescriptorSetKHR", |
| 5925 | VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); |
| 5926 | |
| 5927 | skip_call |= parameter_validation_vkCmdPushDescriptorSetKHR(my_data->report_data, pipelineBindPoint, layout, set, |
| 5928 | descriptorWriteCount, pDescriptorWrites); |
| 5929 | |
| 5930 | if (!skip_call) { |
| 5931 | my_data->dispatch_table.CmdPushDescriptorSetKHR(commandBuffer, pipelineBindPoint, layout, set, descriptorWriteCount, |
| 5932 | pDescriptorWrites); |
| 5933 | } |
| 5934 | } |
| 5935 | |
| 5936 | // Definitions for the VK_KHR_descriptor_update_template extension |
| 5937 | |
| 5938 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorUpdateTemplateKHR(VkDevice device, |
| 5939 | const VkDescriptorUpdateTemplateCreateInfoKHR *pCreateInfo, |
| 5940 | const VkAllocationCallbacks *pAllocator, |
| 5941 | VkDescriptorUpdateTemplateKHR *pDescriptorUpdateTemplate) { |
| 5942 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5943 | bool skip_call = false; |
| 5944 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5945 | assert(my_data != NULL); |
| 5946 | |
| 5947 | skip_call |= require_device_extension(my_data, my_data->enables.khr_descriptor_update_template, |
| 5948 | "vkCreateDescriptorUpdateTemplateKHR", VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); |
| 5949 | |
| 5950 | skip_call |= parameter_validation_vkCreateDescriptorUpdateTemplateKHR(my_data->report_data, pCreateInfo, pAllocator, |
| 5951 | pDescriptorUpdateTemplate); |
| 5952 | |
| 5953 | if (!skip_call) { |
| 5954 | result = |
| 5955 | my_data->dispatch_table.CreateDescriptorUpdateTemplateKHR(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate); |
| 5956 | validate_result(my_data->report_data, "vkCreateDescriptorUpdateTemplateKHR", result); |
| 5957 | } |
| 5958 | |
| 5959 | return result; |
| 5960 | } |
| 5961 | |
| 5962 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorUpdateTemplateKHR(VkDevice device, |
| 5963 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, |
| 5964 | const VkAllocationCallbacks *pAllocator) { |
| 5965 | bool skip_call = false; |
| 5966 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5967 | assert(my_data != NULL); |
| 5968 | |
| 5969 | skip_call |= require_device_extension(my_data, my_data->enables.khr_descriptor_update_template, |
| 5970 | "vkDestroyDescriptorUpdateTemplateKHR", VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); |
| 5971 | |
| 5972 | #if 0 // Validation not automatically generated |
| 5973 | skip_call |= parameter_validation_vkDestroyDescriptorUpdateTemplateKHR(my_data->report_data, descriptorUpdateTemplate, |
| 5974 | pAllocator); |
| 5975 | #endif |
| 5976 | |
| 5977 | if (!skip_call) { |
| 5978 | my_data->dispatch_table.DestroyDescriptorUpdateTemplateKHR(device, descriptorUpdateTemplate, pAllocator); |
| 5979 | } |
| 5980 | } |
| 5981 | |
| 5982 | VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSetWithTemplateKHR(VkDevice device, VkDescriptorSet descriptorSet, |
| 5983 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, |
| 5984 | const void *pData) { |
| 5985 | bool skip_call = false; |
| 5986 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5987 | assert(my_data != NULL); |
| 5988 | |
| 5989 | skip_call |= require_device_extension(my_data, my_data->enables.khr_descriptor_update_template, |
| 5990 | "vkUpdateDescriptorSetWithTemplateKHR", VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); |
| 5991 | |
| 5992 | skip_call |= parameter_validation_vkUpdateDescriptorSetWithTemplateKHR(my_data->report_data, descriptorSet, |
| 5993 | descriptorUpdateTemplate, pData); |
| 5994 | |
| 5995 | if (!skip_call) { |
| 5996 | my_data->dispatch_table.UpdateDescriptorSetWithTemplateKHR(device, descriptorSet, descriptorUpdateTemplate, pData); |
| 5997 | } |
| 5998 | } |
| 5999 | |
| 6000 | VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer, |
| 6001 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, |
| 6002 | VkPipelineLayout layout, uint32_t set, const void *pData) { |
| 6003 | bool skip_call = false; |
| 6004 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6005 | assert(my_data != NULL); |
| 6006 | |
| 6007 | skip_call |= |
| 6008 | require_device_extension(my_data, my_data->enables.khr_descriptor_update_template, "vkCmdPushDescriptorSetWithTemplateKHR", |
| 6009 | VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); |
| 6010 | |
| 6011 | skip_call |= parameter_validation_vkCmdPushDescriptorSetWithTemplateKHR(my_data->report_data, descriptorUpdateTemplate, layout, |
| 6012 | set, pData); |
| 6013 | |
| 6014 | if (!skip_call) { |
| 6015 | my_data->dispatch_table.CmdPushDescriptorSetWithTemplateKHR(commandBuffer, descriptorUpdateTemplate, layout, set, pData); |
| 6016 | } |
| 6017 | } |
| 6018 | |
| 6019 | // Definitions for the VK_KHX_device_group_creation extension |
| 6020 | |
| 6021 | VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceGroupsKHX( |
| 6022 | VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupPropertiesKHX *pPhysicalDeviceGroupProperties) { |
| 6023 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6024 | bool skip_call = false; |
| 6025 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
| 6026 | assert(my_data != NULL); |
| 6027 | |
| 6028 | skip_call |= require_instance_extension(instance, &instance_extension_enables::khx_device_group_creation_enabled, |
| 6029 | "vkEnumeratePhysicalDeviceGroupsKHX", VK_KHX_DEVICE_GROUP_CREATION_EXTENSION_NAME); |
| 6030 | |
| 6031 | skip_call |= parameter_validation_vkEnumeratePhysicalDeviceGroupsKHX(my_data->report_data, pPhysicalDeviceGroupCount, |
| 6032 | pPhysicalDeviceGroupProperties); |
| 6033 | |
| 6034 | if (!skip_call) { |
| 6035 | result = my_data->dispatch_table.EnumeratePhysicalDeviceGroupsKHX(instance, pPhysicalDeviceGroupCount, |
| 6036 | pPhysicalDeviceGroupProperties); |
| 6037 | validate_result(my_data->report_data, "vkEnumeratePhysicalDeviceGroupsKHX", result); |
| 6038 | } |
| 6039 | return result; |
| 6040 | } |
| 6041 | |
| 6042 | // Definitions for the VK_KHX_device_group extension |
| 6043 | |
| 6044 | VKAPI_ATTR void VKAPI_CALL GetDeviceGroupPeerMemoryFeaturesKHX(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, |
| 6045 | uint32_t remoteDeviceIndex, |
| 6046 | VkPeerMemoryFeatureFlagsKHX *pPeerMemoryFeatures) { |
| 6047 | bool skip_call = false; |
| 6048 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6049 | assert(my_data != NULL); |
| 6050 | |
| 6051 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkGetDeviceGroupPeerMemoryFeaturesKHX", |
| 6052 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6053 | |
| 6054 | skip_call |= parameter_validation_vkGetDeviceGroupPeerMemoryFeaturesKHX(my_data->report_data, heapIndex, localDeviceIndex, |
| 6055 | remoteDeviceIndex, pPeerMemoryFeatures); |
| 6056 | |
| 6057 | if (!skip_call) { |
| 6058 | my_data->dispatch_table.GetDeviceGroupPeerMemoryFeaturesKHX(device, heapIndex, localDeviceIndex, remoteDeviceIndex, |
| 6059 | pPeerMemoryFeatures); |
| 6060 | } |
| 6061 | } |
| 6062 | |
| 6063 | VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory2KHX(VkDevice device, uint32_t bindInfoCount, |
| 6064 | const VkBindBufferMemoryInfoKHX *pBindInfos) { |
| 6065 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6066 | bool skip_call = false; |
| 6067 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6068 | assert(my_data != NULL); |
| 6069 | |
| 6070 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkBindBufferMemory2KHX", |
| 6071 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6072 | |
| 6073 | skip_call |= parameter_validation_vkBindBufferMemory2KHX(my_data->report_data, bindInfoCount, pBindInfos); |
| 6074 | |
| 6075 | if (!skip_call) { |
| 6076 | result = my_data->dispatch_table.BindBufferMemory2KHX(device, bindInfoCount, pBindInfos); |
| 6077 | validate_result(my_data->report_data, "vkBindBufferMemory2KHX", result); |
| 6078 | } |
| 6079 | |
| 6080 | return result; |
| 6081 | } |
| 6082 | |
| 6083 | VKAPI_ATTR VkResult VKAPI_CALL BindImageMemory2KHX(VkDevice device, uint32_t bindInfoCount, |
| 6084 | const VkBindImageMemoryInfoKHX *pBindInfos) { |
| 6085 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6086 | bool skip_call = false; |
| 6087 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6088 | assert(my_data != NULL); |
| 6089 | |
| 6090 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkBindImageMemory2KHX", |
| 6091 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6092 | |
| 6093 | skip_call |= parameter_validation_vkBindImageMemory2KHX(my_data->report_data, bindInfoCount, pBindInfos); |
| 6094 | |
| 6095 | if (!skip_call) { |
| 6096 | result = my_data->dispatch_table.BindImageMemory2KHX(device, bindInfoCount, pBindInfos); |
| 6097 | validate_result(my_data->report_data, "vkBindImageMemory2KHX", result); |
| 6098 | } |
| 6099 | |
| 6100 | return result; |
| 6101 | } |
| 6102 | |
| 6103 | VKAPI_ATTR void VKAPI_CALL CmdSetDeviceMaskKHX(VkCommandBuffer commandBuffer, uint32_t deviceMask) { |
| 6104 | bool skip_call = false; |
| 6105 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6106 | assert(my_data != NULL); |
| 6107 | |
| 6108 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkCmdSetDeviceMaskKHX", |
| 6109 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6110 | |
| 6111 | #if 0 // Validation not automatically generated |
| 6112 | skip_call |= parameter_validation_vkCmdSetDeviceMaskKHX(my_data->report_data, deviceMask); |
| 6113 | #endif |
| 6114 | |
| 6115 | if (!skip_call) { |
| 6116 | my_data->dispatch_table.CmdSetDeviceMaskKHX(commandBuffer, deviceMask); |
| 6117 | } |
| 6118 | } |
| 6119 | |
| 6120 | VKAPI_ATTR VkResult VKAPI_CALL |
| 6121 | GetDeviceGroupPresentCapabilitiesKHX(VkDevice device, VkDeviceGroupPresentCapabilitiesKHX *pDeviceGroupPresentCapabilities) { |
| 6122 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6123 | bool skip_call = false; |
| 6124 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6125 | assert(my_data != NULL); |
| 6126 | |
| 6127 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkGetDeviceGroupPresentCapabilitiesKHX", |
| 6128 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6129 | |
| 6130 | skip_call |= parameter_validation_vkGetDeviceGroupPresentCapabilitiesKHX(my_data->report_data, pDeviceGroupPresentCapabilities); |
| 6131 | |
| 6132 | if (!skip_call) { |
| 6133 | result = my_data->dispatch_table.GetDeviceGroupPresentCapabilitiesKHX(device, pDeviceGroupPresentCapabilities); |
| 6134 | validate_result(my_data->report_data, "vkGetDeviceGroupPresentCapabilitiesKHX", result); |
| 6135 | } |
| 6136 | |
| 6137 | return result; |
| 6138 | } |
| 6139 | |
| 6140 | VKAPI_ATTR VkResult VKAPI_CALL GetDeviceGroupSurfacePresentModesKHX(VkDevice device, VkSurfaceKHR surface, |
| 6141 | VkDeviceGroupPresentModeFlagsKHX *pModes) { |
| 6142 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6143 | bool skip_call = false; |
| 6144 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6145 | assert(my_data != NULL); |
| 6146 | |
| 6147 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkGetDeviceGroupSurfacePresentModesKHX", |
| 6148 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6149 | |
| 6150 | skip_call |= parameter_validation_vkGetDeviceGroupSurfacePresentModesKHX(my_data->report_data, surface, pModes); |
| 6151 | |
| 6152 | if (!skip_call) { |
| 6153 | result = my_data->dispatch_table.GetDeviceGroupSurfacePresentModesKHX(device, surface, pModes); |
| 6154 | validate_result(my_data->report_data, "vkGetDeviceGroupSurfacePresentModesKHX", result); |
| 6155 | } |
| 6156 | return result; |
| 6157 | } |
| 6158 | |
| 6159 | VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImage2KHX(VkDevice device, const VkAcquireNextImageInfoKHX *pAcquireInfo, |
| 6160 | uint32_t *pImageIndex) { |
| 6161 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6162 | bool skip_call = false; |
| 6163 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6164 | assert(my_data != NULL); |
| 6165 | |
| 6166 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkAcquireNextImage2KHX", |
| 6167 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6168 | |
| 6169 | skip_call |= parameter_validation_vkAcquireNextImage2KHX(my_data->report_data, pAcquireInfo, pImageIndex); |
| 6170 | |
| 6171 | if (!skip_call) { |
| 6172 | result = my_data->dispatch_table.AcquireNextImage2KHX(device, pAcquireInfo, pImageIndex); |
| 6173 | validate_result(my_data->report_data, "vkAcquireNextImage2KHX", result); |
| 6174 | } |
| 6175 | return result; |
| 6176 | } |
| 6177 | |
| 6178 | VKAPI_ATTR void VKAPI_CALL CmdDispatchBaseKHX(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, |
| 6179 | uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, |
| 6180 | uint32_t groupCountZ) { |
| 6181 | bool skip_call = false; |
| 6182 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6183 | assert(my_data != NULL); |
| 6184 | |
| 6185 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkCmdDispatchBaseKHX", |
| 6186 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6187 | |
| 6188 | #if 0 // Validation not automatically generated |
| 6189 | skip_call |= parameter_validation_vkCmdDispatchBaseKHX(my_data->report_data, baseGroupX, baseGroupY, baseGroupZ, |
| 6190 | groupCountX, groupCountY, groupCountZ); |
| 6191 | #endif |
| 6192 | |
| 6193 | if (!skip_call) { |
| 6194 | my_data->dispatch_table.CmdDispatchBaseKHX(commandBuffer, baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, |
| 6195 | groupCountZ); |
| 6196 | } |
| 6197 | } |
| 6198 | |
| 6199 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDevicePresentRectanglesKHX(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 6200 | uint32_t *pRectCount, VkRect2D *pRects) { |
| 6201 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6202 | bool skip = false; |
| 6203 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
| 6204 | assert(my_data != NULL); |
| 6205 | |
| 6206 | skip |= parameter_validation_vkGetPhysicalDevicePresentRectanglesKHX(my_data->report_data, surface, pRectCount, pRects); |
| 6207 | |
| 6208 | if (!skip) { |
| 6209 | result = my_data->dispatch_table.GetPhysicalDevicePresentRectanglesKHX(physicalDevice, surface, pRectCount, pRects); |
| 6210 | |
| 6211 | validate_result(my_data->report_data, "vkGetPhysicalDevicePresentRectanglesKHX", result); |
| 6212 | } |
| 6213 | |
| 6214 | return result; |
| 6215 | } |
| 6216 | |
| 6217 | // Definitions for the VK_KHX_external_memory_capabilities extension |
| 6218 | |
| 6219 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalBufferPropertiesKHX( |
| 6220 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfoKHX *pExternalBufferInfo, |
| 6221 | VkExternalBufferPropertiesKHX *pExternalBufferProperties) { |
| 6222 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
| 6223 | assert(my_data != NULL); |
| 6224 | bool skip = false; |
| 6225 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khx_external_memory_capabilities_enabled, |
| 6226 | "vkGetPhysicalDeviceExternalBufferPropertiesKHX", |
| 6227 | VK_KHX_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME); |
| 6228 | skip |= parameter_validation_vkGetPhysicalDeviceExternalBufferPropertiesKHX(my_data->report_data, pExternalBufferInfo, |
| 6229 | pExternalBufferProperties); |
| 6230 | if (!skip) { |
| 6231 | my_data->dispatch_table.GetPhysicalDeviceExternalBufferPropertiesKHX(physicalDevice, pExternalBufferInfo, |
| 6232 | pExternalBufferProperties); |
| 6233 | } |
| 6234 | } |
| 6235 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6236 | // Definitions for the VK_KHX_external_memory_fd extension |
| 6237 | |
| 6238 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdKHX(VkDevice device, VkDeviceMemory memory, |
| 6239 | VkExternalMemoryHandleTypeFlagBitsKHX handleType, int *pFd) { |
| 6240 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6241 | bool skip_call = false; |
| 6242 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6243 | assert(my_data != NULL); |
| 6244 | |
| 6245 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_memory_fd, "vkGetMemoryFdKHX", |
| 6246 | VK_KHX_EXTERNAL_MEMORY_FD_EXTENSION_NAME); |
| 6247 | |
| 6248 | skip_call |= parameter_validation_vkGetMemoryFdKHX(my_data->report_data, memory, handleType, pFd); |
| 6249 | |
| 6250 | if (!skip_call) { |
| 6251 | result = my_data->dispatch_table.GetMemoryFdKHX(device, memory, handleType, pFd); |
| 6252 | validate_result(my_data->report_data, "vkGetMemoryFdKHX", result); |
| 6253 | } |
| 6254 | |
| 6255 | return result; |
| 6256 | } |
| 6257 | |
| 6258 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdPropertiesKHX(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHX handleType, int fd, |
| 6259 | VkMemoryFdPropertiesKHX *pMemoryFdProperties) { |
| 6260 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6261 | bool skip_call = false; |
| 6262 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6263 | assert(my_data != NULL); |
| 6264 | |
| 6265 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_memory_fd, "vkGetMemoryFdPropertiesKHX", |
| 6266 | VK_KHX_EXTERNAL_MEMORY_FD_EXTENSION_NAME); |
| 6267 | |
| 6268 | skip_call |= parameter_validation_vkGetMemoryFdPropertiesKHX(my_data->report_data, handleType, fd, pMemoryFdProperties); |
| 6269 | |
| 6270 | if (!skip_call) { |
| 6271 | result = my_data->dispatch_table.GetMemoryFdPropertiesKHX(device, handleType, fd, pMemoryFdProperties); |
| 6272 | validate_result(my_data->report_data, "vkGetMemoryFdPropertiesKHX", result); |
| 6273 | } |
| 6274 | |
| 6275 | return result; |
| 6276 | } |
| 6277 | |
| 6278 | // Definitions for the VK_KHX_external_memory_win32 extension |
| 6279 | |
| 6280 | #ifdef VK_USE_PLATFORM_WIN32_KHX |
| 6281 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleKHX(VkDevice device, VkDeviceMemory memory, |
| 6282 | VkExternalMemoryHandleTypeFlagBitsKHX handleType, HANDLE *pHandle) { |
| 6283 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6284 | bool skip_call = false; |
| 6285 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6286 | assert(my_data != NULL); |
| 6287 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_memory_win32, "vkGetMemoryWin32HandleKHX", |
| 6288 | VK_KHX_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME); |
| 6289 | |
| 6290 | skip_call |= parameter_validation_vkGetMemoryWin32HandleKHX(my_data->report_data, memory, handleType, pHandle); |
| 6291 | |
| 6292 | if (!skip_call) { |
| 6293 | result = my_data->dispatch_table.GetMemoryWin32HandleKHX(device, memory, handleType, pHandle); |
| 6294 | validate_result(my_data->report_data, "vkGetMemoryWin32HandleKHX", result); |
| 6295 | } |
| 6296 | return result; |
| 6297 | } |
| 6298 | |
| 6299 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandlePropertiesKHX(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHX handleType, |
| 6300 | HANDLE handle, |
| 6301 | VkMemoryWin32HandlePropertiesKHX *pMemoryWin32HandleProperties) { |
| 6302 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6303 | bool skip_call = false; |
| 6304 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6305 | assert(my_data != NULL); |
| 6306 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_memory_win32, |
| 6307 | "vkGetMemoryWin32HandlePropertiesKHX", VK_KHX_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME); |
| 6308 | |
| 6309 | skip_call |= parameter_validation_vkGetMemoryWin32HandlePropertiesKHX(my_data->report_data, handleType, handle, |
| 6310 | pMemoryWin32HandleProperties); |
| 6311 | |
| 6312 | if (!skip_call) { |
| 6313 | result = |
| 6314 | my_data->dispatch_table.GetMemoryWin32HandlePropertiesKHX(device, handleType, handle, pMemoryWin32HandleProperties); |
| 6315 | validate_result(my_data->report_data, "vkGetMemoryWin32HandlePropertiesKHX", result); |
| 6316 | } |
| 6317 | return result; |
| 6318 | } |
| 6319 | #endif // VK_USE_PLATFORM_WIN32_KHX |
| 6320 | |
| 6321 | // Definitions for the VK_KHX_external_semaphore_capabilities extension |
| 6322 | |
| 6323 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalSemaphorePropertiesKHX( |
| 6324 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHX *pExternalSemaphoreInfo, |
| 6325 | VkExternalSemaphorePropertiesKHX *pExternalSemaphoreProperties) { |
| 6326 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
| 6327 | assert(my_data != NULL); |
| 6328 | bool skip = false; |
| 6329 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khx_external_memory_capabilities_enabled, |
| 6330 | "vkGetPhysicalDeviceExternalSemaphorePropertiesKHX", |
| 6331 | VK_KHX_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME); |
| 6332 | skip |= parameter_validation_vkGetPhysicalDeviceExternalSemaphorePropertiesKHX(my_data->report_data, pExternalSemaphoreInfo, |
| 6333 | pExternalSemaphoreProperties); |
| 6334 | if (!skip) { |
| 6335 | my_data->dispatch_table.GetPhysicalDeviceExternalSemaphorePropertiesKHX(physicalDevice, pExternalSemaphoreInfo, |
| 6336 | pExternalSemaphoreProperties); |
| 6337 | } |
| 6338 | } |
| 6339 | |
| 6340 | // Definitions for the VK_KHX_external_semaphore_fd extension |
| 6341 | |
| 6342 | VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreFdKHX(VkDevice device, const VkImportSemaphoreFdInfoKHX *pImportSemaphoreFdInfo) { |
| 6343 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6344 | bool skip_call = false; |
| 6345 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6346 | assert(my_data != NULL); |
| 6347 | |
| 6348 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_semaphore_fd, "vkImportSemaphoreFdKHX", |
| 6349 | VK_KHX_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME); |
| 6350 | |
| 6351 | skip_call |= parameter_validation_vkImportSemaphoreFdKHX(my_data->report_data, pImportSemaphoreFdInfo); |
| 6352 | |
| 6353 | if (!skip_call) { |
| 6354 | result = my_data->dispatch_table.ImportSemaphoreFdKHX(device, pImportSemaphoreFdInfo); |
| 6355 | validate_result(my_data->report_data, "vkImportSemaphoreFdKHX", result); |
| 6356 | } |
| 6357 | |
| 6358 | return result; |
| 6359 | } |
| 6360 | |
| 6361 | VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreFdKHX(VkDevice device, VkSemaphore semaphore, |
| 6362 | VkExternalSemaphoreHandleTypeFlagBitsKHX handleType, int *pFd) { |
| 6363 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6364 | bool skip_call = false; |
| 6365 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6366 | assert(my_data != NULL); |
| 6367 | |
| 6368 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_semaphore_fd, "vkGetSemaphoreFdKHX", |
| 6369 | VK_KHX_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME); |
| 6370 | |
| 6371 | skip_call |= parameter_validation_vkGetSemaphoreFdKHX(my_data->report_data, semaphore, handleType, pFd); |
| 6372 | |
| 6373 | if (!skip_call) { |
| 6374 | result = my_data->dispatch_table.GetSemaphoreFdKHX(device, semaphore, handleType, pFd); |
| 6375 | validate_result(my_data->report_data, "vkGetSemaphoreFdKHX", result); |
| 6376 | } |
| 6377 | |
| 6378 | return result; |
| 6379 | } |
| 6380 | |
| 6381 | // Definitions for the VK_KHX_external_semaphore_win32 extension |
| 6382 | |
| 6383 | #ifdef VK_USE_PLATFORM_WIN32_KHX |
| 6384 | VKAPI_ATTR VkResult VKAPI_CALL |
| 6385 | ImportSemaphoreWin32HandleKHX(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHX *pImportSemaphoreWin32HandleInfo) { |
| 6386 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6387 | bool skip_call = false; |
| 6388 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6389 | assert(my_data != NULL); |
| 6390 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_semaphore_win32, "vkImportSemaphoreWin32HandleKHX", |
| 6391 | VK_KHX_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME); |
| 6392 | |
| 6393 | skip_call |= parameter_validation_vkImportSemaphoreWin32HandleKHX(my_data->report_data, pImportSemaphoreWin32HandleInfo); |
| 6394 | if (!skip_call) { |
| 6395 | result = my_data->dispatch_table.ImportSemaphoreWin32HandleKHX(device, pImportSemaphoreWin32HandleInfo); |
| 6396 | validate_result(my_data->report_data, "vkImportSemaphoreWin32HandleKHX", result); |
| 6397 | } |
| 6398 | return result; |
| 6399 | } |
| 6400 | |
| 6401 | VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreWin32HandleKHX(VkDevice device, VkSemaphore semaphore, |
| 6402 | VkExternalSemaphoreHandleTypeFlagBitsKHX handleType, HANDLE *pHandle) { |
| 6403 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6404 | bool skip_call = false; |
| 6405 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6406 | assert(my_data != NULL); |
| 6407 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_semaphore_win32, "vkGetSemaphoreWin32HandleKHX", |
| 6408 | VK_KHX_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME); |
| 6409 | skip_call |= parameter_validation_vkGetSemaphoreWin32HandleKHX(my_data->report_data, semaphore, handleType, pHandle); |
| 6410 | if (!skip_call) { |
| 6411 | result = my_data->dispatch_table.GetSemaphoreWin32HandleKHX(device, semaphore, handleType, pHandle); |
| 6412 | validate_result(my_data->report_data, "vkGetSemaphoreWin32HandleKHX", result); |
| 6413 | } |
| 6414 | return result; |
| 6415 | } |
| 6416 | #endif // VK_USE_PLATFORM_WIN32_KHX |
| 6417 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6418 | // Definitions for the VK_EXT_acquire_xlib_display extension |
| 6419 | |
| 6420 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT |
| 6421 | VKAPI_ATTR VkResult VKAPI_CALL AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, VkDisplayKHR display) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6422 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6423 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6424 | assert(my_data != NULL); |
| 6425 | bool skip = false; |
| 6426 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::ext_acquire_xlib_display_enabled, |
| 6427 | "vkAcquireXlibDisplayEXT", VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME); |
| 6428 | skip |= parameter_validation_vkAcquireXlibDisplayEXT(my_data->report_data, dpy, display); |
| 6429 | if (!skip) { |
| 6430 | result = my_data->dispatch_table.AcquireXlibDisplayEXT(physicalDevice, dpy, display); |
| 6431 | validate_result(my_data->report_data, "vkAcquireXlibDisplayEXT", result); |
| 6432 | } |
| 6433 | return result; |
| 6434 | } |
| 6435 | |
| 6436 | VKAPI_ATTR VkResult VKAPI_CALL GetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, RROutput rrOutput, |
| 6437 | VkDisplayKHR *pDisplay) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6438 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6439 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6440 | assert(my_data != NULL); |
| 6441 | bool skip = false; |
| 6442 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::ext_acquire_xlib_display_enabled, |
| 6443 | "vkGetRandROutputDisplayEXT", VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME); |
| 6444 | skip |= parameter_validation_vkGetRandROutputDisplayEXT(my_data->report_data, dpy, rrOutput, pDisplay); |
| 6445 | if (!skip) { |
| 6446 | result = my_data->dispatch_table.GetRandROutputDisplayEXT(physicalDevice, dpy, rrOutput, pDisplay); |
| 6447 | validate_result(my_data->report_data, "vkGetRandROutputDisplayEXT", result); |
| 6448 | } |
| 6449 | return result; |
| 6450 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 6451 | #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6452 | |
| 6453 | // Definitions for the VK_EXT_debug_marker Extension |
| 6454 | |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6455 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT(VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { |
| 6456 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6457 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6458 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6459 | assert(my_data != NULL); |
| 6460 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6461 | skip |= require_device_extension(my_data, my_data->enables.ext_debug_marker, "vkDebugMarkerSetObjectTagEXT", |
| 6462 | VK_EXT_DEBUG_MARKER_EXTENSION_NAME); |
| 6463 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6464 | skip |= parameter_validation_vkDebugMarkerSetObjectTagEXT(my_data->report_data, pTagInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6465 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6466 | if (!skip) { |
Tobin Ehlis | 8ad4193 | 2016-12-01 09:37:56 -0700 | [diff] [blame] | 6467 | if (my_data->dispatch_table.DebugMarkerSetObjectTagEXT) { |
| 6468 | result = my_data->dispatch_table.DebugMarkerSetObjectTagEXT(device, pTagInfo); |
| 6469 | validate_result(my_data->report_data, "vkDebugMarkerSetObjectTagEXT", result); |
| 6470 | } else { |
| 6471 | result = VK_SUCCESS; |
| 6472 | } |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6473 | } |
| 6474 | |
| 6475 | return result; |
| 6476 | } |
| 6477 | |
| 6478 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT(VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { |
| 6479 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6480 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6481 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6482 | assert(my_data != NULL); |
| 6483 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6484 | skip |= require_device_extension(my_data, my_data->enables.ext_debug_marker, "vkDebugMarkerSetObjectNameEXT", |
| 6485 | VK_EXT_DEBUG_MARKER_EXTENSION_NAME); |
| 6486 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6487 | skip |= parameter_validation_vkDebugMarkerSetObjectNameEXT(my_data->report_data, pNameInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6488 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6489 | if (!skip) { |
Tobin Ehlis | 8ad4193 | 2016-12-01 09:37:56 -0700 | [diff] [blame] | 6490 | if (my_data->dispatch_table.DebugMarkerSetObjectNameEXT) { |
| 6491 | result = my_data->dispatch_table.DebugMarkerSetObjectNameEXT(device, pNameInfo); |
| 6492 | validate_result(my_data->report_data, "vkDebugMarkerSetObjectNameEXT", result); |
| 6493 | } else { |
| 6494 | result = VK_SUCCESS; |
| 6495 | } |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6496 | } |
| 6497 | |
| 6498 | return result; |
| 6499 | } |
| 6500 | |
| 6501 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6502 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6503 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6504 | assert(my_data != NULL); |
| 6505 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6506 | skip |= require_device_extension(my_data, my_data->enables.ext_debug_marker, "vkCmdDebugMarkerBeginEXT", |
| 6507 | VK_EXT_DEBUG_MARKER_EXTENSION_NAME); |
| 6508 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6509 | skip |= parameter_validation_vkCmdDebugMarkerBeginEXT(my_data->report_data, pMarkerInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6510 | |
Tobin Ehlis | 8ad4193 | 2016-12-01 09:37:56 -0700 | [diff] [blame] | 6511 | if (!skip && my_data->dispatch_table.CmdDebugMarkerBeginEXT) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 6512 | my_data->dispatch_table.CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6513 | } |
| 6514 | } |
| 6515 | |
| 6516 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6517 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6518 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6519 | assert(my_data != NULL); |
| 6520 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6521 | skip |= require_device_extension(my_data, my_data->enables.ext_debug_marker, "vkCmdDebugMarkerInsertEXT", |
| 6522 | VK_EXT_DEBUG_MARKER_EXTENSION_NAME); |
| 6523 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6524 | skip |= parameter_validation_vkCmdDebugMarkerInsertEXT(my_data->report_data, pMarkerInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6525 | |
Tobin Ehlis | 8ad4193 | 2016-12-01 09:37:56 -0700 | [diff] [blame] | 6526 | if (!skip && my_data->dispatch_table.CmdDebugMarkerInsertEXT) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 6527 | my_data->dispatch_table.CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6528 | } |
| 6529 | } |
| 6530 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6531 | // Definitions for the VK_EXT_direct_mode_display extension |
| 6532 | |
| 6533 | VKAPI_ATTR VkResult VKAPI_CALL ReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6534 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6535 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6536 | assert(my_data != NULL); |
| 6537 | bool skip = false; |
| 6538 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::ext_direct_mode_display_enabled, |
| 6539 | "vkReleaseDisplayEXT", VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 6540 | #if 0 // Validation not automatically generated |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6541 | skip |= parameter_validation_vkReleaseDisplayEXT(my_data->report_data, display); |
| 6542 | #endif |
| 6543 | if (!skip) { |
| 6544 | result = my_data->dispatch_table.ReleaseDisplayEXT(physicalDevice, display); |
| 6545 | validate_result(my_data->report_data, "vkGetRandROutputDisplayEXT", result); |
| 6546 | } |
| 6547 | return result; |
| 6548 | } |
| 6549 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6550 | // Definitions for the VK_EXT_discard_rectangles extension |
| 6551 | |
| 6552 | VKAPI_ATTR void VKAPI_CALL CmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, |
| 6553 | uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles) { |
| 6554 | bool skip = false; |
| 6555 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6556 | assert(my_data != NULL); |
| 6557 | |
| 6558 | skip |= require_device_extension(my_data, my_data->enables.ext_discard_rectangles, "vkCmdSetDiscardRectangleEXT", |
| 6559 | VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME); |
| 6560 | |
| 6561 | skip |= parameter_validation_vkCmdSetDiscardRectangleEXT(my_data->report_data, firstDiscardRectangle, |
| 6562 | discardRectangleCount, pDiscardRectangles); |
| 6563 | |
| 6564 | if (!skip && my_data->dispatch_table.CmdSetDiscardRectangleEXT) { |
| 6565 | my_data->dispatch_table.CmdSetDiscardRectangleEXT(commandBuffer, firstDiscardRectangle, discardRectangleCount, |
| 6566 | pDiscardRectangles); |
| 6567 | } |
| 6568 | } |
| 6569 | |
| 6570 | // Definitions for the VK_EXT_display_control extension |
| 6571 | |
| 6572 | VKAPI_ATTR VkResult VKAPI_CALL DisplayPowerControlEXT(VkDevice device, VkDisplayKHR display, |
| 6573 | const VkDisplayPowerInfoEXT *pDisplayPowerInfo) { |
| 6574 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6575 | bool skip = false; |
| 6576 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6577 | assert(my_data != NULL); |
| 6578 | |
| 6579 | skip |= require_device_extension(my_data, my_data->enables.ext_display_control, "vkDisplayPowerControlEXT", |
| 6580 | VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME); |
| 6581 | |
| 6582 | skip |= parameter_validation_vkDisplayPowerControlEXT(my_data->report_data, display, pDisplayPowerInfo); |
| 6583 | |
| 6584 | if (!skip) { |
| 6585 | if (my_data->dispatch_table.DisplayPowerControlEXT) { |
| 6586 | result = my_data->dispatch_table.DisplayPowerControlEXT(device, display, pDisplayPowerInfo); |
| 6587 | validate_result(my_data->report_data, "vkDisplayPowerControlEXT", result); |
| 6588 | } else { |
| 6589 | result = VK_SUCCESS; |
| 6590 | } |
| 6591 | } |
| 6592 | |
| 6593 | return result; |
| 6594 | } |
| 6595 | |
| 6596 | VKAPI_ATTR VkResult VKAPI_CALL RegisterDeviceEventEXT(VkDevice device, const VkDeviceEventInfoEXT *pDeviceEventInfo, |
| 6597 | const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
| 6598 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6599 | bool skip = false; |
| 6600 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6601 | assert(my_data != NULL); |
| 6602 | |
| 6603 | skip |= require_device_extension(my_data, my_data->enables.ext_display_control, "vkRegisterDeviceEventEXT", |
| 6604 | VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME); |
| 6605 | |
| 6606 | skip |= parameter_validation_vkRegisterDeviceEventEXT(my_data->report_data, pDeviceEventInfo, pAllocator, pFence); |
| 6607 | |
| 6608 | if (!skip) { |
| 6609 | if (my_data->dispatch_table.RegisterDeviceEventEXT) { |
| 6610 | result = my_data->dispatch_table.RegisterDeviceEventEXT(device, pDeviceEventInfo, pAllocator, pFence); |
| 6611 | validate_result(my_data->report_data, "vkRegisterDeviceEventEXT", result); |
| 6612 | } else { |
| 6613 | result = VK_SUCCESS; |
| 6614 | } |
| 6615 | } |
| 6616 | |
| 6617 | return result; |
| 6618 | } |
| 6619 | |
| 6620 | VKAPI_ATTR VkResult VKAPI_CALL RegisterDisplayEventEXT(VkDevice device, VkDisplayKHR display, |
| 6621 | const VkDisplayEventInfoEXT *pDisplayEventInfo, |
| 6622 | const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
| 6623 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6624 | bool skip = false; |
| 6625 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6626 | assert(my_data != NULL); |
| 6627 | |
| 6628 | skip |= require_device_extension(my_data, my_data->enables.ext_display_control, "vkRegisterDisplayEventEXT", |
| 6629 | VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME); |
| 6630 | |
| 6631 | skip |= parameter_validation_vkRegisterDisplayEventEXT(my_data->report_data, display, pDisplayEventInfo, pAllocator, pFence); |
| 6632 | |
| 6633 | if (!skip) { |
| 6634 | if (my_data->dispatch_table.RegisterDisplayEventEXT) { |
| 6635 | result = my_data->dispatch_table.RegisterDisplayEventEXT(device, display, pDisplayEventInfo, pAllocator, pFence); |
| 6636 | validate_result(my_data->report_data, "vkRegisterDisplayEventEXT", result); |
| 6637 | } else { |
| 6638 | result = VK_SUCCESS; |
| 6639 | } |
| 6640 | } |
| 6641 | |
| 6642 | return result; |
| 6643 | } |
| 6644 | |
| 6645 | VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainCounterEXT(VkDevice device, VkSwapchainKHR swapchain, |
| 6646 | VkSurfaceCounterFlagBitsEXT counter, uint64_t *pCounterValue) { |
| 6647 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6648 | bool skip = false; |
| 6649 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6650 | assert(my_data != NULL); |
| 6651 | |
| 6652 | skip |= require_device_extension(my_data, my_data->enables.ext_display_control, "vkGetSwapchainCounterEXT", |
| 6653 | VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME); |
| 6654 | |
| 6655 | skip |= parameter_validation_vkGetSwapchainCounterEXT(my_data->report_data, swapchain, counter, pCounterValue); |
| 6656 | |
| 6657 | if (!skip) { |
| 6658 | if (my_data->dispatch_table.GetSwapchainCounterEXT) { |
| 6659 | result = my_data->dispatch_table.GetSwapchainCounterEXT(device, swapchain, counter, pCounterValue); |
| 6660 | validate_result(my_data->report_data, "vkGetSwapchainCounterEXT", result); |
| 6661 | } else { |
| 6662 | result = VK_SUCCESS; |
| 6663 | } |
| 6664 | } |
| 6665 | |
| 6666 | return result; |
| 6667 | } |
| 6668 | |
| 6669 | // Definitions for the VK_AMD_draw_indirect_count extension |
| 6670 | |
| 6671 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 6672 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, |
| 6673 | uint32_t stride) { |
| 6674 | bool skip = false; |
| 6675 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6676 | assert(my_data != NULL); |
| 6677 | skip |= require_device_extension(my_data, my_data->enables.amd_draw_indirect_count, "vkCmdDrawIndirectCountAMD", |
| 6678 | VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME); |
| 6679 | skip |= parameter_validation_vkCmdDrawIndirectCountAMD(my_data->report_data, buffer, offset, countBuffer, countBufferOffset, |
| 6680 | maxDrawCount, stride); |
| 6681 | if (!skip) { |
| 6682 | my_data->dispatch_table.CmdDrawIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, |
| 6683 | stride); |
| 6684 | } |
| 6685 | } |
| 6686 | |
| 6687 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 6688 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, |
| 6689 | uint32_t maxDrawCount, uint32_t stride) { |
| 6690 | bool skip = false; |
| 6691 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6692 | assert(my_data != NULL); |
| 6693 | skip |= require_device_extension(my_data, my_data->enables.amd_draw_indirect_count, "vkCmdDrawIndexedIndirectCountAMD", |
| 6694 | VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME); |
| 6695 | skip |= parameter_validation_vkCmdDrawIndexedIndirectCountAMD(my_data->report_data, buffer, offset, countBuffer, |
| 6696 | countBufferOffset, maxDrawCount, stride); |
| 6697 | if (!skip) { |
| 6698 | my_data->dispatch_table.CmdDrawIndexedIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, |
| 6699 | maxDrawCount, stride); |
| 6700 | } |
| 6701 | } |
| 6702 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6703 | // Definitions for the VK_EXT_display_surface_counter extension |
| 6704 | |
| 6705 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 6706 | VkSurfaceCapabilities2EXT *pSurfaceCapabilities) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6707 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6708 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6709 | assert(my_data != NULL); |
| 6710 | bool skip = false; |
| 6711 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::ext_display_surface_counter_enabled, |
| 6712 | "vkGetPhysicalDeviceSurfaceCapabilities2EXT", VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME); |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 6713 | skip |= parameter_validation_vkGetPhysicalDeviceSurfaceCapabilities2EXT(my_data->report_data, surface, pSurfaceCapabilities); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6714 | if (!skip) { |
| 6715 | result = my_data->dispatch_table.GetPhysicalDeviceSurfaceCapabilities2EXT(physicalDevice, surface, pSurfaceCapabilities); |
| 6716 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceCapabilities2EXT", result); |
| 6717 | } |
| 6718 | return result; |
| 6719 | } |
| 6720 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6721 | // Definitions for the VK_NV_clip_space_w_scaling Extension |
| 6722 | |
| 6723 | VKAPI_ATTR void VKAPI_CALL CmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
| 6724 | const VkViewportWScalingNV *pViewportWScalings) { |
| 6725 | bool skip = false; |
| 6726 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6727 | assert(my_data != NULL); |
| 6728 | skip |= require_device_extension(my_data, my_data->enables.amd_draw_indirect_count, "vkCmdSetViewportWScalingNV", |
| 6729 | VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME); |
| 6730 | #if 0 // Validation not automatically generated |
| 6731 | skip |= parameter_validation_vkCmdSetViewportWScalingNV(my_data->report_data, firstViewport, viewportCount, pViewportWScalings); |
| 6732 | #endif |
| 6733 | if (!skip) { |
| 6734 | my_data->dispatch_table.CmdSetViewportWScalingNV(commandBuffer, firstViewport, viewportCount, pViewportWScalings); |
| 6735 | } |
| 6736 | } |
| 6737 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6738 | // Definitions for the VK_NV_external_memory_capabilities Extension |
| 6739 | |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6740 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceExternalImageFormatPropertiesNV( |
| 6741 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, |
| 6742 | VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, |
| 6743 | VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) { |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6744 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6745 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6746 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6747 | assert(my_data != NULL); |
| 6748 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6749 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::nv_external_memory_capabilities_enabled, |
| 6750 | "vkGetPhysicalDeviceExternalImageFormatPropertiesNV", |
| 6751 | VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME); |
| 6752 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6753 | skip |= parameter_validation_vkGetPhysicalDeviceExternalImageFormatPropertiesNV( |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6754 | my_data->report_data, format, type, tiling, usage, flags, externalHandleType, pExternalImageFormatProperties); |
| 6755 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6756 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 6757 | result = my_data->dispatch_table.GetPhysicalDeviceExternalImageFormatPropertiesNV( |
| 6758 | physicalDevice, format, type, tiling, usage, flags, externalHandleType, pExternalImageFormatProperties); |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6759 | |
| 6760 | validate_result(my_data->report_data, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV", result); |
| 6761 | } |
| 6762 | |
| 6763 | return result; |
| 6764 | } |
| 6765 | |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6766 | // VK_NV_external_memory_win32 Extension |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6767 | |
| 6768 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6769 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleNV(VkDevice device, VkDeviceMemory memory, |
| 6770 | VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE *pHandle) { |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6771 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6772 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6773 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6774 | assert(my_data != NULL); |
| 6775 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6776 | skip |= require_device_extension(my_data, my_data->enables.nv_external_memory_win32, "vkGetMemoryWin32HandleNV", |
| 6777 | VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME); |
| 6778 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6779 | skip |= parameter_validation_vkGetMemoryWin32HandleNV(my_data->report_data, memory, handleType, pHandle); |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6780 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6781 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 6782 | result = my_data->dispatch_table.GetMemoryWin32HandleNV(device, memory, handleType, pHandle); |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6783 | } |
| 6784 | |
| 6785 | return result; |
| 6786 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 6787 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6788 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6789 | // VK_NVX_device_generated_commands Extension |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6790 | |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6791 | VKAPI_ATTR void VKAPI_CALL CmdProcessCommandsNVX(VkCommandBuffer commandBuffer, |
| 6792 | const VkCmdProcessCommandsInfoNVX *pProcessCommandsInfo) { |
| 6793 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6794 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6795 | assert(my_data != NULL); |
| 6796 | skip |= require_device_extension(my_data, my_data->enables.nvx_device_generated_commands, "vkCmdProcessCommandsNVX", |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6797 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6798 | skip |= parameter_validation_vkCmdProcessCommandsNVX(my_data->report_data, pProcessCommandsInfo); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6799 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6800 | my_data->dispatch_table.CmdProcessCommandsNVX(commandBuffer, pProcessCommandsInfo); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6801 | } |
| 6802 | } |
| 6803 | |
| 6804 | VKAPI_ATTR void VKAPI_CALL CmdReserveSpaceForCommandsNVX(VkCommandBuffer commandBuffer, |
| 6805 | const VkCmdReserveSpaceForCommandsInfoNVX *pReserveSpaceInfo) { |
| 6806 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6807 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6808 | assert(my_data != NULL); |
| 6809 | skip |= require_device_extension(my_data, my_data->enables.nvx_device_generated_commands, "vkCmdReserveSpaceForCommandsNVX", |
| 6810 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
| 6811 | skip |= parameter_validation_vkCmdReserveSpaceForCommandsNVX(my_data->report_data, pReserveSpaceInfo); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6812 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6813 | my_data->dispatch_table.CmdReserveSpaceForCommandsNVX(commandBuffer, pReserveSpaceInfo); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6814 | } |
| 6815 | } |
| 6816 | |
| 6817 | VKAPI_ATTR VkResult VKAPI_CALL CreateIndirectCommandsLayoutNVX(VkDevice device, |
| 6818 | const VkIndirectCommandsLayoutCreateInfoNVX *pCreateInfo, |
| 6819 | const VkAllocationCallbacks *pAllocator, |
| 6820 | VkIndirectCommandsLayoutNVX *pIndirectCommandsLayout) { |
| 6821 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6822 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6823 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6824 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6825 | skip |= require_device_extension(my_data, my_data->enables.nvx_device_generated_commands, "vkCreateIndirectCommandsLayoutNVX", |
| 6826 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6827 | skip |= parameter_validation_vkCreateIndirectCommandsLayoutNVX(my_data->report_data, pCreateInfo, pAllocator, |
| 6828 | pIndirectCommandsLayout); |
| 6829 | if (!skip) { |
| 6830 | result = my_data->dispatch_table.CreateIndirectCommandsLayoutNVX(device, pCreateInfo, pAllocator, pIndirectCommandsLayout); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6831 | validate_result(my_data->report_data, "vkCreateIndirectCommandsLayoutNVX", result); |
| 6832 | } |
| 6833 | return result; |
| 6834 | } |
| 6835 | |
| 6836 | VKAPI_ATTR void VKAPI_CALL DestroyIndirectCommandsLayoutNVX(VkDevice device, VkIndirectCommandsLayoutNVX indirectCommandsLayout, |
| 6837 | const VkAllocationCallbacks *pAllocator) { |
| 6838 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6839 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6840 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6841 | skip |= require_device_extension(my_data, my_data->enables.nvx_device_generated_commands, "vkDestroyIndirectCommandsLayoutNVX", |
| 6842 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 6843 | #if 0 // Validation not automatically generated |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6844 | skip |= parameter_validation_vkDestroyIndirectCommandsLayoutNVX(my_data->report_data, indirectCommandsLayout, pAllocator); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6845 | #endif |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6846 | if (!skip) { |
| 6847 | my_data->dispatch_table.DestroyIndirectCommandsLayoutNVX(device, indirectCommandsLayout, pAllocator); |
| 6848 | } |
| 6849 | } |
| 6850 | |
| 6851 | VKAPI_ATTR VkResult VKAPI_CALL CreateObjectTableNVX(VkDevice device, const VkObjectTableCreateInfoNVX *pCreateInfo, |
| 6852 | const VkAllocationCallbacks *pAllocator, VkObjectTableNVX *pObjectTable) { |
| 6853 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6854 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6855 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6856 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6857 | skip |= require_device_extension(my_data, my_data->enables.nvx_device_generated_commands, "vkCreateObjectTableNVX", |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6858 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
| 6859 | skip |= parameter_validation_vkCreateObjectTableNVX(my_data->report_data, pCreateInfo, pAllocator, pObjectTable); |
| 6860 | if (!skip) { |
| 6861 | result = my_data->dispatch_table.CreateObjectTableNVX(device, pCreateInfo, pAllocator, pObjectTable); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6862 | validate_result(my_data->report_data, "vkCreateObjectTableNVX", result); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6863 | } |
| 6864 | return result; |
| 6865 | } |
| 6866 | |
| 6867 | VKAPI_ATTR void VKAPI_CALL DestroyObjectTableNVX(VkDevice device, VkObjectTableNVX objectTable, |
| 6868 | const VkAllocationCallbacks *pAllocator) { |
| 6869 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6870 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6871 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6872 | skip |= require_device_extension(my_data, my_data->enables.nvx_device_generated_commands, "vkDestroyObjectTableNVX", |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6873 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 6874 | #if 0 // Validation not automatically generated |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6875 | skip |= parameter_validation_vkDestroyObjectTableNVX(my_data->report_data, objectTable, pAllocator); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6876 | #endif |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6877 | if (!skip) { |
| 6878 | my_data->dispatch_table.DestroyObjectTableNVX(device, objectTable, pAllocator); |
| 6879 | } |
| 6880 | } |
| 6881 | |
| 6882 | VKAPI_ATTR VkResult VKAPI_CALL RegisterObjectsNVX(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, |
| 6883 | const VkObjectTableEntryNVX *const *ppObjectTableEntries, |
| 6884 | const uint32_t *pObjectIndices) { |
| 6885 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6886 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6887 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6888 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6889 | skip |= require_device_extension(my_data, my_data->enables.nvx_device_generated_commands, "vkRegisterObjectsNVX", |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6890 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
| 6891 | skip |= parameter_validation_vkRegisterObjectsNVX(my_data->report_data, objectTable, objectCount, ppObjectTableEntries, |
| 6892 | pObjectIndices); |
| 6893 | if (!skip) { |
| 6894 | result = my_data->dispatch_table.RegisterObjectsNVX(device, objectTable, objectCount, ppObjectTableEntries, pObjectIndices); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6895 | validate_result(my_data->report_data, "vkRegisterObjectsNVX", result); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6896 | } |
| 6897 | return result; |
| 6898 | } |
| 6899 | |
| 6900 | VKAPI_ATTR VkResult VKAPI_CALL UnregisterObjectsNVX(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, |
| 6901 | const VkObjectEntryTypeNVX *pObjectEntryTypes, const uint32_t *pObjectIndices) { |
| 6902 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6903 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6904 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6905 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6906 | skip |= require_device_extension(my_data, my_data->enables.nvx_device_generated_commands, "vkUnregisterObjectsNVX", |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6907 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
| 6908 | skip |= parameter_validation_vkUnregisterObjectsNVX(my_data->report_data, objectTable, objectCount, pObjectEntryTypes, |
| 6909 | pObjectIndices); |
| 6910 | if (!skip) { |
| 6911 | result = my_data->dispatch_table.UnregisterObjectsNVX(device, objectTable, objectCount, pObjectEntryTypes, pObjectIndices); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6912 | validate_result(my_data->report_data, "vkUnregisterObjectsNVX", result); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6913 | } |
| 6914 | return result; |
| 6915 | } |
| 6916 | |
| 6917 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceGeneratedCommandsPropertiesNVX(VkPhysicalDevice physicalDevice, |
| 6918 | VkDeviceGeneratedCommandsFeaturesNVX *pFeatures, |
| 6919 | VkDeviceGeneratedCommandsLimitsNVX *pLimits) { |
| 6920 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6921 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6922 | assert(my_data != NULL); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6923 | skip |= parameter_validation_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX(my_data->report_data, pFeatures, pLimits); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6924 | if (!skip) { |
| 6925 | my_data->dispatch_table.GetPhysicalDeviceGeneratedCommandsPropertiesNVX(physicalDevice, pFeatures, pLimits); |
| 6926 | } |
| 6927 | } |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6928 | |
Mark Lobodzinski | 1d218cc | 2017-03-14 10:12:43 -0600 | [diff] [blame] | 6929 | VKAPI_ATTR VkResult VKAPI_CALL GetPastPresentationTimingGOOGLE(VkDevice device, VkSwapchainKHR swapchain, |
| 6930 | uint32_t *pPresentationTimingCount, |
| 6931 | VkPastPresentationTimingGOOGLE *pPresentationTimings) { |
| 6932 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6933 | bool skip = false; |
| 6934 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6935 | assert(my_data != NULL); |
| 6936 | skip |= parameter_validation_vkGetPastPresentationTimingGOOGLE(my_data->report_data, swapchain, pPresentationTimingCount, |
| 6937 | pPresentationTimings); |
| 6938 | if (!skip) { |
| 6939 | result = my_data->dispatch_table.GetPastPresentationTimingGOOGLE(device, swapchain, pPresentationTimingCount, |
| 6940 | pPresentationTimings); |
| 6941 | } |
| 6942 | return result; |
| 6943 | } |
| 6944 | |
| 6945 | VKAPI_ATTR VkResult VKAPI_CALL GetRefreshCycleDurationGOOGLE(VkDevice device, VkSwapchainKHR swapchain, |
| 6946 | VkRefreshCycleDurationGOOGLE *pDisplayTimingProperties) { |
| 6947 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6948 | bool skip = false; |
| 6949 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6950 | assert(my_data != NULL); |
| 6951 | skip |= parameter_validation_vkGetRefreshCycleDurationGOOGLE(my_data->report_data, swapchain, pDisplayTimingProperties); |
| 6952 | if (!skip) { |
| 6953 | result = my_data->dispatch_table.GetRefreshCycleDurationGOOGLE(device, swapchain, pDisplayTimingProperties); |
| 6954 | } |
| 6955 | return result; |
| 6956 | } |
| 6957 | |
| 6958 | VKAPI_ATTR void VKAPI_CALL SetHdrMetadataEXT(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR *pSwapchains, |
| 6959 | const VkHdrMetadataEXT *pMetadata) { |
| 6960 | bool skip = false; |
| 6961 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6962 | assert(my_data != NULL); |
| 6963 | skip |= parameter_validation_vkSetHdrMetadataEXT(my_data->report_data, swapchainCount, pSwapchains, pMetadata); |
| 6964 | if (!skip) { |
| 6965 | my_data->dispatch_table.SetHdrMetadataEXT(device, swapchainCount, pSwapchains, pMetadata); |
| 6966 | } |
| 6967 | } |
| 6968 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6969 | static inline PFN_vkVoidFunction layer_intercept_proc(const char *name) { |
| 6970 | for (unsigned int i = 0; i < sizeof(procmap) / sizeof(procmap[0]); i++) { |
| 6971 | if (!strcmp(name, procmap[i].name)) return procmap[i].pFunc; |
| 6972 | } |
| 6973 | return NULL; |
| 6974 | } |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6975 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 6976 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) { |
Chia-I Wu | f9b0138 | 2016-05-16 07:37:41 +0800 | [diff] [blame] | 6977 | assert(device); |
| 6978 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6979 | PFN_vkVoidFunction addr = layer_intercept_proc(funcName); |
| 6980 | if (addr) return addr; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 6981 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6982 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 6983 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6984 | if (!dev_data->dispatch_table.GetDeviceProcAddr) return nullptr; |
| 6985 | return dev_data->dispatch_table.GetDeviceProcAddr(device, funcName); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 6986 | } |
| 6987 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 6988 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char *funcName) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 6989 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6990 | PFN_vkVoidFunction addr = layer_intercept_proc(funcName); |
| 6991 | if (addr) return addr; |
Courtney Goeltzenleuchter | 500b89b | 2015-06-01 14:45:27 -0600 | [diff] [blame] | 6992 | |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 6993 | assert(instance); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 6994 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6995 | auto instance_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 6996 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6997 | if (!instance_data->dispatch_table.GetInstanceProcAddr) return nullptr; |
| 6998 | return instance_data->dispatch_table.GetInstanceProcAddr(instance, funcName); |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 6999 | } |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 7000 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 7001 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetPhysicalDeviceProcAddr(VkInstance instance, const char *funcName) { |
| 7002 | assert(instance); |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 7003 | auto pdev_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 7004 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 7005 | if (!pdev_data->dispatch_table.GetPhysicalDeviceProcAddr) return nullptr; |
| 7006 | return pdev_data->dispatch_table.GetPhysicalDeviceProcAddr(instance, funcName); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 7007 | } |
| 7008 | |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 7009 | } // namespace parameter_validation |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7010 | |
| 7011 | // vk_layer_logging.h expects these to be defined |
| 7012 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 7013 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(VkInstance instance, |
| 7014 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 7015 | const VkAllocationCallbacks *pAllocator, |
| 7016 | VkDebugReportCallbackEXT *pMsgCallback) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 7017 | return parameter_validation::CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7018 | } |
| 7019 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 7020 | VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, |
| 7021 | const VkAllocationCallbacks *pAllocator) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 7022 | parameter_validation::DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7023 | } |
| 7024 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 7025 | VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 7026 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 7027 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 7028 | parameter_validation::DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7029 | } |
| 7030 | |
| 7031 | // loader-layer interface v0 |
| 7032 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 7033 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 7034 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 7035 | return parameter_validation::EnumerateInstanceExtensionProperties(pLayerName, pCount, pProperties); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 7036 | } |
| 7037 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 7038 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pCount, |
| 7039 | VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 7040 | return parameter_validation::EnumerateInstanceLayerProperties(pCount, pProperties); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 7041 | } |
| 7042 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 7043 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 7044 | VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 7045 | // the layer command handles VK_NULL_HANDLE just fine internally |
| 7046 | assert(physicalDevice == VK_NULL_HANDLE); |
| 7047 | return parameter_validation::EnumerateDeviceLayerProperties(VK_NULL_HANDLE, pCount, pProperties); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7048 | } |
| 7049 | |
| 7050 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, |
| 7051 | const char *pLayerName, uint32_t *pCount, |
| 7052 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 7053 | // the layer command handles VK_NULL_HANDLE just fine internally |
| 7054 | assert(physicalDevice == VK_NULL_HANDLE); |
Chia-I Wu | 76a3466 | 2016-05-16 07:34:09 +0800 | [diff] [blame] | 7055 | return parameter_validation::EnumerateDeviceExtensionProperties(VK_NULL_HANDLE, pLayerName, pCount, pProperties); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7056 | } |
| 7057 | |
| 7058 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice dev, const char *funcName) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 7059 | return parameter_validation::GetDeviceProcAddr(dev, funcName); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7060 | } |
| 7061 | |
| 7062 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *funcName) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 7063 | return parameter_validation::GetInstanceProcAddr(instance, funcName); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 7064 | } |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 7065 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 7066 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_layerGetPhysicalDeviceProcAddr(VkInstance instance, |
| 7067 | const char *funcName) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 7068 | return parameter_validation::GetPhysicalDeviceProcAddr(instance, funcName); |
| 7069 | } |
| 7070 | |
| 7071 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *pVersionStruct) { |
| 7072 | assert(pVersionStruct != NULL); |
| 7073 | assert(pVersionStruct->sType == LAYER_NEGOTIATE_INTERFACE_STRUCT); |
| 7074 | |
| 7075 | // Fill in the function pointers if our version is at least capable of having the structure contain them. |
| 7076 | if (pVersionStruct->loaderLayerInterfaceVersion >= 2) { |
| 7077 | pVersionStruct->pfnGetInstanceProcAddr = vkGetInstanceProcAddr; |
| 7078 | pVersionStruct->pfnGetDeviceProcAddr = vkGetDeviceProcAddr; |
| 7079 | pVersionStruct->pfnGetPhysicalDeviceProcAddr = vk_layerGetPhysicalDeviceProcAddr; |
| 7080 | } |
| 7081 | |
| 7082 | if (pVersionStruct->loaderLayerInterfaceVersion < CURRENT_LOADER_LAYER_INTERFACE_VERSION) { |
| 7083 | parameter_validation::loader_layer_if_version = pVersionStruct->loaderLayerInterfaceVersion; |
| 7084 | } else if (pVersionStruct->loaderLayerInterfaceVersion > CURRENT_LOADER_LAYER_INTERFACE_VERSION) { |
| 7085 | pVersionStruct->loaderLayerInterfaceVersion = CURRENT_LOADER_LAYER_INTERFACE_VERSION; |
| 7086 | } |
| 7087 | |
| 7088 | return VK_SUCCESS; |
| 7089 | } |