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) && |
| 2546 | vk_format_is_compressed_ETC2_EAC(pCreateInfo->format)) { |
| 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) && |
| 2555 | vk_format_is_compressed_ASTC_LDR(pCreateInfo->format)) { |
| 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) && |
| 2565 | vk_format_is_compressed_BC(pCreateInfo->format)) { |
| 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 | |
| 3795 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 3796 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || |
| 3797 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || |
| 3798 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || |
| 3799 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)) { |
| 3800 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, |
| 3801 | // VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, |
| 3802 | // pImageInfo must be a pointer to an array of descriptorCount valid VkDescriptorImageInfo structures |
| 3803 | if (pDescriptorWrites[i].pImageInfo == nullptr) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3804 | 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] | 3805 | __LINE__, VALIDATION_ERROR_00939, LayerName, |
| 3806 | "vkUpdateDescriptorSets(): if pDescriptorWrites[%d].descriptorType is " |
| 3807 | "VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, " |
| 3808 | "VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or " |
| 3809 | "VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, pDescriptorWrites[%d].pImageInfo must not be NULL. %s", |
| 3810 | i, i, validation_error_map[VALIDATION_ERROR_00939]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3811 | } else if (pDescriptorWrites[i].descriptorType != VK_DESCRIPTOR_TYPE_SAMPLER) { |
| 3812 | // If descriptorType is VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, |
| 3813 | // VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, the imageView and imageLayout |
| 3814 | // members of any given element of pImageInfo must be a valid VkImageView and VkImageLayout, respectively |
| 3815 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3816 | ++descriptor_index) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3817 | skip |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3818 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageView", |
| 3819 | ParameterName::IndexVector{i, descriptor_index}), |
| 3820 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageView); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3821 | skip |= validate_ranged_enum(report_data, "vkUpdateDescriptorSets", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3822 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageLayout", |
| 3823 | ParameterName::IndexVector{i, descriptor_index}), |
| 3824 | "VkImageLayout", VK_IMAGE_LAYOUT_BEGIN_RANGE, VK_IMAGE_LAYOUT_END_RANGE, |
| 3825 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageLayout); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3826 | } |
| 3827 | } |
| 3828 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 3829 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 3830 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || |
| 3831 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 3832 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 3833 | // VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, pBufferInfo must be a |
| 3834 | // pointer to an array of descriptorCount valid VkDescriptorBufferInfo structures |
| 3835 | if (pDescriptorWrites[i].pBufferInfo == nullptr) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3836 | 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] | 3837 | __LINE__, VALIDATION_ERROR_00941, LayerName, |
| 3838 | "vkUpdateDescriptorSets(): if pDescriptorWrites[%d].descriptorType is " |
| 3839 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, " |
| 3840 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, " |
| 3841 | "pDescriptorWrites[%d].pBufferInfo must not be NULL. %s", |
| 3842 | i, i, validation_error_map[VALIDATION_ERROR_00941]); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3843 | } else { |
| 3844 | for (uint32_t descriptorIndex = 0; descriptorIndex < pDescriptorWrites[i].descriptorCount; ++descriptorIndex) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3845 | skip |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3846 | ParameterName("pDescriptorWrites[%i].pBufferInfo[%i].buffer", |
| 3847 | ParameterName::IndexVector{i, descriptorIndex}), |
| 3848 | pDescriptorWrites[i].pBufferInfo[descriptorIndex].buffer); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3849 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3850 | } |
| 3851 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || |
| 3852 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { |
| 3853 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, |
| 3854 | // pTexelBufferView must be a pointer to an array of descriptorCount valid VkBufferView handles |
| 3855 | if (pDescriptorWrites[i].pTexelBufferView == nullptr) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3856 | 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] | 3857 | __LINE__, VALIDATION_ERROR_00940, LayerName, |
| 3858 | "vkUpdateDescriptorSets(): if pDescriptorWrites[%d].descriptorType is " |
| 3859 | "VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, " |
| 3860 | "pDescriptorWrites[%d].pTexelBufferView must not be NULL. %s", |
| 3861 | i, i, validation_error_map[VALIDATION_ERROR_00940]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3862 | } else { |
| 3863 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3864 | ++descriptor_index) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3865 | skip |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3866 | ParameterName("pDescriptorWrites[%i].pTexelBufferView[%i]", |
| 3867 | ParameterName::IndexVector{i, descriptor_index}), |
| 3868 | pDescriptorWrites[i].pTexelBufferView[descriptor_index]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3869 | } |
| 3870 | } |
| 3871 | } |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3872 | |
| 3873 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 3874 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)) { |
| 3875 | VkDeviceSize uniformAlignment = device_data->device_limits.minUniformBufferOffsetAlignment; |
| 3876 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 3877 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
| 3878 | if (vk_safe_modulo(pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment) != 0) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 3879 | skip |= log_msg( |
| 3880 | device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, |
| 3881 | VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, VALIDATION_ERROR_00944, LayerName, |
| 3882 | "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 3883 | ") must be a multiple of device limit minUniformBufferOffsetAlignment 0x%" PRIxLEAST64 ". %s", |
| 3884 | i, j, pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment, |
| 3885 | validation_error_map[VALIDATION_ERROR_00944]); |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3886 | } |
| 3887 | } |
| 3888 | } |
| 3889 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 3890 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 3891 | VkDeviceSize storageAlignment = device_data->device_limits.minStorageBufferOffsetAlignment; |
| 3892 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 3893 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
| 3894 | if (vk_safe_modulo(pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment) != 0) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 3895 | skip |= log_msg( |
| 3896 | device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, |
| 3897 | VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, VALIDATION_ERROR_00945, LayerName, |
| 3898 | "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 3899 | ") must be a multiple of device limit minStorageBufferOffsetAlignment 0x%" PRIxLEAST64 ". %s", |
| 3900 | i, j, pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment, |
| 3901 | validation_error_map[VALIDATION_ERROR_00945]); |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3902 | } |
| 3903 | } |
| 3904 | } |
| 3905 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3906 | } |
| 3907 | } |
| 3908 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3909 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 3910 | device_data->dispatch_table.UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, |
| 3911 | pDescriptorCopies); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3912 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3913 | } |
| 3914 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3915 | VKAPI_ATTR VkResult VKAPI_CALL CreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3916 | const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3917 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3918 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3919 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3920 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3921 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3922 | skip |= parameter_validation_vkCreateFramebuffer(my_data->report_data, pCreateInfo, pAllocator, pFramebuffer); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3923 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3924 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3925 | result = my_data->dispatch_table.CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3926 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3927 | validate_result(my_data->report_data, "vkCreateFramebuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3928 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3929 | |
| 3930 | return result; |
| 3931 | } |
| 3932 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3933 | 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] | 3934 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3935 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3936 | assert(my_data != NULL); |
| 3937 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3938 | skip |= parameter_validation_vkDestroyFramebuffer(my_data->report_data, framebuffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3939 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3940 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3941 | my_data->dispatch_table.DestroyFramebuffer(device, framebuffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3942 | } |
| 3943 | } |
| 3944 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 3945 | static bool PreCreateRenderPass(layer_data *dev_data, const VkRenderPassCreateInfo *pCreateInfo) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3946 | bool skip = false; |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3947 | uint32_t max_color_attachments = dev_data->device_limits.maxColorAttachments; |
| 3948 | |
Mark Lobodzinski | e907fe4 | 2017-01-27 14:50:23 -0700 | [diff] [blame] | 3949 | for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) { |
| 3950 | if (pCreateInfo->pAttachments[i].format == VK_FORMAT_UNDEFINED) { |
| 3951 | std::stringstream ss; |
| 3952 | ss << "vkCreateRenderPass: pCreateInfo->pAttachments[" << i << "].format is VK_FORMAT_UNDEFINED. " |
| 3953 | << validation_error_map[VALIDATION_ERROR_00336]; |
Jeremy Hayes | 632e0ab | 2017-02-09 13:32:28 -0700 | [diff] [blame] | 3954 | 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] | 3955 | VALIDATION_ERROR_00336, "IMAGE", "%s", ss.str().c_str()); |
| 3956 | } |
| 3957 | } |
| 3958 | |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3959 | for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) { |
| 3960 | if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 3961 | skip |= |
| 3962 | log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3963 | VALIDATION_ERROR_00348, "DL", "Cannot create a render pass with %d color attachments. Max is %d. %s", |
| 3964 | pCreateInfo->pSubpasses[i].colorAttachmentCount, max_color_attachments, |
| 3965 | validation_error_map[VALIDATION_ERROR_00348]); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3966 | } |
| 3967 | } |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3968 | return skip; |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3969 | } |
| 3970 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3971 | VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3972 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3973 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3974 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3975 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3976 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3977 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3978 | skip |= parameter_validation_vkCreateRenderPass(my_data->report_data, pCreateInfo, pAllocator, pRenderPass); |
| 3979 | skip |= PreCreateRenderPass(my_data, pCreateInfo); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3980 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3981 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3982 | result = my_data->dispatch_table.CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3983 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3984 | validate_result(my_data->report_data, "vkCreateRenderPass", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3985 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3986 | |
| 3987 | return result; |
| 3988 | } |
| 3989 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3990 | 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] | 3991 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 3992 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3993 | assert(my_data != NULL); |
| 3994 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3995 | skip |= parameter_validation_vkDestroyRenderPass(my_data->report_data, renderPass, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3996 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 3997 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 3998 | my_data->dispatch_table.DestroyRenderPass(device, renderPass, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3999 | } |
| 4000 | } |
| 4001 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4002 | VKAPI_ATTR void VKAPI_CALL GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4003 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4004 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4005 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4006 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4007 | skip |= parameter_validation_vkGetRenderAreaGranularity(my_data->report_data, renderPass, pGranularity); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4008 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4009 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4010 | my_data->dispatch_table.GetRenderAreaGranularity(device, renderPass, pGranularity); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4011 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4012 | } |
| 4013 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4014 | VKAPI_ATTR VkResult VKAPI_CALL CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4015 | const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4016 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4017 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4018 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4019 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4020 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4021 | skip |= |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 4022 | validate_queue_family_index(my_data, "vkCreateCommandPool", "pCreateInfo->queueFamilyIndex", pCreateInfo->queueFamilyIndex); |
Mark Lobodzinski | f20f094 | 2016-03-22 10:07:26 -0600 | [diff] [blame] | 4023 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4024 | skip |= parameter_validation_vkCreateCommandPool(my_data->report_data, pCreateInfo, pAllocator, pCommandPool); |
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 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4027 | result = my_data->dispatch_table.CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4028 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4029 | validate_result(my_data->report_data, "vkCreateCommandPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4030 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4031 | |
| 4032 | return result; |
| 4033 | } |
| 4034 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4035 | 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] | 4036 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4037 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4038 | assert(my_data != NULL); |
| 4039 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4040 | skip |= parameter_validation_vkDestroyCommandPool(my_data->report_data, commandPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4041 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4042 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4043 | my_data->dispatch_table.DestroyCommandPool(device, commandPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4044 | } |
| 4045 | } |
| 4046 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4047 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4048 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4049 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4050 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4051 | assert(my_data != NULL); |
| 4052 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4053 | skip |= parameter_validation_vkResetCommandPool(my_data->report_data, commandPool, flags); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4054 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4055 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4056 | result = my_data->dispatch_table.ResetCommandPool(device, commandPool, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4057 | |
| 4058 | validate_result(my_data->report_data, "vkResetCommandPool", result); |
| 4059 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4060 | |
| 4061 | return result; |
| 4062 | } |
| 4063 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4064 | VKAPI_ATTR VkResult VKAPI_CALL AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, |
| 4065 | VkCommandBuffer *pCommandBuffers) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4066 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4067 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4068 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4069 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4070 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4071 | skip |= parameter_validation_vkAllocateCommandBuffers(my_data->report_data, pAllocateInfo, pCommandBuffers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4072 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4073 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4074 | result = my_data->dispatch_table.AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4075 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4076 | validate_result(my_data->report_data, "vkAllocateCommandBuffers", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4077 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4078 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4079 | return result; |
| 4080 | } |
| 4081 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4082 | 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] | 4083 | const VkCommandBuffer *pCommandBuffers) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4084 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4085 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4086 | assert(device_data != nullptr); |
| 4087 | debug_report_data *report_data = device_data->report_data; |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 4088 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4089 | skip |= parameter_validation_vkFreeCommandBuffers(report_data, commandPool, commandBufferCount, pCommandBuffers); |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 4090 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4091 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 4092 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 4093 | // validate_array() |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4094 | skip |= validate_array(report_data, "vkFreeCommandBuffers", "commandBufferCount", "pCommandBuffers", commandBufferCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4095 | pCommandBuffers, true, true); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4096 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4097 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4098 | device_data->dispatch_table.FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers); |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 4099 | } |
| 4100 | } |
| 4101 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4102 | static bool PreBeginCommandBuffer(layer_data *dev_data, VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4103 | bool skip = false; |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 4104 | const VkCommandBufferInheritanceInfo *pInfo = pBeginInfo->pInheritanceInfo; |
| 4105 | |
| 4106 | if (pInfo != NULL) { |
Chris Forbes | c5554a5 | 2016-11-24 14:45:16 +1300 | [diff] [blame] | 4107 | 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] | 4108 | skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 4109 | reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_00116, LayerName, |
| 4110 | "Cannot set inherited occlusionQueryEnable in vkBeginCommandBuffer() when device does not support " |
| 4111 | "inheritedQueries. %s", |
| 4112 | validation_error_map[VALIDATION_ERROR_00116]); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 4113 | } |
Mark Lobodzinski | 38df456 | 2016-12-15 13:06:55 -0700 | [diff] [blame] | 4114 | // VALIDATION_ERROR_00117 check |
| 4115 | if ((dev_data->physical_device_features.inheritedQueries != VK_FALSE) && (pInfo->occlusionQueryEnable != VK_FALSE)) { |
| 4116 | skip |= validate_flags(dev_data->report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->queryFlags", |
| 4117 | "VkQueryControlFlagBits", AllVkQueryControlFlagBits, pInfo->queryFlags, false); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 4118 | } |
| 4119 | } |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4120 | return skip; |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 4121 | } |
| 4122 | |
| 4123 | VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4124 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4125 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4126 | layer_data *device_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4127 | assert(device_data != nullptr); |
| 4128 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4129 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4130 | skip |= parameter_validation_vkBeginCommandBuffer(report_data, pBeginInfo); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4131 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4132 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 4133 | // 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] | 4134 | skip |= validate_struct_type(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4135 | "VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO", pBeginInfo->pInheritanceInfo, |
| 4136 | VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, false); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4137 | |
| 4138 | if (pBeginInfo->pInheritanceInfo != NULL) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4139 | skip |= validate_struct_pnext(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->pNext", NULL, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4140 | pBeginInfo->pInheritanceInfo->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 4141 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4142 | skip |= validate_bool32(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->occlusionQueryEnable", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4143 | pBeginInfo->pInheritanceInfo->occlusionQueryEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 4144 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4145 | // 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] | 4146 | // skip |= validate_flags(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->queryFlags", |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4147 | // "VkQueryControlFlagBits", AllVkQueryControlFlagBits, pBeginInfo->pInheritanceInfo->queryFlags, false); |
| 4148 | |
| 4149 | // 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] | 4150 | skip |= validate_flags(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->pipelineStatistics", |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4151 | "VkQueryPipelineStatisticFlagBits", AllVkQueryPipelineStatisticFlagBits, |
| 4152 | pBeginInfo->pInheritanceInfo->pipelineStatistics, false); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4153 | } |
| 4154 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4155 | skip |= PreBeginCommandBuffer(device_data, commandBuffer, pBeginInfo); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 4156 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4157 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4158 | result = device_data->dispatch_table.BeginCommandBuffer(commandBuffer, pBeginInfo); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4159 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 4160 | validate_result(report_data, "vkBeginCommandBuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4161 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4162 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4163 | return result; |
| 4164 | } |
| 4165 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4166 | VKAPI_ATTR VkResult VKAPI_CALL EndCommandBuffer(VkCommandBuffer commandBuffer) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4167 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4168 | assert(my_data != NULL); |
| 4169 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4170 | VkResult result = my_data->dispatch_table.EndCommandBuffer(commandBuffer); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4171 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4172 | validate_result(my_data->report_data, "vkEndCommandBuffer", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4173 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4174 | return result; |
| 4175 | } |
| 4176 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4177 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) { |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 4178 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4179 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 4180 | assert(my_data != NULL); |
| 4181 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4182 | bool skip = parameter_validation_vkResetCommandBuffer(my_data->report_data, flags); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4183 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4184 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4185 | result = my_data->dispatch_table.ResetCommandBuffer(commandBuffer, flags); |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 4186 | |
| 4187 | validate_result(my_data->report_data, "vkResetCommandBuffer", result); |
| 4188 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4189 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4190 | return result; |
| 4191 | } |
| 4192 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4193 | VKAPI_ATTR void VKAPI_CALL CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 4194 | VkPipeline pipeline) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4195 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4196 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4197 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4198 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4199 | skip |= parameter_validation_vkCmdBindPipeline(my_data->report_data, pipelineBindPoint, pipeline); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4200 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4201 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4202 | my_data->dispatch_table.CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4203 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4204 | } |
| 4205 | |
Mark Lobodzinski | 147e692 | 2017-03-01 15:45:52 -0700 | [diff] [blame] | 4206 | 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] | 4207 | debug_report_data *report_data = my_data->report_data; |
| 4208 | |
Mark Lobodzinski | 5a24296 | 2016-10-28 12:57:23 -0600 | [diff] [blame] | 4209 | bool skip = |
| 4210 | validate_array(report_data, "vkCmdSetViewport", "viewportCount", "pViewports", viewport_count, viewports, true, true); |
Mike Weiblen | 2906c9a | 2016-10-31 21:04:10 -0600 | [diff] [blame] | 4211 | |
| 4212 | if (viewport_count > 0 && viewports != nullptr) { |
| 4213 | const VkPhysicalDeviceLimits &limits = my_data->device_limits; |
| 4214 | for (uint32_t viewportIndex = 0; viewportIndex < viewport_count; ++viewportIndex) { |
| 4215 | const VkViewport &viewport = viewports[viewportIndex]; |
| 4216 | |
Mark Lobodzinski | 147e692 | 2017-03-01 15:45:52 -0700 | [diff] [blame] | 4217 | if (my_data->physical_device_features.multiViewport == false) { |
| 4218 | if (viewport_count != 1) { |
| 4219 | skip |= log_msg( |
| 4220 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4221 | DEVICE_FEATURE, LayerName, |
| 4222 | "vkCmdSetViewport(): The multiViewport feature is not enabled, so viewportCount must be 1 but is %d.", |
| 4223 | viewport_count); |
| 4224 | } |
| 4225 | if (first_viewport != 0) { |
| 4226 | skip |= log_msg( |
| 4227 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4228 | DEVICE_FEATURE, LayerName, |
| 4229 | "vkCmdSetViewport(): The multiViewport feature is not enabled, so firstViewport must be 0 but is %d.", |
| 4230 | first_viewport); |
| 4231 | } |
| 4232 | } |
| 4233 | |
Mike Weiblen | 2906c9a | 2016-10-31 21:04:10 -0600 | [diff] [blame] | 4234 | if (viewport.width <= 0 || viewport.width > limits.maxViewportDimensions[0]) { |
| 4235 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4236 | VALIDATION_ERROR_01448, LayerName, |
| 4237 | "vkCmdSetViewport %d: width (%f) exceeds permitted bounds (0,%u). %s", viewportIndex, |
| 4238 | viewport.width, limits.maxViewportDimensions[0], validation_error_map[VALIDATION_ERROR_01448]); |
| 4239 | } |
| 4240 | |
| 4241 | bool invalid_height = (viewport.height <= 0 || viewport.height > limits.maxViewportDimensions[1]); |
Mark Lobodzinski | 885790e | 2017-03-09 11:54:48 -0700 | [diff] [blame] | 4242 | 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] | 4243 | // VALIDATION_ERROR_01790 |
| 4244 | invalid_height = false; |
| 4245 | } |
| 4246 | if (invalid_height) { |
| 4247 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4248 | VALIDATION_ERROR_01449, LayerName, |
| 4249 | "vkCmdSetViewport %d: height (%f) exceeds permitted bounds (0,%u). %s", viewportIndex, |
| 4250 | viewport.height, limits.maxViewportDimensions[1], validation_error_map[VALIDATION_ERROR_01449]); |
| 4251 | } |
| 4252 | |
| 4253 | if (viewport.x < limits.viewportBoundsRange[0] || viewport.x > limits.viewportBoundsRange[1]) { |
| 4254 | skip |= |
| 4255 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4256 | VALIDATION_ERROR_01450, LayerName, "vkCmdSetViewport %d: x (%f) exceeds permitted bounds (%f,%f). %s", |
| 4257 | viewportIndex, viewport.x, limits.viewportBoundsRange[0], limits.viewportBoundsRange[1], |
| 4258 | validation_error_map[VALIDATION_ERROR_01450]); |
| 4259 | } |
| 4260 | |
| 4261 | if (viewport.y < limits.viewportBoundsRange[0] || viewport.y > limits.viewportBoundsRange[1]) { |
| 4262 | skip |= |
| 4263 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4264 | VALIDATION_ERROR_01450, LayerName, "vkCmdSetViewport %d: y (%f) exceeds permitted bounds (%f,%f). %s", |
| 4265 | viewportIndex, viewport.y, limits.viewportBoundsRange[0], limits.viewportBoundsRange[1], |
| 4266 | validation_error_map[VALIDATION_ERROR_01450]); |
| 4267 | } |
| 4268 | |
| 4269 | if (viewport.x + viewport.width > limits.viewportBoundsRange[1]) { |
| 4270 | skip |= |
| 4271 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4272 | VALIDATION_ERROR_01451, LayerName, |
| 4273 | "vkCmdSetViewport %d: x (%f) + width (%f) exceeds permitted bound (%f). %s", viewportIndex, viewport.x, |
| 4274 | viewport.width, limits.viewportBoundsRange[1], validation_error_map[VALIDATION_ERROR_01451]); |
| 4275 | } |
| 4276 | |
| 4277 | if (viewport.y + viewport.height > limits.viewportBoundsRange[1]) { |
| 4278 | skip |= |
| 4279 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4280 | VALIDATION_ERROR_01452, LayerName, |
| 4281 | "vkCmdSetViewport %d: y (%f) + height (%f) exceeds permitted bound (%f). %s", viewportIndex, viewport.y, |
| 4282 | viewport.height, limits.viewportBoundsRange[1], validation_error_map[VALIDATION_ERROR_01452]); |
| 4283 | } |
| 4284 | } |
| 4285 | } |
| 4286 | |
Mark Lobodzinski | 5a24296 | 2016-10-28 12:57:23 -0600 | [diff] [blame] | 4287 | return skip; |
| 4288 | } |
| 4289 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4290 | VKAPI_ATTR void VKAPI_CALL CmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
| 4291 | const VkViewport *pViewports) { |
Mark Lobodzinski | b79b773 | 2016-10-28 12:59:47 -0600 | [diff] [blame] | 4292 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4293 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4294 | assert(my_data != NULL); |
| 4295 | |
Mark Lobodzinski | 147e692 | 2017-03-01 15:45:52 -0700 | [diff] [blame] | 4296 | skip |= preCmdSetViewport(my_data, firstViewport, viewportCount, pViewports); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4297 | |
Mark Lobodzinski | b79b773 | 2016-10-28 12:59:47 -0600 | [diff] [blame] | 4298 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4299 | my_data->dispatch_table.CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4300 | } |
Courtney Goeltzenleuchter | 078f817 | 2015-09-21 11:44:06 -0600 | [diff] [blame] | 4301 | } |
| 4302 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4303 | VKAPI_ATTR void VKAPI_CALL CmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, |
| 4304 | const VkRect2D *pScissors) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4305 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4306 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4307 | assert(my_data != NULL); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4308 | debug_report_data *report_data = my_data->report_data; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4309 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4310 | skip |= parameter_validation_vkCmdSetScissor(my_data->report_data, firstScissor, scissorCount, pScissors); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4311 | |
Mark Lobodzinski | 147e692 | 2017-03-01 15:45:52 -0700 | [diff] [blame] | 4312 | if (my_data->physical_device_features.multiViewport == false) { |
| 4313 | if (scissorCount != 1) { |
| 4314 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4315 | DEVICE_FEATURE, LayerName, |
| 4316 | "vkCmdSetScissor(): The multiViewport feature is not enabled, so scissorCount must be 1 but is %d.", |
| 4317 | scissorCount); |
| 4318 | } |
| 4319 | if (firstScissor != 0) { |
| 4320 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4321 | DEVICE_FEATURE, LayerName, |
| 4322 | "vkCmdSetScissor(): The multiViewport feature is not enabled, so firstScissor must be 0 but is %d.", |
| 4323 | firstScissor); |
| 4324 | } |
| 4325 | } |
| 4326 | |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4327 | for (uint32_t scissorIndex = 0; scissorIndex < scissorCount; ++scissorIndex) { |
| 4328 | const VkRect2D &pScissor = pScissors[scissorIndex]; |
| 4329 | |
| 4330 | if (pScissor.offset.x < 0) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4331 | 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] | 4332 | VALIDATION_ERROR_01489, LayerName, "vkCmdSetScissor %d: offset.x (%d) must not be negative. %s", |
| 4333 | scissorIndex, pScissor.offset.x, validation_error_map[VALIDATION_ERROR_01489]); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4334 | } 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] | 4335 | 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] | 4336 | VALIDATION_ERROR_01490, LayerName, |
| 4337 | "vkCmdSetScissor %d: adding offset.x (%d) and extent.width (%u) will overflow. %s", scissorIndex, |
| 4338 | pScissor.offset.x, pScissor.extent.width, validation_error_map[VALIDATION_ERROR_01490]); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4339 | } |
| 4340 | |
| 4341 | if (pScissor.offset.y < 0) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4342 | 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] | 4343 | VALIDATION_ERROR_01489, LayerName, "vkCmdSetScissor %d: offset.y (%d) must not be negative. %s", |
| 4344 | scissorIndex, pScissor.offset.y, validation_error_map[VALIDATION_ERROR_01489]); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4345 | } 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] | 4346 | 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] | 4347 | VALIDATION_ERROR_01491, LayerName, |
| 4348 | "vkCmdSetScissor %d: adding offset.y (%d) and extent.height (%u) will overflow. %s", scissorIndex, |
| 4349 | pScissor.offset.y, pScissor.extent.height, validation_error_map[VALIDATION_ERROR_01491]); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 4350 | } |
| 4351 | } |
| 4352 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4353 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4354 | my_data->dispatch_table.CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4355 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4356 | } |
| 4357 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4358 | VKAPI_ATTR void VKAPI_CALL CmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4359 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4360 | my_data->dispatch_table.CmdSetLineWidth(commandBuffer, lineWidth); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4361 | } |
| 4362 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4363 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, |
| 4364 | float depthBiasSlopeFactor) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4365 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4366 | my_data->dispatch_table.CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4367 | } |
| 4368 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4369 | VKAPI_ATTR void VKAPI_CALL CmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4370 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4371 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4372 | assert(my_data != NULL); |
| 4373 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4374 | skip |= parameter_validation_vkCmdSetBlendConstants(my_data->report_data, blendConstants); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4375 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4376 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4377 | my_data->dispatch_table.CmdSetBlendConstants(commandBuffer, blendConstants); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4378 | } |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 4379 | } |
| 4380 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4381 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4382 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4383 | my_data->dispatch_table.CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds); |
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 CmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, |
| 4387 | uint32_t compareMask) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4388 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4389 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4390 | assert(my_data != NULL); |
| 4391 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4392 | skip |= parameter_validation_vkCmdSetStencilCompareMask(my_data->report_data, faceMask, compareMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4393 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4394 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4395 | my_data->dispatch_table.CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4396 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4397 | } |
| 4398 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4399 | 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] | 4400 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4401 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4402 | assert(my_data != NULL); |
| 4403 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4404 | skip |= parameter_validation_vkCmdSetStencilWriteMask(my_data->report_data, faceMask, writeMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4405 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4406 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4407 | my_data->dispatch_table.CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4408 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4409 | } |
| 4410 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4411 | 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] | 4412 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4413 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4414 | assert(my_data != NULL); |
| 4415 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4416 | skip |= parameter_validation_vkCmdSetStencilReference(my_data->report_data, faceMask, reference); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4417 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4418 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4419 | my_data->dispatch_table.CmdSetStencilReference(commandBuffer, faceMask, reference); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4420 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4421 | } |
| 4422 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4423 | VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 4424 | VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, |
| 4425 | const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, |
| 4426 | const uint32_t *pDynamicOffsets) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4427 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4428 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4429 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4430 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4431 | skip |= parameter_validation_vkCmdBindDescriptorSets(my_data->report_data, pipelineBindPoint, layout, firstSet, |
| 4432 | descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4433 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4434 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4435 | my_data->dispatch_table.CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, |
| 4436 | pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4437 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4438 | } |
| 4439 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4440 | VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 4441 | VkIndexType indexType) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4442 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4443 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4444 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4445 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4446 | skip |= parameter_validation_vkCmdBindIndexBuffer(my_data->report_data, buffer, offset, indexType); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4447 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4448 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4449 | my_data->dispatch_table.CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4450 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4451 | } |
| 4452 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4453 | VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, |
| 4454 | const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4455 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4456 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4457 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4458 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4459 | skip |= parameter_validation_vkCmdBindVertexBuffers(my_data->report_data, firstBinding, bindingCount, pBuffers, pOffsets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4460 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4461 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4462 | my_data->dispatch_table.CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4463 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4464 | } |
| 4465 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4466 | 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] | 4467 | uint32_t firstInstance) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4468 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4469 | if (vertexCount == 0) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4470 | // 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] | 4471 | // this an error or leave as is. |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4472 | 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] | 4473 | REQUIRED_PARAMETER, LayerName, "vkCmdDraw parameter, uint32_t vertexCount, is 0"); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4474 | return false; |
| 4475 | } |
| 4476 | |
| 4477 | if (instanceCount == 0) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4478 | // 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] | 4479 | // this an error or leave as is. |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4480 | 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] | 4481 | REQUIRED_PARAMETER, LayerName, "vkCmdDraw parameter, uint32_t instanceCount, is 0"); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4482 | return false; |
| 4483 | } |
| 4484 | |
| 4485 | return true; |
| 4486 | } |
| 4487 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4488 | VKAPI_ATTR void VKAPI_CALL CmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, |
| 4489 | uint32_t firstVertex, uint32_t firstInstance) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4490 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4491 | PreCmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4492 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4493 | my_data->dispatch_table.CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4494 | } |
| 4495 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4496 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, |
| 4497 | uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4498 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4499 | my_data->dispatch_table.CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4500 | } |
| 4501 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4502 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, |
| 4503 | uint32_t stride) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4504 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4505 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4506 | assert(my_data != NULL); |
| 4507 | |
Mark Lobodzinski | 33d8c9b | 2017-02-28 14:18:04 -0700 | [diff] [blame] | 4508 | if (!my_data->physical_device_features.multiDrawIndirect && ((count > 1))) { |
| 4509 | skip = log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4510 | DEVICE_FEATURE, LayerName, |
| 4511 | "CmdDrawIndirect(): Device feature multiDrawIndirect disabled: count must be 0 or 1 but is %d", count); |
| 4512 | } |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4513 | skip |= parameter_validation_vkCmdDrawIndirect(my_data->report_data, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4514 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4515 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4516 | my_data->dispatch_table.CmdDrawIndirect(commandBuffer, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4517 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4518 | } |
| 4519 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4520 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 4521 | uint32_t count, uint32_t stride) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4522 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4523 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4524 | assert(my_data != NULL); |
Mark Lobodzinski | 33d8c9b | 2017-02-28 14:18:04 -0700 | [diff] [blame] | 4525 | if (!my_data->physical_device_features.multiDrawIndirect && ((count > 1))) { |
| 4526 | skip = |
| 4527 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4528 | DEVICE_FEATURE, LayerName, |
| 4529 | "CmdDrawIndexedIndirect(): Device feature multiDrawIndirect disabled: count must be 0 or 1 but is %d", count); |
| 4530 | } |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4531 | skip |= parameter_validation_vkCmdDrawIndexedIndirect(my_data->report_data, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4532 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4533 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4534 | my_data->dispatch_table.CmdDrawIndexedIndirect(commandBuffer, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4535 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4536 | } |
| 4537 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4538 | 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] | 4539 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4540 | my_data->dispatch_table.CmdDispatch(commandBuffer, x, y, z); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4541 | } |
| 4542 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4543 | VKAPI_ATTR void VKAPI_CALL CmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4544 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4545 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4546 | assert(my_data != NULL); |
| 4547 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4548 | skip |= parameter_validation_vkCmdDispatchIndirect(my_data->report_data, buffer, offset); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4549 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4550 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4551 | my_data->dispatch_table.CmdDispatchIndirect(commandBuffer, buffer, offset); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4552 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4553 | } |
| 4554 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4555 | VKAPI_ATTR void VKAPI_CALL CmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, |
| 4556 | uint32_t regionCount, const VkBufferCopy *pRegions) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4557 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4558 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4559 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4560 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4561 | skip |= parameter_validation_vkCmdCopyBuffer(my_data->report_data, srcBuffer, dstBuffer, regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4562 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4563 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4564 | my_data->dispatch_table.CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4565 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4566 | } |
| 4567 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4568 | static bool PreCmdCopyImage(VkCommandBuffer commandBuffer, const VkImageCopy *pRegions) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4569 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4570 | if (pRegions != nullptr) { |
| 4571 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4572 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4573 | log_msg( |
| 4574 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4575 | VALIDATION_ERROR_01225, LayerName, |
| 4576 | "vkCmdCopyImage() parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator. %s", |
| 4577 | validation_error_map[VALIDATION_ERROR_01225]); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4578 | return false; |
| 4579 | } |
| 4580 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4581 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4582 | log_msg( |
| 4583 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4584 | VALIDATION_ERROR_01225, LayerName, |
| 4585 | "vkCmdCopyImage() parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator. %s", |
| 4586 | validation_error_map[VALIDATION_ERROR_01225]); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4587 | return false; |
| 4588 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4589 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4590 | |
| 4591 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4592 | } |
| 4593 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4594 | VKAPI_ATTR void VKAPI_CALL CmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4595 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4596 | const VkImageCopy *pRegions) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4597 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4598 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4599 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4600 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4601 | skip |= parameter_validation_vkCmdCopyImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4602 | regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4603 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4604 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4605 | PreCmdCopyImage(commandBuffer, pRegions); |
| 4606 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4607 | my_data->dispatch_table.CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, |
| 4608 | pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4609 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4610 | } |
| 4611 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4612 | static bool PreCmdBlitImage(VkCommandBuffer commandBuffer, const VkImageBlit *pRegions) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4613 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4614 | if (pRegions != nullptr) { |
| 4615 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4616 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4617 | 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] | 4618 | UNRECOGNIZED_VALUE, LayerName, |
Mike Weiblen | fa0fd07 | 2017-01-06 16:20:51 -0700 | [diff] [blame] | 4619 | "vkCmdBlitImage() parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4620 | return false; |
| 4621 | } |
| 4622 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4623 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4624 | 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] | 4625 | UNRECOGNIZED_VALUE, LayerName, |
Mike Weiblen | fa0fd07 | 2017-01-06 16:20:51 -0700 | [diff] [blame] | 4626 | "vkCmdBlitImage() parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4627 | return false; |
| 4628 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4629 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4630 | |
| 4631 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4632 | } |
| 4633 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4634 | VKAPI_ATTR void VKAPI_CALL CmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4635 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4636 | const VkImageBlit *pRegions, VkFilter filter) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4637 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4638 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4639 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4640 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4641 | skip |= parameter_validation_vkCmdBlitImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4642 | regionCount, pRegions, filter); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4643 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4644 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4645 | PreCmdBlitImage(commandBuffer, pRegions); |
| 4646 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4647 | my_data->dispatch_table.CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, |
| 4648 | pRegions, filter); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4649 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4650 | } |
| 4651 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4652 | static bool PreCmdCopyBufferToImage(VkCommandBuffer commandBuffer, const VkBufferImageCopy *pRegions) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4653 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4654 | if (pRegions != nullptr) { |
| 4655 | if ((pRegions->imageSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4656 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4657 | 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] | 4658 | UNRECOGNIZED_VALUE, LayerName, |
Mike Weiblen | fa0fd07 | 2017-01-06 16:20:51 -0700 | [diff] [blame] | 4659 | "vkCmdCopyBufferToImage() parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4660 | "enumerator"); |
| 4661 | return false; |
| 4662 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4663 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4664 | |
| 4665 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4666 | } |
| 4667 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4668 | VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, |
| 4669 | VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4670 | const VkBufferImageCopy *pRegions) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4671 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4672 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4673 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4674 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4675 | skip |= parameter_validation_vkCmdCopyBufferToImage(my_data->report_data, srcBuffer, dstImage, dstImageLayout, regionCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4676 | pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4677 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4678 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4679 | PreCmdCopyBufferToImage(commandBuffer, pRegions); |
| 4680 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4681 | my_data->dispatch_table.CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4682 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4683 | } |
| 4684 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4685 | static bool PreCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, const VkBufferImageCopy *pRegions) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4686 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4687 | if (pRegions != nullptr) { |
| 4688 | if ((pRegions->imageSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4689 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4690 | 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] | 4691 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4692 | "vkCmdCopyImageToBuffer parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
| 4693 | "enumerator"); |
| 4694 | return false; |
| 4695 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4696 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4697 | |
| 4698 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4699 | } |
| 4700 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4701 | VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4702 | VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4703 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4704 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4705 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4706 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4707 | skip |= parameter_validation_vkCmdCopyImageToBuffer(my_data->report_data, srcImage, srcImageLayout, dstBuffer, regionCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4708 | pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4709 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4710 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4711 | PreCmdCopyImageToBuffer(commandBuffer, pRegions); |
| 4712 | |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4713 | my_data->dispatch_table.CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4714 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4715 | } |
| 4716 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4717 | VKAPI_ATTR void VKAPI_CALL CmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
Mark Lobodzinski | a2d9384 | 2017-02-08 16:28:18 -0700 | [diff] [blame] | 4718 | VkDeviceSize dataSize, const void *pData) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4719 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4720 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4721 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4722 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4723 | skip |= parameter_validation_vkCmdUpdateBuffer(my_data->report_data, dstBuffer, dstOffset, dataSize, pData); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4724 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4725 | if (dstOffset & 3) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4726 | skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
| 4727 | VALIDATION_ERROR_01147, LayerName, |
| 4728 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4. %s", |
| 4729 | dstOffset, validation_error_map[VALIDATION_ERROR_01147]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4730 | } |
| 4731 | |
| 4732 | if ((dataSize <= 0) || (dataSize > 65536)) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4733 | 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] | 4734 | VALIDATION_ERROR_01148, LayerName, "vkCmdUpdateBuffer() parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 |
| 4735 | "), must be greater than zero and less than or equal to 65536. %s", |
| 4736 | dataSize, validation_error_map[VALIDATION_ERROR_01148]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4737 | } else if (dataSize & 3) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4738 | skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
| 4739 | VALIDATION_ERROR_01149, LayerName, |
| 4740 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 "), is not a multiple of 4. %s", |
| 4741 | dataSize, validation_error_map[VALIDATION_ERROR_01149]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4742 | } |
| 4743 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4744 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4745 | my_data->dispatch_table.CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4746 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4747 | } |
| 4748 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4749 | VKAPI_ATTR void VKAPI_CALL CmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 4750 | VkDeviceSize size, uint32_t data) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4751 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4752 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4753 | assert(my_data != NULL); |
| 4754 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4755 | skip |= parameter_validation_vkCmdFillBuffer(my_data->report_data, dstBuffer, dstOffset, size, data); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4756 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4757 | if (dstOffset & 3) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4758 | skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
| 4759 | VALIDATION_ERROR_01133, LayerName, |
| 4760 | "vkCmdFillBuffer() parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4. %s", |
| 4761 | dstOffset, validation_error_map[VALIDATION_ERROR_01133]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4762 | } |
| 4763 | |
| 4764 | if (size != VK_WHOLE_SIZE) { |
| 4765 | if (size <= 0) { |
Mike Weiblen | a666638 | 2017-01-05 15:16:11 -0700 | [diff] [blame] | 4766 | skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
| 4767 | VALIDATION_ERROR_01134, LayerName, |
| 4768 | "vkCmdFillBuffer() parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), must be greater than zero. %s", |
| 4769 | size, validation_error_map[VALIDATION_ERROR_01134]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4770 | } else if (size & 3) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4771 | 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] | 4772 | VALIDATION_ERROR_01136, LayerName, |
| 4773 | "vkCmdFillBuffer() parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), is not a multiple of 4. %s", size, |
| 4774 | validation_error_map[VALIDATION_ERROR_01136]); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4775 | } |
| 4776 | } |
| 4777 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4778 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4779 | my_data->dispatch_table.CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4780 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4781 | } |
| 4782 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4783 | VKAPI_ATTR void VKAPI_CALL CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 4784 | const VkClearColorValue *pColor, uint32_t rangeCount, |
| 4785 | const VkImageSubresourceRange *pRanges) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4786 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4787 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4788 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4789 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4790 | 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] | 4791 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4792 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4793 | my_data->dispatch_table.CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4794 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4795 | } |
| 4796 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4797 | VKAPI_ATTR void VKAPI_CALL CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 4798 | const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, |
| 4799 | const VkImageSubresourceRange *pRanges) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4800 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4801 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4802 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4803 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4804 | skip |= parameter_validation_vkCmdClearDepthStencilImage(my_data->report_data, image, imageLayout, pDepthStencil, rangeCount, |
| 4805 | pRanges); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4806 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4807 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4808 | my_data->dispatch_table.CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4809 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4810 | } |
| 4811 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4812 | VKAPI_ATTR void VKAPI_CALL CmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 4813 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
| 4814 | const VkClearRect *pRects) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4815 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4816 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4817 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4818 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4819 | skip |= parameter_validation_vkCmdClearAttachments(my_data->report_data, attachmentCount, pAttachments, rectCount, pRects); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4820 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4821 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4822 | my_data->dispatch_table.CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4823 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4824 | } |
| 4825 | |
Mike Weiblen | 3716627 | 2017-01-05 15:11:00 -0700 | [diff] [blame] | 4826 | static bool PreCmdResolveImage(VkCommandBuffer commandBuffer, const VkImageResolve *pRegions) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4827 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4828 | if (pRegions != nullptr) { |
| 4829 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4830 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 4831 | log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4832 | 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] | 4833 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4834 | "vkCmdResolveImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 4835 | return false; |
| 4836 | } |
| 4837 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4838 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 4839 | log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4840 | 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] | 4841 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4842 | "vkCmdResolveImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 4843 | return false; |
| 4844 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4845 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4846 | |
| 4847 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4848 | } |
| 4849 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4850 | VKAPI_ATTR void VKAPI_CALL CmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4851 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4852 | const VkImageResolve *pRegions) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4853 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4854 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4855 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4856 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4857 | skip |= parameter_validation_vkCmdResolveImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4858 | regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4859 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4860 | if (!skip) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4861 | PreCmdResolveImage(commandBuffer, pRegions); |
| 4862 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4863 | my_data->dispatch_table.CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, |
| 4864 | pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4865 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4866 | } |
| 4867 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4868 | VKAPI_ATTR void VKAPI_CALL CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4869 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4870 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4871 | assert(my_data != NULL); |
| 4872 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4873 | skip |= parameter_validation_vkCmdSetEvent(my_data->report_data, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4874 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4875 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4876 | my_data->dispatch_table.CmdSetEvent(commandBuffer, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4877 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4878 | } |
| 4879 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4880 | VKAPI_ATTR void VKAPI_CALL CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4881 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4882 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4883 | assert(my_data != NULL); |
| 4884 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4885 | skip |= parameter_validation_vkCmdResetEvent(my_data->report_data, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4886 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4887 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4888 | my_data->dispatch_table.CmdResetEvent(commandBuffer, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4889 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4890 | } |
| 4891 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4892 | VKAPI_ATTR void VKAPI_CALL CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, |
| 4893 | VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, |
| 4894 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 4895 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 4896 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4897 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4898 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4899 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4900 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4901 | skip |= parameter_validation_vkCmdWaitEvents(my_data->report_data, eventCount, pEvents, srcStageMask, dstStageMask, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4902 | memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, |
| 4903 | pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4904 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4905 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4906 | my_data->dispatch_table.CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, |
| 4907 | pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, |
| 4908 | imageMemoryBarrierCount, pImageMemoryBarriers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4909 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4910 | } |
| 4911 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4912 | VKAPI_ATTR void VKAPI_CALL CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, |
| 4913 | VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, |
| 4914 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 4915 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 4916 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4917 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4918 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4919 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4920 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4921 | skip |= parameter_validation_vkCmdPipelineBarrier(my_data->report_data, srcStageMask, dstStageMask, dependencyFlags, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4922 | memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, |
| 4923 | pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4924 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4925 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 4926 | my_data->dispatch_table.CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, |
| 4927 | pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, |
| 4928 | imageMemoryBarrierCount, pImageMemoryBarriers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4929 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4930 | } |
| 4931 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4932 | VKAPI_ATTR void VKAPI_CALL CmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot, |
| 4933 | VkQueryControlFlags flags) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4934 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4935 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4936 | assert(my_data != NULL); |
| 4937 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4938 | skip |= parameter_validation_vkCmdBeginQuery(my_data->report_data, queryPool, slot, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4939 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4940 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4941 | my_data->dispatch_table.CmdBeginQuery(commandBuffer, queryPool, slot, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4942 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4943 | } |
| 4944 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4945 | 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] | 4946 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4947 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4948 | assert(my_data != NULL); |
| 4949 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4950 | skip |= parameter_validation_vkCmdEndQuery(my_data->report_data, queryPool, slot); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4951 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4952 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4953 | my_data->dispatch_table.CmdEndQuery(commandBuffer, queryPool, slot); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4954 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4955 | } |
| 4956 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4957 | VKAPI_ATTR void VKAPI_CALL CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 4958 | uint32_t queryCount) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4959 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4960 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4961 | assert(my_data != NULL); |
| 4962 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4963 | skip |= parameter_validation_vkCmdResetQueryPool(my_data->report_data, queryPool, firstQuery, queryCount); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4964 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4965 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4966 | my_data->dispatch_table.CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4967 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4968 | } |
| 4969 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4970 | bool PostCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, |
| 4971 | uint32_t slot) { |
Chia-I Wu | 51ce5ea | 2015-10-26 19:40:27 +0800 | [diff] [blame] | 4972 | ValidateEnumerator(pipelineStage); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4973 | |
| 4974 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4975 | } |
| 4976 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4977 | VKAPI_ATTR void VKAPI_CALL CmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, |
| 4978 | VkQueryPool queryPool, uint32_t query) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4979 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4980 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4981 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4982 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4983 | skip |= parameter_validation_vkCmdWriteTimestamp(my_data->report_data, pipelineStage, queryPool, query); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4984 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4985 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 4986 | my_data->dispatch_table.CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4987 | |
| 4988 | PostCmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 4989 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4990 | } |
| 4991 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4992 | VKAPI_ATTR void VKAPI_CALL CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 4993 | uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 4994 | VkDeviceSize stride, VkQueryResultFlags flags) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4995 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 4996 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4997 | assert(my_data != NULL); |
| 4998 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 4999 | skip |= parameter_validation_vkCmdCopyQueryPoolResults(my_data->report_data, queryPool, firstQuery, queryCount, dstBuffer, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5000 | dstOffset, stride, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 5001 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5002 | if (!skip) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5003 | my_data->dispatch_table.CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, |
| 5004 | stride, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 5005 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 5006 | } |
| 5007 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5008 | VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, |
| 5009 | uint32_t offset, uint32_t size, const void *pValues) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5010 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5011 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5012 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 5013 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5014 | 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] | 5015 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5016 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5017 | my_data->dispatch_table.CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5018 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 5019 | } |
| 5020 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5021 | VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, |
| 5022 | VkSubpassContents contents) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5023 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5024 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5025 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 5026 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5027 | skip |= parameter_validation_vkCmdBeginRenderPass(my_data->report_data, pRenderPassBegin, contents); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 5028 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5029 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5030 | my_data->dispatch_table.CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5031 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 5032 | } |
| 5033 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5034 | VKAPI_ATTR void VKAPI_CALL CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5035 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5036 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 5037 | assert(my_data != NULL); |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 5038 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5039 | skip |= parameter_validation_vkCmdNextSubpass(my_data->report_data, contents); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 5040 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5041 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5042 | my_data->dispatch_table.CmdNextSubpass(commandBuffer, contents); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 5043 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 5044 | } |
| 5045 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5046 | VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5047 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5048 | my_data->dispatch_table.CmdEndRenderPass(commandBuffer); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 5049 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 5050 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5051 | VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, |
| 5052 | const VkCommandBuffer *pCommandBuffers) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5053 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5054 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5055 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 5056 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5057 | skip |= parameter_validation_vkCmdExecuteCommands(my_data->report_data, commandBufferCount, pCommandBuffers); |
Chia-I Wu | 0b50a1c | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 5058 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5059 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5060 | my_data->dispatch_table.CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 5061 | } |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 5062 | } |
| 5063 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5064 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5065 | return util_GetLayerProperties(1, &global_layer, pCount, pProperties); |
| 5066 | } |
| 5067 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5068 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 5069 | 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 EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 5074 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5075 | if (pLayerName && !strcmp(pLayerName, global_layer.layerName)) |
| 5076 | return util_GetExtensionProperties(1, instance_extensions, pCount, pProperties); |
| 5077 | |
| 5078 | return VK_ERROR_LAYER_NOT_PRESENT; |
| 5079 | } |
| 5080 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5081 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, |
| 5082 | uint32_t *pCount, VkExtensionProperties *pProperties) { |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5083 | /* parameter_validation does not have any physical device extensions */ |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5084 | 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] | 5085 | |
| 5086 | assert(physicalDevice); |
| 5087 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5088 | return GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map) |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5089 | ->dispatch_table.EnumerateDeviceExtensionProperties(physicalDevice, NULL, pCount, pProperties); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5090 | } |
| 5091 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5092 | 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] | 5093 | if (!flag) { |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5094 | return log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 5095 | EXTENSION_NOT_ENABLED, LayerName, |
| 5096 | "%s() called even though the %s extension was not enabled for this VkDevice.", function_name, |
| 5097 | extension_name); |
Chris Forbes | 448ebcb | 2016-11-03 09:29:52 +1300 | [diff] [blame] | 5098 | } |
| 5099 | |
| 5100 | return false; |
| 5101 | } |
| 5102 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5103 | // WSI Extension Functions |
| 5104 | |
| 5105 | VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5106 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5107 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5108 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5109 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5110 | assert(my_data != NULL); |
| 5111 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5112 | skip |= require_device_extension(my_data, my_data->enables.khr_swapchain_enabled, "vkCreateSwapchainKHR", |
| 5113 | VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5114 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5115 | skip |= parameter_validation_vkCreateSwapchainKHR(my_data->report_data, pCreateInfo, pAllocator, pSwapchain); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5116 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5117 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5118 | result = my_data->dispatch_table.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5119 | |
| 5120 | validate_result(my_data->report_data, "vkCreateSwapchainKHR", result); |
| 5121 | } |
| 5122 | |
| 5123 | return result; |
| 5124 | } |
| 5125 | |
| 5126 | 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] | 5127 | VkImage *pSwapchainImages) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5128 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5129 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5130 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5131 | assert(my_data != NULL); |
| 5132 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5133 | skip |= require_device_extension(my_data, my_data->enables.khr_swapchain_enabled, "vkGetSwapchainImagesKHR", |
| 5134 | VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5135 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5136 | skip |= parameter_validation_vkGetSwapchainImagesKHR(my_data->report_data, swapchain, pSwapchainImageCount, pSwapchainImages); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5137 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5138 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5139 | result = my_data->dispatch_table.GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5140 | |
| 5141 | validate_result(my_data->report_data, "vkGetSwapchainImagesKHR", result); |
| 5142 | } |
| 5143 | |
| 5144 | return result; |
| 5145 | } |
| 5146 | |
| 5147 | 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] | 5148 | VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5149 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5150 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5151 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5152 | assert(my_data != NULL); |
| 5153 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5154 | skip |= require_device_extension(my_data, my_data->enables.khr_swapchain_enabled, "vkAcquireNextImageKHR", |
| 5155 | VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5156 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5157 | 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] | 5158 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5159 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5160 | result = my_data->dispatch_table.AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5161 | |
| 5162 | validate_result(my_data->report_data, "vkAcquireNextImageKHR", result); |
| 5163 | } |
| 5164 | |
| 5165 | return result; |
| 5166 | } |
| 5167 | |
| 5168 | VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { |
| 5169 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5170 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5171 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5172 | assert(my_data != NULL); |
| 5173 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5174 | skip |= require_device_extension(my_data, my_data->enables.khr_swapchain_enabled, "vkQueuePresentKHR", |
| 5175 | VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5176 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5177 | skip |= parameter_validation_vkQueuePresentKHR(my_data->report_data, pPresentInfo); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5178 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5179 | result = my_data->dispatch_table.QueuePresentKHR(queue, pPresentInfo); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5180 | |
| 5181 | validate_result(my_data->report_data, "vkQueuePresentKHR", result); |
| 5182 | } |
| 5183 | |
| 5184 | return result; |
| 5185 | } |
| 5186 | |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5187 | 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] | 5188 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5189 | layer_data *my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5190 | assert(my_data != NULL); |
| 5191 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5192 | skip |= require_device_extension(my_data, my_data->enables.khr_swapchain_enabled, "vkDestroySwapchainKHR", |
| 5193 | VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5194 | |
| 5195 | /* No generated validation function for this call */ |
| 5196 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5197 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5198 | my_data->dispatch_table.DestroySwapchainKHR(device, swapchain, pAllocator); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5199 | } |
| 5200 | } |
| 5201 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5202 | static bool require_instance_extension(void *instance, bool instance_extension_enables::*flag, char const *function_name, |
| 5203 | char const *extension_name) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5204 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Chris Forbes | 6be763e | 2016-11-24 12:42:33 +1300 | [diff] [blame] | 5205 | if (!(my_data->extensions.*flag)) { |
Chris Forbes | 115f98c | 2016-11-03 09:51:48 +1300 | [diff] [blame] | 5206 | return log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, |
| 5207 | reinterpret_cast<uint64_t>(instance), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5208 | "%s() called even though the %s extension was not enabled for this VkInstance.", function_name, |
| 5209 | extension_name); |
Chris Forbes | 115f98c | 2016-11-03 09:51:48 +1300 | [diff] [blame] | 5210 | } |
| 5211 | |
| 5212 | return false; |
| 5213 | } |
| 5214 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5215 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, |
| 5216 | VkSurfaceKHR surface, VkBool32 *pSupported) { |
| 5217 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5218 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5219 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5220 | assert(my_data != NULL); |
| 5221 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5222 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::surface_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5223 | "vkGetPhysicalDeviceSurfaceSupportKHR", VK_KHR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 8a13e27 | 2016-11-02 17:43:34 +1300 | [diff] [blame] | 5224 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5225 | skip |= parameter_validation_vkGetPhysicalDeviceSurfaceSupportKHR(my_data->report_data, queueFamilyIndex, surface, pSupported); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5226 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5227 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5228 | result = my_data->dispatch_table.GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5229 | |
| 5230 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceSupportKHR", result); |
| 5231 | } |
| 5232 | |
| 5233 | return result; |
| 5234 | } |
| 5235 | |
| 5236 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 5237 | VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { |
| 5238 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5239 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5240 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5241 | assert(my_data != NULL); |
| 5242 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5243 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::surface_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5244 | "vkGetPhysicalDeviceSurfaceCapabilitiesKHR", VK_KHR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 8a13e27 | 2016-11-02 17:43:34 +1300 | [diff] [blame] | 5245 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5246 | skip |= parameter_validation_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(my_data->report_data, surface, pSurfaceCapabilities); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5247 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5248 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5249 | result = my_data->dispatch_table.GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5250 | |
| 5251 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR", result); |
| 5252 | } |
| 5253 | |
| 5254 | return result; |
| 5255 | } |
| 5256 | |
| 5257 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 5258 | uint32_t *pSurfaceFormatCount, |
| 5259 | VkSurfaceFormatKHR *pSurfaceFormats) { |
| 5260 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5261 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5262 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5263 | assert(my_data != NULL); |
| 5264 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5265 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::surface_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5266 | "vkGetPhysicalDeviceSurfaceFormatsKHR", VK_KHR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 8a13e27 | 2016-11-02 17:43:34 +1300 | [diff] [blame] | 5267 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5268 | skip |= parameter_validation_vkGetPhysicalDeviceSurfaceFormatsKHR(my_data->report_data, surface, pSurfaceFormatCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5269 | pSurfaceFormats); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5270 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5271 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5272 | result = my_data->dispatch_table.GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, |
| 5273 | pSurfaceFormats); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5274 | |
| 5275 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceFormatsKHR", result); |
| 5276 | } |
| 5277 | |
| 5278 | return result; |
| 5279 | } |
| 5280 | |
| 5281 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 5282 | uint32_t *pPresentModeCount, |
| 5283 | VkPresentModeKHR *pPresentModes) { |
| 5284 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5285 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5286 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5287 | assert(my_data != NULL); |
| 5288 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5289 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::surface_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5290 | "vkGetPhysicalDeviceSurfacePresentModesKHR", VK_KHR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 8a13e27 | 2016-11-02 17:43:34 +1300 | [diff] [blame] | 5291 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5292 | skip |= parameter_validation_vkGetPhysicalDeviceSurfacePresentModesKHR(my_data->report_data, surface, pPresentModeCount, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5293 | pPresentModes); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5294 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5295 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5296 | result = my_data->dispatch_table.GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, |
| 5297 | pPresentModes); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5298 | |
| 5299 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfacePresentModesKHR", result); |
| 5300 | } |
| 5301 | |
| 5302 | return result; |
| 5303 | } |
| 5304 | |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5305 | 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] | 5306 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5307 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5308 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5309 | skip |= require_instance_extension(instance, &instance_extension_enables::surface_enabled, "vkDestroySurfaceKHR", |
| 5310 | VK_KHR_SURFACE_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5311 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5312 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5313 | my_data->dispatch_table.DestroySurfaceKHR(instance, surface, pAllocator); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5314 | } |
| 5315 | } |
| 5316 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5317 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 5318 | VKAPI_ATTR VkResult VKAPI_CALL CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
| 5319 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 5320 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5321 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5322 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5323 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5324 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5325 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5326 | skip |= require_instance_extension(instance, &instance_extension_enables::win32_enabled, "vkCreateWin32SurfaceKHR", |
| 5327 | VK_KHR_WIN32_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5328 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5329 | skip |= parameter_validation_vkCreateWin32SurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5330 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5331 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5332 | result = my_data->dispatch_table.CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5333 | } |
| 5334 | |
| 5335 | validate_result(my_data->report_data, "vkCreateWin32SurfaceKHR", result); |
| 5336 | |
| 5337 | return result; |
| 5338 | } |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5339 | |
| 5340 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5341 | uint32_t queueFamilyIndex) { |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5342 | VkBool32 result = false; |
| 5343 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5344 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5345 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5346 | bool skip = false; |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5347 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5348 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::win32_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5349 | "vkGetPhysicalDeviceWin32PresentationSupportKHR", VK_KHR_WIN32_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5350 | |
Chris Forbes | 7281a50 | 2016-11-08 08:45:03 +1300 | [diff] [blame] | 5351 | // TODO: codegen doesn't produce this function? |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5352 | // skip |= parameter_validation_vkGetPhysicalDeviceWin32PresentationSupportKHR(physicalDevice, queueFamilyIndex); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5353 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5354 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5355 | result = my_data->dispatch_table.GetPhysicalDeviceWin32PresentationSupportKHR(physicalDevice, queueFamilyIndex); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5356 | } |
| 5357 | |
| 5358 | return result; |
| 5359 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5360 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5361 | |
| 5362 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 5363 | VKAPI_ATTR VkResult VKAPI_CALL CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, |
| 5364 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 5365 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5366 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5367 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5368 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5369 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5370 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5371 | skip |= require_instance_extension(instance, &instance_extension_enables::xcb_enabled, "vkCreateXcbSurfaceKHR", |
| 5372 | VK_KHR_XCB_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5373 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5374 | skip |= parameter_validation_vkCreateXcbSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5375 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5376 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5377 | result = my_data->dispatch_table.CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5378 | } |
| 5379 | |
| 5380 | validate_result(my_data->report_data, "vkCreateXcbSurfaceKHR", result); |
| 5381 | |
| 5382 | return result; |
| 5383 | } |
| 5384 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5385 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5386 | uint32_t queueFamilyIndex, xcb_connection_t *connection, |
| 5387 | xcb_visualid_t visual_id) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5388 | VkBool32 result = false; |
| 5389 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5390 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5391 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5392 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5393 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5394 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::xcb_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5395 | "vkGetPhysicalDeviceXcbPresentationSupportKHR", VK_KHR_XCB_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5396 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5397 | skip |= parameter_validation_vkGetPhysicalDeviceXcbPresentationSupportKHR(my_data->report_data, queueFamilyIndex, connection, |
| 5398 | visual_id); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5399 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5400 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5401 | result = my_data->dispatch_table.GetPhysicalDeviceXcbPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection, |
| 5402 | visual_id); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5403 | } |
| 5404 | |
| 5405 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5406 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5407 | #endif // VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5408 | |
| 5409 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 5410 | VKAPI_ATTR VkResult VKAPI_CALL CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5411 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5412 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5413 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5414 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5415 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5416 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5417 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5418 | skip |= require_instance_extension(instance, &instance_extension_enables::xlib_enabled, "vkCreateXlibSurfaceKHR", |
| 5419 | VK_KHR_XLIB_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5420 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5421 | skip |= parameter_validation_vkCreateXlibSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5422 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5423 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5424 | result = my_data->dispatch_table.CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5425 | } |
| 5426 | |
| 5427 | validate_result(my_data->report_data, "vkCreateXlibSurfaceKHR", result); |
| 5428 | |
| 5429 | return result; |
| 5430 | } |
| 5431 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5432 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5433 | uint32_t queueFamilyIndex, Display *dpy, |
| 5434 | VisualID visualID) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5435 | VkBool32 result = false; |
| 5436 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5437 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5438 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5439 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5440 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5441 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::xlib_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5442 | "vkGetPhysicalDeviceXlibPresentationSupportKHR", VK_KHR_XLIB_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5443 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5444 | skip |= |
| 5445 | parameter_validation_vkGetPhysicalDeviceXlibPresentationSupportKHR(my_data->report_data, queueFamilyIndex, dpy, visualID); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5446 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5447 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5448 | result = |
| 5449 | my_data->dispatch_table.GetPhysicalDeviceXlibPresentationSupportKHR(physicalDevice, queueFamilyIndex, dpy, visualID); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5450 | } |
Karl Schultz | 3a41cae | 2016-09-02 10:17:05 -0600 | [diff] [blame] | 5451 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5452 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5453 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5454 | |
| 5455 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 5456 | VKAPI_ATTR VkResult VKAPI_CALL CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5457 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5458 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5459 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5460 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5461 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5462 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5463 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5464 | skip |= require_instance_extension(instance, &instance_extension_enables::mir_enabled, "vkCreateMirSurfaceKHR", |
| 5465 | VK_KHR_MIR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5466 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5467 | skip |= parameter_validation_vkCreateMirSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5468 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5469 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5470 | result = my_data->dispatch_table.CreateMirSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5471 | } |
| 5472 | |
| 5473 | validate_result(my_data->report_data, "vkCreateMirSurfaceKHR", result); |
| 5474 | |
| 5475 | return result; |
| 5476 | } |
| 5477 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5478 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5479 | uint32_t queueFamilyIndex, MirConnection *connection) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5480 | VkBool32 result = false; |
| 5481 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5482 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5483 | assert(my_data != NULL); |
| 5484 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5485 | bool skip = false; |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5486 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5487 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::mir_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5488 | "vkGetPhysicalDeviceMirPresentationSupportKHR", VK_KHR_MIR_SURFACE_EXTENSION_NAME); |
Chris Forbes | 115f98c | 2016-11-03 09:51:48 +1300 | [diff] [blame] | 5489 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5490 | skip |= parameter_validation_vkGetPhysicalDeviceMirPresentationSupportKHR(my_data->report_data, queueFamilyIndex, connection); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5491 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5492 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5493 | result = my_data->dispatch_table.GetPhysicalDeviceMirPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5494 | } |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5495 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5496 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5497 | #endif // VK_USE_PLATFORM_MIR_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5498 | |
| 5499 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 5500 | VKAPI_ATTR VkResult VKAPI_CALL CreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5501 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5502 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5503 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5504 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5505 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5506 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5507 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5508 | skip |= require_instance_extension(instance, &instance_extension_enables::wayland_enabled, "vkCreateWaylandSurfaceKHR", |
| 5509 | VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); |
Chris Forbes | 115f98c | 2016-11-03 09:51:48 +1300 | [diff] [blame] | 5510 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5511 | skip |= parameter_validation_vkCreateWaylandSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5512 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5513 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5514 | result = my_data->dispatch_table.CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5515 | } |
| 5516 | |
| 5517 | validate_result(my_data->report_data, "vkCreateWaylandSurfaceKHR", result); |
| 5518 | |
| 5519 | return result; |
| 5520 | } |
| 5521 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5522 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5523 | uint32_t queueFamilyIndex, |
| 5524 | struct wl_display *display) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5525 | VkBool32 result = false; |
| 5526 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5527 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5528 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5529 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5530 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5531 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::wayland_enabled, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5532 | "vkGetPhysicalDeviceWaylandPresentationSupportKHR", VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); |
Chris Forbes | 115f98c | 2016-11-03 09:51:48 +1300 | [diff] [blame] | 5533 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 5534 | skip |= parameter_validation_vkGetPhysicalDeviceWaylandPresentationSupportKHR(my_data->report_data, queueFamilyIndex, display); |
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 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5537 | result = my_data->dispatch_table.GetPhysicalDeviceWaylandPresentationSupportKHR(physicalDevice, queueFamilyIndex, display); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5538 | } |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5539 | |
| 5540 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5541 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5542 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5543 | |
| 5544 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 5545 | VKAPI_ATTR VkResult VKAPI_CALL CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5546 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5547 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5548 | |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5549 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5550 | assert(my_data != NULL); |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5551 | bool skip = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5552 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5553 | skip |= require_instance_extension(instance, &instance_extension_enables::android_enabled, "vkCreateAndroidSurfaceKHR", |
| 5554 | VK_KHR_ANDROID_SURFACE_EXTENSION_NAME); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame] | 5555 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5556 | skip |= parameter_validation_vkCreateAndroidSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5557 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5558 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5559 | result = my_data->dispatch_table.CreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5560 | } |
| 5561 | |
| 5562 | validate_result(my_data->report_data, "vkCreateAndroidSurfaceKHR", result); |
| 5563 | |
| 5564 | return result; |
| 5565 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 5566 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5567 | |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5568 | VKAPI_ATTR VkResult VKAPI_CALL CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, |
| 5569 | const VkSwapchainCreateInfoKHR *pCreateInfos, |
| 5570 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) { |
| 5571 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5572 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5573 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5574 | assert(my_data != NULL); |
| 5575 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5576 | skip |= require_device_extension(my_data, my_data->enables.khr_display_swapchain_enabled, "vkCreateSharedSwapchainsKHR", |
| 5577 | VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME); |
Chris Forbes | be5f520 | 2016-11-02 18:34:25 +1300 | [diff] [blame] | 5578 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5579 | skip |= parameter_validation_vkCreateSharedSwapchainsKHR(my_data->report_data, swapchainCount, pCreateInfos, pAllocator, |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5580 | pSwapchains); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5581 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 5582 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 5583 | result = my_data->dispatch_table.CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5584 | |
| 5585 | validate_result(my_data->report_data, "vkCreateSharedSwapchainsKHR", result); |
| 5586 | } |
| 5587 | |
| 5588 | return result; |
| 5589 | } |
| 5590 | |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5591 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 5592 | VkDisplayPropertiesKHR *pProperties) { |
| 5593 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5594 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5595 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5596 | assert(my_data != NULL); |
| 5597 | |
| 5598 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, |
| 5599 | "vkGetPhysicalDeviceDisplayPropertiesKHR", VK_KHR_DISPLAY_EXTENSION_NAME); |
| 5600 | |
| 5601 | // No parameter validation function for this call? |
| 5602 | |
| 5603 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5604 | result = my_data->dispatch_table.GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, pPropertyCount, pProperties); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5605 | |
| 5606 | validate_result(my_data->report_data, "vkGetPhysicalDeviceDisplayPropertiesKHR", result); |
| 5607 | } |
| 5608 | |
| 5609 | return result; |
| 5610 | } |
| 5611 | |
| 5612 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 5613 | VkDisplayPlanePropertiesKHR *pProperties) { |
| 5614 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5615 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5616 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5617 | assert(my_data != NULL); |
| 5618 | |
| 5619 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, |
| 5620 | "vkGetPhysicalDeviceDisplayPlanePropertiesKHR", VK_KHR_DISPLAY_EXTENSION_NAME); |
| 5621 | |
| 5622 | // No parameter validation function for this call? |
| 5623 | |
| 5624 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5625 | result = my_data->dispatch_table.GetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, pPropertyCount, pProperties); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5626 | |
| 5627 | validate_result(my_data->report_data, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR", result); |
| 5628 | } |
| 5629 | |
| 5630 | return result; |
| 5631 | } |
| 5632 | |
| 5633 | VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, |
| 5634 | uint32_t *pDisplayCount, VkDisplayKHR *pDisplays) { |
| 5635 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5636 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5637 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5638 | assert(my_data != NULL); |
| 5639 | |
| 5640 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, |
| 5641 | "vkGetDisplayPlaneSupportedDisplaysKHR", VK_KHR_DISPLAY_EXTENSION_NAME); |
| 5642 | |
| 5643 | // No parameter validation function for this call? |
| 5644 | |
| 5645 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5646 | result = my_data->dispatch_table.GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, pDisplayCount, pDisplays); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5647 | |
| 5648 | validate_result(my_data->report_data, "vkGetDisplayPlaneSupportedDisplaysKHR", result); |
| 5649 | } |
| 5650 | |
| 5651 | return result; |
| 5652 | } |
| 5653 | |
| 5654 | VKAPI_ATTR VkResult VKAPI_CALL GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 5655 | uint32_t *pPropertyCount, VkDisplayModePropertiesKHR *pProperties) { |
| 5656 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5657 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5658 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5659 | assert(my_data != NULL); |
| 5660 | |
| 5661 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, |
| 5662 | "vkGetDisplayModePropertiesKHR", VK_KHR_DISPLAY_EXTENSION_NAME); |
| 5663 | |
| 5664 | // No parameter validation function for this call? |
| 5665 | |
| 5666 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5667 | result = my_data->dispatch_table.GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, pProperties); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5668 | |
| 5669 | validate_result(my_data->report_data, "vkGetDisplayModePropertiesKHR", result); |
| 5670 | } |
| 5671 | |
| 5672 | return result; |
| 5673 | } |
| 5674 | |
| 5675 | VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 5676 | const VkDisplayModeCreateInfoKHR *pCreateInfo, |
| 5677 | const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) { |
| 5678 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5679 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5680 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5681 | assert(my_data != NULL); |
| 5682 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5683 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, "vkCreateDisplayModeKHR", |
| 5684 | VK_KHR_DISPLAY_EXTENSION_NAME); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5685 | |
| 5686 | // No parameter validation function for this call? |
| 5687 | |
| 5688 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5689 | result = my_data->dispatch_table.CreateDisplayModeKHR(physicalDevice, display, pCreateInfo, pAllocator, pMode); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5690 | |
| 5691 | validate_result(my_data->report_data, "vkCreateDisplayModeKHR", result); |
| 5692 | } |
| 5693 | |
| 5694 | return result; |
| 5695 | } |
| 5696 | |
| 5697 | VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, |
| 5698 | uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR *pCapabilities) { |
| 5699 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5700 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5701 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5702 | assert(my_data != NULL); |
| 5703 | |
| 5704 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::display_enabled, |
| 5705 | "vkGetDisplayPlaneCapabilitiesKHR", VK_KHR_DISPLAY_EXTENSION_NAME); |
| 5706 | |
| 5707 | // No parameter validation function for this call? |
| 5708 | |
| 5709 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5710 | result = my_data->dispatch_table.GetDisplayPlaneCapabilitiesKHR(physicalDevice, mode, planeIndex, pCapabilities); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5711 | |
| 5712 | validate_result(my_data->report_data, "vkGetDisplayPlaneCapabilitiesKHR", result); |
| 5713 | } |
| 5714 | |
| 5715 | return result; |
| 5716 | } |
| 5717 | |
| 5718 | VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayPlaneSurfaceKHR(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, |
| 5719 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 5720 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5721 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5722 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5723 | assert(my_data != NULL); |
| 5724 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5725 | skip |= require_instance_extension(instance, &instance_extension_enables::display_enabled, "vkCreateDisplayPlaneSurfaceKHR", |
| 5726 | VK_KHR_DISPLAY_EXTENSION_NAME); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5727 | |
| 5728 | // No parameter validation function for this call? |
| 5729 | |
| 5730 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 5731 | result = my_data->dispatch_table.CreateDisplayPlaneSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Chris Forbes | 667a521 | 2016-11-03 10:18:35 +1300 | [diff] [blame] | 5732 | |
| 5733 | validate_result(my_data->report_data, "vkCreateDisplayPlaneSurfaceKHR", result); |
| 5734 | } |
| 5735 | |
| 5736 | return result; |
| 5737 | } |
| 5738 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5739 | // Definitions for the VK_KHR_get_physical_device_properties2 extension |
| 5740 | |
| 5741 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR *pFeatures) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5742 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5743 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5744 | assert(my_data != NULL); |
| 5745 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5746 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5747 | "vkGetPhysicalDeviceFeatures2KHR", VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5748 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5749 | skip |= parameter_validation_vkGetPhysicalDeviceFeatures2KHR(my_data->report_data, pFeatures); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5750 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5751 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5752 | my_data->dispatch_table.GetPhysicalDeviceFeatures2KHR(physicalDevice, pFeatures); |
| 5753 | } |
| 5754 | } |
| 5755 | |
| 5756 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, |
| 5757 | VkPhysicalDeviceProperties2KHR *pProperties) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5758 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5759 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5760 | assert(my_data != NULL); |
| 5761 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5762 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5763 | "vkGetPhysicalDeviceProperties2KHR", VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5764 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5765 | skip |= parameter_validation_vkGetPhysicalDeviceProperties2KHR(my_data->report_data, pProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5766 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5767 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5768 | my_data->dispatch_table.GetPhysicalDeviceProperties2KHR(physicalDevice, pProperties); |
| 5769 | } |
| 5770 | } |
| 5771 | |
| 5772 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, |
| 5773 | VkFormatProperties2KHR *pFormatProperties) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5774 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5775 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5776 | assert(my_data != NULL); |
| 5777 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5778 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5779 | "vkGetPhysicalDeviceFormatProperties2KHR", |
| 5780 | VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5781 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5782 | skip |= parameter_validation_vkGetPhysicalDeviceFormatProperties2KHR(my_data->report_data, format, pFormatProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5783 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5784 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5785 | my_data->dispatch_table.GetPhysicalDeviceFormatProperties2KHR(physicalDevice, format, pFormatProperties); |
| 5786 | } |
| 5787 | } |
| 5788 | |
| 5789 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties2KHR( |
| 5790 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo, |
| 5791 | VkImageFormatProperties2KHR *pImageFormatProperties) { |
| 5792 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5793 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5794 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5795 | assert(my_data != NULL); |
| 5796 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5797 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5798 | "vkGetPhysicalDeviceImageFormatProperties2KHR", |
| 5799 | VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5800 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5801 | skip |= parameter_validation_vkGetPhysicalDeviceImageFormatProperties2KHR(my_data->report_data, pImageFormatInfo, |
| 5802 | pImageFormatProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5803 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5804 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5805 | result = my_data->dispatch_table.GetPhysicalDeviceImageFormatProperties2KHR(physicalDevice, pImageFormatInfo, |
| 5806 | pImageFormatProperties); |
| 5807 | validate_result(my_data->report_data, "vkGetPhysicalDeviceImageFormatProperties2KHR", result); |
| 5808 | } |
| 5809 | |
| 5810 | return result; |
| 5811 | } |
| 5812 | |
| 5813 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physicalDevice, |
| 5814 | uint32_t *pQueueFamilyPropertyCount, |
| 5815 | VkQueueFamilyProperties2KHR *pQueueFamilyProperties) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5816 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5817 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5818 | assert(my_data != NULL); |
| 5819 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5820 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5821 | "vkGetPhysicalDeviceQueueFamilyProperties2KHR", |
| 5822 | VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5823 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5824 | skip |= parameter_validation_vkGetPhysicalDeviceQueueFamilyProperties2KHR(my_data->report_data, pQueueFamilyPropertyCount, |
| 5825 | pQueueFamilyProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5826 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5827 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5828 | my_data->dispatch_table.GetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice, pQueueFamilyPropertyCount, |
| 5829 | pQueueFamilyProperties); |
| 5830 | } |
| 5831 | } |
| 5832 | |
| 5833 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physicalDevice, |
| 5834 | VkPhysicalDeviceMemoryProperties2KHR *pMemoryProperties) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5835 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5836 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5837 | assert(my_data != NULL); |
| 5838 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5839 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5840 | "vkGetPhysicalDeviceMemoryProperties2KHR", |
| 5841 | VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5842 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5843 | skip |= parameter_validation_vkGetPhysicalDeviceMemoryProperties2KHR(my_data->report_data, pMemoryProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5844 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5845 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5846 | my_data->dispatch_table.GetPhysicalDeviceMemoryProperties2KHR(physicalDevice, pMemoryProperties); |
| 5847 | } |
| 5848 | } |
| 5849 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5850 | static bool PostGetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, |
| 5851 | const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, |
| 5852 | uint32_t *pPropertyCount, |
| 5853 | VkSparseImageFormatProperties2KHR *pProperties) { |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5854 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5855 | if (pProperties != nullptr) { |
| 5856 | for (uint32_t i = 0; i < *pPropertyCount; ++i) { |
| 5857 | if ((pProperties[i].properties.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 5858 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 5859 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 5860 | 1, LayerName, |
| 5861 | "vkGetPhysicalDeviceSparseImageFormatProperties2KHR parameter, VkImageAspect " |
| 5862 | "pProperties[%i].properties.aspectMask, is an " |
| 5863 | "unrecognized enumerator", |
| 5864 | i); |
| 5865 | return false; |
| 5866 | } |
| 5867 | } |
| 5868 | } |
| 5869 | return true; |
| 5870 | } |
| 5871 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5872 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties2KHR( |
| 5873 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, uint32_t *pPropertyCount, |
| 5874 | VkSparseImageFormatProperties2KHR *pProperties) { |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5875 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 5876 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5877 | assert(my_data != NULL); |
| 5878 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5879 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khr_get_phys_dev_properties2_enabled, |
| 5880 | "vkGetPhysicalDeviceSparseImageFormatProperties2KHR", |
| 5881 | VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5882 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5883 | skip |= parameter_validation_vkGetPhysicalDeviceSparseImageFormatProperties2KHR(my_data->report_data, pFormatInfo, |
| 5884 | pPropertyCount, pProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5885 | |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5886 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5887 | my_data->dispatch_table.GetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice, pFormatInfo, pPropertyCount, |
| 5888 | pProperties); |
Tobin Ehlis | 3da6396 | 2017-02-06 16:44:50 -0700 | [diff] [blame] | 5889 | PostGetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice, pFormatInfo, pPropertyCount, pProperties); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5890 | } |
| 5891 | } |
| 5892 | |
| 5893 | // Definitions for the VK_KHR_maintenance1 extension |
| 5894 | |
| 5895 | VKAPI_ATTR void VKAPI_CALL TrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlagsKHR flags) { |
| 5896 | bool skip_call = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5897 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 5898 | assert(my_data != NULL); |
| 5899 | |
| 5900 | skip_call |= require_device_extension(my_data, my_data->enables.khr_maintenance1, "vkTrimCommandPoolKHR", |
| 5901 | VK_KHR_MAINTENANCE1_EXTENSION_NAME); |
| 5902 | |
| 5903 | skip_call |= parameter_validation_vkTrimCommandPoolKHR(my_data->report_data, commandPool, flags); |
| 5904 | |
| 5905 | if (!skip_call) { |
| 5906 | my_data->dispatch_table.TrimCommandPoolKHR(device, commandPool, flags); |
| 5907 | } |
| 5908 | } |
| 5909 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 5910 | // Definitions for the VK_KHR_push_descriptor extension |
| 5911 | |
| 5912 | VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 5913 | VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, |
| 5914 | const VkWriteDescriptorSet *pDescriptorWrites) { |
| 5915 | bool skip_call = false; |
| 5916 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5917 | assert(my_data != NULL); |
| 5918 | |
| 5919 | skip_call |= require_device_extension(my_data, my_data->enables.khr_push_descriptor, "vkCmdPushDescriptorSetKHR", |
| 5920 | VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); |
| 5921 | |
| 5922 | skip_call |= parameter_validation_vkCmdPushDescriptorSetKHR(my_data->report_data, pipelineBindPoint, layout, set, |
| 5923 | descriptorWriteCount, pDescriptorWrites); |
| 5924 | |
| 5925 | if (!skip_call) { |
| 5926 | my_data->dispatch_table.CmdPushDescriptorSetKHR(commandBuffer, pipelineBindPoint, layout, set, descriptorWriteCount, |
| 5927 | pDescriptorWrites); |
| 5928 | } |
| 5929 | } |
| 5930 | |
| 5931 | // Definitions for the VK_KHR_descriptor_update_template extension |
| 5932 | |
| 5933 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorUpdateTemplateKHR(VkDevice device, |
| 5934 | const VkDescriptorUpdateTemplateCreateInfoKHR *pCreateInfo, |
| 5935 | const VkAllocationCallbacks *pAllocator, |
| 5936 | VkDescriptorUpdateTemplateKHR *pDescriptorUpdateTemplate) { |
| 5937 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5938 | bool skip_call = false; |
| 5939 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5940 | assert(my_data != NULL); |
| 5941 | |
| 5942 | skip_call |= require_device_extension(my_data, my_data->enables.khr_descriptor_update_template, |
| 5943 | "vkCreateDescriptorUpdateTemplateKHR", VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); |
| 5944 | |
| 5945 | skip_call |= parameter_validation_vkCreateDescriptorUpdateTemplateKHR(my_data->report_data, pCreateInfo, pAllocator, |
| 5946 | pDescriptorUpdateTemplate); |
| 5947 | |
| 5948 | if (!skip_call) { |
| 5949 | result = |
| 5950 | my_data->dispatch_table.CreateDescriptorUpdateTemplateKHR(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate); |
| 5951 | validate_result(my_data->report_data, "vkCreateDescriptorUpdateTemplateKHR", result); |
| 5952 | } |
| 5953 | |
| 5954 | return result; |
| 5955 | } |
| 5956 | |
| 5957 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorUpdateTemplateKHR(VkDevice device, |
| 5958 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, |
| 5959 | const VkAllocationCallbacks *pAllocator) { |
| 5960 | bool skip_call = false; |
| 5961 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5962 | assert(my_data != NULL); |
| 5963 | |
| 5964 | skip_call |= require_device_extension(my_data, my_data->enables.khr_descriptor_update_template, |
| 5965 | "vkDestroyDescriptorUpdateTemplateKHR", VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); |
| 5966 | |
| 5967 | #if 0 // Validation not automatically generated |
| 5968 | skip_call |= parameter_validation_vkDestroyDescriptorUpdateTemplateKHR(my_data->report_data, descriptorUpdateTemplate, |
| 5969 | pAllocator); |
| 5970 | #endif |
| 5971 | |
| 5972 | if (!skip_call) { |
| 5973 | my_data->dispatch_table.DestroyDescriptorUpdateTemplateKHR(device, descriptorUpdateTemplate, pAllocator); |
| 5974 | } |
| 5975 | } |
| 5976 | |
| 5977 | VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSetWithTemplateKHR(VkDevice device, VkDescriptorSet descriptorSet, |
| 5978 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, |
| 5979 | const void *pData) { |
| 5980 | bool skip_call = false; |
| 5981 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5982 | assert(my_data != NULL); |
| 5983 | |
| 5984 | skip_call |= require_device_extension(my_data, my_data->enables.khr_descriptor_update_template, |
| 5985 | "vkUpdateDescriptorSetWithTemplateKHR", VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); |
| 5986 | |
| 5987 | skip_call |= parameter_validation_vkUpdateDescriptorSetWithTemplateKHR(my_data->report_data, descriptorSet, |
| 5988 | descriptorUpdateTemplate, pData); |
| 5989 | |
| 5990 | if (!skip_call) { |
| 5991 | my_data->dispatch_table.UpdateDescriptorSetWithTemplateKHR(device, descriptorSet, descriptorUpdateTemplate, pData); |
| 5992 | } |
| 5993 | } |
| 5994 | |
| 5995 | VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer, |
| 5996 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, |
| 5997 | VkPipelineLayout layout, uint32_t set, const void *pData) { |
| 5998 | bool skip_call = false; |
| 5999 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6000 | assert(my_data != NULL); |
| 6001 | |
| 6002 | skip_call |= |
| 6003 | require_device_extension(my_data, my_data->enables.khr_descriptor_update_template, "vkCmdPushDescriptorSetWithTemplateKHR", |
| 6004 | VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); |
| 6005 | |
| 6006 | skip_call |= parameter_validation_vkCmdPushDescriptorSetWithTemplateKHR(my_data->report_data, descriptorUpdateTemplate, layout, |
| 6007 | set, pData); |
| 6008 | |
| 6009 | if (!skip_call) { |
| 6010 | my_data->dispatch_table.CmdPushDescriptorSetWithTemplateKHR(commandBuffer, descriptorUpdateTemplate, layout, set, pData); |
| 6011 | } |
| 6012 | } |
| 6013 | |
| 6014 | // Definitions for the VK_KHX_device_group_creation extension |
| 6015 | |
| 6016 | VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceGroupsKHX( |
| 6017 | VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupPropertiesKHX *pPhysicalDeviceGroupProperties) { |
| 6018 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6019 | bool skip_call = false; |
| 6020 | auto my_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
| 6021 | assert(my_data != NULL); |
| 6022 | |
| 6023 | skip_call |= require_instance_extension(instance, &instance_extension_enables::khx_device_group_creation_enabled, |
| 6024 | "vkEnumeratePhysicalDeviceGroupsKHX", VK_KHX_DEVICE_GROUP_CREATION_EXTENSION_NAME); |
| 6025 | |
| 6026 | skip_call |= parameter_validation_vkEnumeratePhysicalDeviceGroupsKHX(my_data->report_data, pPhysicalDeviceGroupCount, |
| 6027 | pPhysicalDeviceGroupProperties); |
| 6028 | |
| 6029 | if (!skip_call) { |
| 6030 | result = my_data->dispatch_table.EnumeratePhysicalDeviceGroupsKHX(instance, pPhysicalDeviceGroupCount, |
| 6031 | pPhysicalDeviceGroupProperties); |
| 6032 | validate_result(my_data->report_data, "vkEnumeratePhysicalDeviceGroupsKHX", result); |
| 6033 | } |
| 6034 | return result; |
| 6035 | } |
| 6036 | |
| 6037 | // Definitions for the VK_KHX_device_group extension |
| 6038 | |
| 6039 | VKAPI_ATTR void VKAPI_CALL GetDeviceGroupPeerMemoryFeaturesKHX(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, |
| 6040 | uint32_t remoteDeviceIndex, |
| 6041 | VkPeerMemoryFeatureFlagsKHX *pPeerMemoryFeatures) { |
| 6042 | bool skip_call = false; |
| 6043 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6044 | assert(my_data != NULL); |
| 6045 | |
| 6046 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkGetDeviceGroupPeerMemoryFeaturesKHX", |
| 6047 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6048 | |
| 6049 | skip_call |= parameter_validation_vkGetDeviceGroupPeerMemoryFeaturesKHX(my_data->report_data, heapIndex, localDeviceIndex, |
| 6050 | remoteDeviceIndex, pPeerMemoryFeatures); |
| 6051 | |
| 6052 | if (!skip_call) { |
| 6053 | my_data->dispatch_table.GetDeviceGroupPeerMemoryFeaturesKHX(device, heapIndex, localDeviceIndex, remoteDeviceIndex, |
| 6054 | pPeerMemoryFeatures); |
| 6055 | } |
| 6056 | } |
| 6057 | |
| 6058 | VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory2KHX(VkDevice device, uint32_t bindInfoCount, |
| 6059 | const VkBindBufferMemoryInfoKHX *pBindInfos) { |
| 6060 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6061 | bool skip_call = false; |
| 6062 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6063 | assert(my_data != NULL); |
| 6064 | |
| 6065 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkBindBufferMemory2KHX", |
| 6066 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6067 | |
| 6068 | skip_call |= parameter_validation_vkBindBufferMemory2KHX(my_data->report_data, bindInfoCount, pBindInfos); |
| 6069 | |
| 6070 | if (!skip_call) { |
| 6071 | result = my_data->dispatch_table.BindBufferMemory2KHX(device, bindInfoCount, pBindInfos); |
| 6072 | validate_result(my_data->report_data, "vkBindBufferMemory2KHX", result); |
| 6073 | } |
| 6074 | |
| 6075 | return result; |
| 6076 | } |
| 6077 | |
| 6078 | VKAPI_ATTR VkResult VKAPI_CALL BindImageMemory2KHX(VkDevice device, uint32_t bindInfoCount, |
| 6079 | const VkBindImageMemoryInfoKHX *pBindInfos) { |
| 6080 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6081 | bool skip_call = false; |
| 6082 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6083 | assert(my_data != NULL); |
| 6084 | |
| 6085 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkBindImageMemory2KHX", |
| 6086 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6087 | |
| 6088 | skip_call |= parameter_validation_vkBindImageMemory2KHX(my_data->report_data, bindInfoCount, pBindInfos); |
| 6089 | |
| 6090 | if (!skip_call) { |
| 6091 | result = my_data->dispatch_table.BindImageMemory2KHX(device, bindInfoCount, pBindInfos); |
| 6092 | validate_result(my_data->report_data, "vkBindImageMemory2KHX", result); |
| 6093 | } |
| 6094 | |
| 6095 | return result; |
| 6096 | } |
| 6097 | |
| 6098 | VKAPI_ATTR void VKAPI_CALL CmdSetDeviceMaskKHX(VkCommandBuffer commandBuffer, uint32_t deviceMask) { |
| 6099 | bool skip_call = false; |
| 6100 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6101 | assert(my_data != NULL); |
| 6102 | |
| 6103 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkCmdSetDeviceMaskKHX", |
| 6104 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6105 | |
| 6106 | #if 0 // Validation not automatically generated |
| 6107 | skip_call |= parameter_validation_vkCmdSetDeviceMaskKHX(my_data->report_data, deviceMask); |
| 6108 | #endif |
| 6109 | |
| 6110 | if (!skip_call) { |
| 6111 | my_data->dispatch_table.CmdSetDeviceMaskKHX(commandBuffer, deviceMask); |
| 6112 | } |
| 6113 | } |
| 6114 | |
| 6115 | VKAPI_ATTR VkResult VKAPI_CALL |
| 6116 | GetDeviceGroupPresentCapabilitiesKHX(VkDevice device, VkDeviceGroupPresentCapabilitiesKHX *pDeviceGroupPresentCapabilities) { |
| 6117 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6118 | bool skip_call = false; |
| 6119 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6120 | assert(my_data != NULL); |
| 6121 | |
| 6122 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkGetDeviceGroupPresentCapabilitiesKHX", |
| 6123 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6124 | |
| 6125 | skip_call |= parameter_validation_vkGetDeviceGroupPresentCapabilitiesKHX(my_data->report_data, pDeviceGroupPresentCapabilities); |
| 6126 | |
| 6127 | if (!skip_call) { |
| 6128 | result = my_data->dispatch_table.GetDeviceGroupPresentCapabilitiesKHX(device, pDeviceGroupPresentCapabilities); |
| 6129 | validate_result(my_data->report_data, "vkGetDeviceGroupPresentCapabilitiesKHX", result); |
| 6130 | } |
| 6131 | |
| 6132 | return result; |
| 6133 | } |
| 6134 | |
| 6135 | VKAPI_ATTR VkResult VKAPI_CALL GetDeviceGroupSurfacePresentModesKHX(VkDevice device, VkSurfaceKHR surface, |
| 6136 | VkDeviceGroupPresentModeFlagsKHX *pModes) { |
| 6137 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6138 | bool skip_call = false; |
| 6139 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6140 | assert(my_data != NULL); |
| 6141 | |
| 6142 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkGetDeviceGroupSurfacePresentModesKHX", |
| 6143 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6144 | |
| 6145 | skip_call |= parameter_validation_vkGetDeviceGroupSurfacePresentModesKHX(my_data->report_data, surface, pModes); |
| 6146 | |
| 6147 | if (!skip_call) { |
| 6148 | result = my_data->dispatch_table.GetDeviceGroupSurfacePresentModesKHX(device, surface, pModes); |
| 6149 | validate_result(my_data->report_data, "vkGetDeviceGroupSurfacePresentModesKHX", result); |
| 6150 | } |
| 6151 | return result; |
| 6152 | } |
| 6153 | |
| 6154 | VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImage2KHX(VkDevice device, const VkAcquireNextImageInfoKHX *pAcquireInfo, |
| 6155 | uint32_t *pImageIndex) { |
| 6156 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6157 | bool skip_call = false; |
| 6158 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6159 | assert(my_data != NULL); |
| 6160 | |
| 6161 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkAcquireNextImage2KHX", |
| 6162 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6163 | |
| 6164 | skip_call |= parameter_validation_vkAcquireNextImage2KHX(my_data->report_data, pAcquireInfo, pImageIndex); |
| 6165 | |
| 6166 | if (!skip_call) { |
| 6167 | result = my_data->dispatch_table.AcquireNextImage2KHX(device, pAcquireInfo, pImageIndex); |
| 6168 | validate_result(my_data->report_data, "vkAcquireNextImage2KHX", result); |
| 6169 | } |
| 6170 | return result; |
| 6171 | } |
| 6172 | |
| 6173 | VKAPI_ATTR void VKAPI_CALL CmdDispatchBaseKHX(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, |
| 6174 | uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, |
| 6175 | uint32_t groupCountZ) { |
| 6176 | bool skip_call = false; |
| 6177 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6178 | assert(my_data != NULL); |
| 6179 | |
| 6180 | skip_call |= require_device_extension(my_data, my_data->enables.khx_device_group, "vkCmdDispatchBaseKHX", |
| 6181 | VK_KHX_DEVICE_GROUP_EXTENSION_NAME); |
| 6182 | |
| 6183 | #if 0 // Validation not automatically generated |
| 6184 | skip_call |= parameter_validation_vkCmdDispatchBaseKHX(my_data->report_data, baseGroupX, baseGroupY, baseGroupZ, |
| 6185 | groupCountX, groupCountY, groupCountZ); |
| 6186 | #endif |
| 6187 | |
| 6188 | if (!skip_call) { |
| 6189 | my_data->dispatch_table.CmdDispatchBaseKHX(commandBuffer, baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, |
| 6190 | groupCountZ); |
| 6191 | } |
| 6192 | } |
| 6193 | |
| 6194 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDevicePresentRectanglesKHX(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 6195 | uint32_t *pRectCount, VkRect2D *pRects) { |
| 6196 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6197 | bool skip = false; |
| 6198 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
| 6199 | assert(my_data != NULL); |
| 6200 | |
| 6201 | skip |= parameter_validation_vkGetPhysicalDevicePresentRectanglesKHX(my_data->report_data, surface, pRectCount, pRects); |
| 6202 | |
| 6203 | if (!skip) { |
| 6204 | result = my_data->dispatch_table.GetPhysicalDevicePresentRectanglesKHX(physicalDevice, surface, pRectCount, pRects); |
| 6205 | |
| 6206 | validate_result(my_data->report_data, "vkGetPhysicalDevicePresentRectanglesKHX", result); |
| 6207 | } |
| 6208 | |
| 6209 | return result; |
| 6210 | } |
| 6211 | |
| 6212 | // Definitions for the VK_KHX_external_memory_capabilities extension |
| 6213 | |
| 6214 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalBufferPropertiesKHX( |
| 6215 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfoKHX *pExternalBufferInfo, |
| 6216 | VkExternalBufferPropertiesKHX *pExternalBufferProperties) { |
| 6217 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
| 6218 | assert(my_data != NULL); |
| 6219 | bool skip = false; |
| 6220 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khx_external_memory_capabilities_enabled, |
| 6221 | "vkGetPhysicalDeviceExternalBufferPropertiesKHX", |
| 6222 | VK_KHX_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME); |
| 6223 | skip |= parameter_validation_vkGetPhysicalDeviceExternalBufferPropertiesKHX(my_data->report_data, pExternalBufferInfo, |
| 6224 | pExternalBufferProperties); |
| 6225 | if (!skip) { |
| 6226 | my_data->dispatch_table.GetPhysicalDeviceExternalBufferPropertiesKHX(physicalDevice, pExternalBufferInfo, |
| 6227 | pExternalBufferProperties); |
| 6228 | } |
| 6229 | } |
| 6230 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6231 | // Definitions for the VK_KHX_external_memory_fd extension |
| 6232 | |
| 6233 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdKHX(VkDevice device, VkDeviceMemory memory, |
| 6234 | VkExternalMemoryHandleTypeFlagBitsKHX handleType, int *pFd) { |
| 6235 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6236 | bool skip_call = false; |
| 6237 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6238 | assert(my_data != NULL); |
| 6239 | |
| 6240 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_memory_fd, "vkGetMemoryFdKHX", |
| 6241 | VK_KHX_EXTERNAL_MEMORY_FD_EXTENSION_NAME); |
| 6242 | |
| 6243 | skip_call |= parameter_validation_vkGetMemoryFdKHX(my_data->report_data, memory, handleType, pFd); |
| 6244 | |
| 6245 | if (!skip_call) { |
| 6246 | result = my_data->dispatch_table.GetMemoryFdKHX(device, memory, handleType, pFd); |
| 6247 | validate_result(my_data->report_data, "vkGetMemoryFdKHX", result); |
| 6248 | } |
| 6249 | |
| 6250 | return result; |
| 6251 | } |
| 6252 | |
| 6253 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdPropertiesKHX(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHX handleType, int fd, |
| 6254 | VkMemoryFdPropertiesKHX *pMemoryFdProperties) { |
| 6255 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6256 | bool skip_call = false; |
| 6257 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6258 | assert(my_data != NULL); |
| 6259 | |
| 6260 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_memory_fd, "vkGetMemoryFdPropertiesKHX", |
| 6261 | VK_KHX_EXTERNAL_MEMORY_FD_EXTENSION_NAME); |
| 6262 | |
| 6263 | skip_call |= parameter_validation_vkGetMemoryFdPropertiesKHX(my_data->report_data, handleType, fd, pMemoryFdProperties); |
| 6264 | |
| 6265 | if (!skip_call) { |
| 6266 | result = my_data->dispatch_table.GetMemoryFdPropertiesKHX(device, handleType, fd, pMemoryFdProperties); |
| 6267 | validate_result(my_data->report_data, "vkGetMemoryFdPropertiesKHX", result); |
| 6268 | } |
| 6269 | |
| 6270 | return result; |
| 6271 | } |
| 6272 | |
| 6273 | // Definitions for the VK_KHX_external_memory_win32 extension |
| 6274 | |
| 6275 | #ifdef VK_USE_PLATFORM_WIN32_KHX |
| 6276 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleKHX(VkDevice device, VkDeviceMemory memory, |
| 6277 | VkExternalMemoryHandleTypeFlagBitsKHX handleType, HANDLE *pHandle) { |
| 6278 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6279 | bool skip_call = false; |
| 6280 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6281 | assert(my_data != NULL); |
| 6282 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_memory_win32, "vkGetMemoryWin32HandleKHX", |
| 6283 | VK_KHX_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME); |
| 6284 | |
| 6285 | skip_call |= parameter_validation_vkGetMemoryWin32HandleKHX(my_data->report_data, memory, handleType, pHandle); |
| 6286 | |
| 6287 | if (!skip_call) { |
| 6288 | result = my_data->dispatch_table.GetMemoryWin32HandleKHX(device, memory, handleType, pHandle); |
| 6289 | validate_result(my_data->report_data, "vkGetMemoryWin32HandleKHX", result); |
| 6290 | } |
| 6291 | return result; |
| 6292 | } |
| 6293 | |
| 6294 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandlePropertiesKHX(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHX handleType, |
| 6295 | HANDLE handle, |
| 6296 | VkMemoryWin32HandlePropertiesKHX *pMemoryWin32HandleProperties) { |
| 6297 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6298 | bool skip_call = false; |
| 6299 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6300 | assert(my_data != NULL); |
| 6301 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_memory_win32, |
| 6302 | "vkGetMemoryWin32HandlePropertiesKHX", VK_KHX_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME); |
| 6303 | |
| 6304 | skip_call |= parameter_validation_vkGetMemoryWin32HandlePropertiesKHX(my_data->report_data, handleType, handle, |
| 6305 | pMemoryWin32HandleProperties); |
| 6306 | |
| 6307 | if (!skip_call) { |
| 6308 | result = |
| 6309 | my_data->dispatch_table.GetMemoryWin32HandlePropertiesKHX(device, handleType, handle, pMemoryWin32HandleProperties); |
| 6310 | validate_result(my_data->report_data, "vkGetMemoryWin32HandlePropertiesKHX", result); |
| 6311 | } |
| 6312 | return result; |
| 6313 | } |
| 6314 | #endif // VK_USE_PLATFORM_WIN32_KHX |
| 6315 | |
| 6316 | // Definitions for the VK_KHX_external_semaphore_capabilities extension |
| 6317 | |
| 6318 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalSemaphorePropertiesKHX( |
| 6319 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHX *pExternalSemaphoreInfo, |
| 6320 | VkExternalSemaphorePropertiesKHX *pExternalSemaphoreProperties) { |
| 6321 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
| 6322 | assert(my_data != NULL); |
| 6323 | bool skip = false; |
| 6324 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::khx_external_memory_capabilities_enabled, |
| 6325 | "vkGetPhysicalDeviceExternalSemaphorePropertiesKHX", |
| 6326 | VK_KHX_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME); |
| 6327 | skip |= parameter_validation_vkGetPhysicalDeviceExternalSemaphorePropertiesKHX(my_data->report_data, pExternalSemaphoreInfo, |
| 6328 | pExternalSemaphoreProperties); |
| 6329 | if (!skip) { |
| 6330 | my_data->dispatch_table.GetPhysicalDeviceExternalSemaphorePropertiesKHX(physicalDevice, pExternalSemaphoreInfo, |
| 6331 | pExternalSemaphoreProperties); |
| 6332 | } |
| 6333 | } |
| 6334 | |
| 6335 | // Definitions for the VK_KHX_external_semaphore_fd extension |
| 6336 | |
| 6337 | VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreFdKHX(VkDevice device, const VkImportSemaphoreFdInfoKHX *pImportSemaphoreFdInfo) { |
| 6338 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6339 | bool skip_call = false; |
| 6340 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6341 | assert(my_data != NULL); |
| 6342 | |
| 6343 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_semaphore_fd, "vkImportSemaphoreFdKHX", |
| 6344 | VK_KHX_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME); |
| 6345 | |
| 6346 | skip_call |= parameter_validation_vkImportSemaphoreFdKHX(my_data->report_data, pImportSemaphoreFdInfo); |
| 6347 | |
| 6348 | if (!skip_call) { |
| 6349 | result = my_data->dispatch_table.ImportSemaphoreFdKHX(device, pImportSemaphoreFdInfo); |
| 6350 | validate_result(my_data->report_data, "vkImportSemaphoreFdKHX", result); |
| 6351 | } |
| 6352 | |
| 6353 | return result; |
| 6354 | } |
| 6355 | |
| 6356 | VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreFdKHX(VkDevice device, VkSemaphore semaphore, |
| 6357 | VkExternalSemaphoreHandleTypeFlagBitsKHX handleType, int *pFd) { |
| 6358 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6359 | bool skip_call = false; |
| 6360 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6361 | assert(my_data != NULL); |
| 6362 | |
| 6363 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_semaphore_fd, "vkGetSemaphoreFdKHX", |
| 6364 | VK_KHX_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME); |
| 6365 | |
| 6366 | skip_call |= parameter_validation_vkGetSemaphoreFdKHX(my_data->report_data, semaphore, handleType, pFd); |
| 6367 | |
| 6368 | if (!skip_call) { |
| 6369 | result = my_data->dispatch_table.GetSemaphoreFdKHX(device, semaphore, handleType, pFd); |
| 6370 | validate_result(my_data->report_data, "vkGetSemaphoreFdKHX", result); |
| 6371 | } |
| 6372 | |
| 6373 | return result; |
| 6374 | } |
| 6375 | |
| 6376 | // Definitions for the VK_KHX_external_semaphore_win32 extension |
| 6377 | |
| 6378 | #ifdef VK_USE_PLATFORM_WIN32_KHX |
| 6379 | VKAPI_ATTR VkResult VKAPI_CALL |
| 6380 | ImportSemaphoreWin32HandleKHX(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHX *pImportSemaphoreWin32HandleInfo) { |
| 6381 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6382 | bool skip_call = false; |
| 6383 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6384 | assert(my_data != NULL); |
| 6385 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_semaphore_win32, "vkImportSemaphoreWin32HandleKHX", |
| 6386 | VK_KHX_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME); |
| 6387 | |
| 6388 | skip_call |= parameter_validation_vkImportSemaphoreWin32HandleKHX(my_data->report_data, pImportSemaphoreWin32HandleInfo); |
| 6389 | if (!skip_call) { |
| 6390 | result = my_data->dispatch_table.ImportSemaphoreWin32HandleKHX(device, pImportSemaphoreWin32HandleInfo); |
| 6391 | validate_result(my_data->report_data, "vkImportSemaphoreWin32HandleKHX", result); |
| 6392 | } |
| 6393 | return result; |
| 6394 | } |
| 6395 | |
| 6396 | VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreWin32HandleKHX(VkDevice device, VkSemaphore semaphore, |
| 6397 | VkExternalSemaphoreHandleTypeFlagBitsKHX handleType, HANDLE *pHandle) { |
| 6398 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6399 | bool skip_call = false; |
| 6400 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6401 | assert(my_data != NULL); |
| 6402 | skip_call |= require_device_extension(my_data, my_data->enables.khx_external_semaphore_win32, "vkGetSemaphoreWin32HandleKHX", |
| 6403 | VK_KHX_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME); |
| 6404 | skip_call |= parameter_validation_vkGetSemaphoreWin32HandleKHX(my_data->report_data, semaphore, handleType, pHandle); |
| 6405 | if (!skip_call) { |
| 6406 | result = my_data->dispatch_table.GetSemaphoreWin32HandleKHX(device, semaphore, handleType, pHandle); |
| 6407 | validate_result(my_data->report_data, "vkGetSemaphoreWin32HandleKHX", result); |
| 6408 | } |
| 6409 | return result; |
| 6410 | } |
| 6411 | #endif // VK_USE_PLATFORM_WIN32_KHX |
| 6412 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6413 | // Definitions for the VK_EXT_acquire_xlib_display extension |
| 6414 | |
| 6415 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT |
| 6416 | VKAPI_ATTR VkResult VKAPI_CALL AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, VkDisplayKHR display) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6417 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6418 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6419 | assert(my_data != NULL); |
| 6420 | bool skip = false; |
| 6421 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::ext_acquire_xlib_display_enabled, |
| 6422 | "vkAcquireXlibDisplayEXT", VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME); |
| 6423 | skip |= parameter_validation_vkAcquireXlibDisplayEXT(my_data->report_data, dpy, display); |
| 6424 | if (!skip) { |
| 6425 | result = my_data->dispatch_table.AcquireXlibDisplayEXT(physicalDevice, dpy, display); |
| 6426 | validate_result(my_data->report_data, "vkAcquireXlibDisplayEXT", result); |
| 6427 | } |
| 6428 | return result; |
| 6429 | } |
| 6430 | |
| 6431 | VKAPI_ATTR VkResult VKAPI_CALL GetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, RROutput rrOutput, |
| 6432 | VkDisplayKHR *pDisplay) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6433 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6434 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6435 | assert(my_data != NULL); |
| 6436 | bool skip = false; |
| 6437 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::ext_acquire_xlib_display_enabled, |
| 6438 | "vkGetRandROutputDisplayEXT", VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME); |
| 6439 | skip |= parameter_validation_vkGetRandROutputDisplayEXT(my_data->report_data, dpy, rrOutput, pDisplay); |
| 6440 | if (!skip) { |
| 6441 | result = my_data->dispatch_table.GetRandROutputDisplayEXT(physicalDevice, dpy, rrOutput, pDisplay); |
| 6442 | validate_result(my_data->report_data, "vkGetRandROutputDisplayEXT", result); |
| 6443 | } |
| 6444 | return result; |
| 6445 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 6446 | #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6447 | |
| 6448 | // Definitions for the VK_EXT_debug_marker Extension |
| 6449 | |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6450 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT(VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { |
| 6451 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6452 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6453 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6454 | assert(my_data != NULL); |
| 6455 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6456 | skip |= require_device_extension(my_data, my_data->enables.ext_debug_marker, "vkDebugMarkerSetObjectTagEXT", |
| 6457 | VK_EXT_DEBUG_MARKER_EXTENSION_NAME); |
| 6458 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6459 | skip |= parameter_validation_vkDebugMarkerSetObjectTagEXT(my_data->report_data, pTagInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6460 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6461 | if (!skip) { |
Tobin Ehlis | 8ad4193 | 2016-12-01 09:37:56 -0700 | [diff] [blame] | 6462 | if (my_data->dispatch_table.DebugMarkerSetObjectTagEXT) { |
| 6463 | result = my_data->dispatch_table.DebugMarkerSetObjectTagEXT(device, pTagInfo); |
| 6464 | validate_result(my_data->report_data, "vkDebugMarkerSetObjectTagEXT", result); |
| 6465 | } else { |
| 6466 | result = VK_SUCCESS; |
| 6467 | } |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6468 | } |
| 6469 | |
| 6470 | return result; |
| 6471 | } |
| 6472 | |
| 6473 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT(VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { |
| 6474 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6475 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6476 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6477 | assert(my_data != NULL); |
| 6478 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6479 | skip |= require_device_extension(my_data, my_data->enables.ext_debug_marker, "vkDebugMarkerSetObjectNameEXT", |
| 6480 | VK_EXT_DEBUG_MARKER_EXTENSION_NAME); |
| 6481 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6482 | skip |= parameter_validation_vkDebugMarkerSetObjectNameEXT(my_data->report_data, pNameInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6483 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6484 | if (!skip) { |
Tobin Ehlis | 8ad4193 | 2016-12-01 09:37:56 -0700 | [diff] [blame] | 6485 | if (my_data->dispatch_table.DebugMarkerSetObjectNameEXT) { |
| 6486 | result = my_data->dispatch_table.DebugMarkerSetObjectNameEXT(device, pNameInfo); |
| 6487 | validate_result(my_data->report_data, "vkDebugMarkerSetObjectNameEXT", result); |
| 6488 | } else { |
| 6489 | result = VK_SUCCESS; |
| 6490 | } |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6491 | } |
| 6492 | |
| 6493 | return result; |
| 6494 | } |
| 6495 | |
| 6496 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6497 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6498 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6499 | assert(my_data != NULL); |
| 6500 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6501 | skip |= require_device_extension(my_data, my_data->enables.ext_debug_marker, "vkCmdDebugMarkerBeginEXT", |
| 6502 | VK_EXT_DEBUG_MARKER_EXTENSION_NAME); |
| 6503 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6504 | skip |= parameter_validation_vkCmdDebugMarkerBeginEXT(my_data->report_data, pMarkerInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6505 | |
Tobin Ehlis | 8ad4193 | 2016-12-01 09:37:56 -0700 | [diff] [blame] | 6506 | if (!skip && my_data->dispatch_table.CmdDebugMarkerBeginEXT) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 6507 | my_data->dispatch_table.CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6508 | } |
| 6509 | } |
| 6510 | |
| 6511 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6512 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6513 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6514 | assert(my_data != NULL); |
| 6515 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6516 | skip |= require_device_extension(my_data, my_data->enables.ext_debug_marker, "vkCmdDebugMarkerInsertEXT", |
| 6517 | VK_EXT_DEBUG_MARKER_EXTENSION_NAME); |
| 6518 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6519 | skip |= parameter_validation_vkCmdDebugMarkerInsertEXT(my_data->report_data, pMarkerInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6520 | |
Tobin Ehlis | 8ad4193 | 2016-12-01 09:37:56 -0700 | [diff] [blame] | 6521 | if (!skip && my_data->dispatch_table.CmdDebugMarkerInsertEXT) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 6522 | my_data->dispatch_table.CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo); |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6523 | } |
| 6524 | } |
| 6525 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6526 | // Definitions for the VK_EXT_direct_mode_display extension |
| 6527 | |
| 6528 | VKAPI_ATTR VkResult VKAPI_CALL ReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6529 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6530 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6531 | assert(my_data != NULL); |
| 6532 | bool skip = false; |
| 6533 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::ext_direct_mode_display_enabled, |
| 6534 | "vkReleaseDisplayEXT", VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 6535 | #if 0 // Validation not automatically generated |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6536 | skip |= parameter_validation_vkReleaseDisplayEXT(my_data->report_data, display); |
| 6537 | #endif |
| 6538 | if (!skip) { |
| 6539 | result = my_data->dispatch_table.ReleaseDisplayEXT(physicalDevice, display); |
| 6540 | validate_result(my_data->report_data, "vkGetRandROutputDisplayEXT", result); |
| 6541 | } |
| 6542 | return result; |
| 6543 | } |
| 6544 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6545 | // Definitions for the VK_EXT_discard_rectangles extension |
| 6546 | |
| 6547 | VKAPI_ATTR void VKAPI_CALL CmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, |
| 6548 | uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles) { |
| 6549 | bool skip = false; |
| 6550 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6551 | assert(my_data != NULL); |
| 6552 | |
| 6553 | skip |= require_device_extension(my_data, my_data->enables.ext_discard_rectangles, "vkCmdSetDiscardRectangleEXT", |
| 6554 | VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME); |
| 6555 | |
| 6556 | skip |= parameter_validation_vkCmdSetDiscardRectangleEXT(my_data->report_data, firstDiscardRectangle, |
| 6557 | discardRectangleCount, pDiscardRectangles); |
| 6558 | |
| 6559 | if (!skip && my_data->dispatch_table.CmdSetDiscardRectangleEXT) { |
| 6560 | my_data->dispatch_table.CmdSetDiscardRectangleEXT(commandBuffer, firstDiscardRectangle, discardRectangleCount, |
| 6561 | pDiscardRectangles); |
| 6562 | } |
| 6563 | } |
| 6564 | |
| 6565 | // Definitions for the VK_EXT_display_control extension |
| 6566 | |
| 6567 | VKAPI_ATTR VkResult VKAPI_CALL DisplayPowerControlEXT(VkDevice device, VkDisplayKHR display, |
| 6568 | const VkDisplayPowerInfoEXT *pDisplayPowerInfo) { |
| 6569 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6570 | bool skip = false; |
| 6571 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6572 | assert(my_data != NULL); |
| 6573 | |
| 6574 | skip |= require_device_extension(my_data, my_data->enables.ext_display_control, "vkDisplayPowerControlEXT", |
| 6575 | VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME); |
| 6576 | |
| 6577 | skip |= parameter_validation_vkDisplayPowerControlEXT(my_data->report_data, display, pDisplayPowerInfo); |
| 6578 | |
| 6579 | if (!skip) { |
| 6580 | if (my_data->dispatch_table.DisplayPowerControlEXT) { |
| 6581 | result = my_data->dispatch_table.DisplayPowerControlEXT(device, display, pDisplayPowerInfo); |
| 6582 | validate_result(my_data->report_data, "vkDisplayPowerControlEXT", result); |
| 6583 | } else { |
| 6584 | result = VK_SUCCESS; |
| 6585 | } |
| 6586 | } |
| 6587 | |
| 6588 | return result; |
| 6589 | } |
| 6590 | |
| 6591 | VKAPI_ATTR VkResult VKAPI_CALL RegisterDeviceEventEXT(VkDevice device, const VkDeviceEventInfoEXT *pDeviceEventInfo, |
| 6592 | const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
| 6593 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6594 | bool skip = false; |
| 6595 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6596 | assert(my_data != NULL); |
| 6597 | |
| 6598 | skip |= require_device_extension(my_data, my_data->enables.ext_display_control, "vkRegisterDeviceEventEXT", |
| 6599 | VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME); |
| 6600 | |
| 6601 | skip |= parameter_validation_vkRegisterDeviceEventEXT(my_data->report_data, pDeviceEventInfo, pAllocator, pFence); |
| 6602 | |
| 6603 | if (!skip) { |
| 6604 | if (my_data->dispatch_table.RegisterDeviceEventEXT) { |
| 6605 | result = my_data->dispatch_table.RegisterDeviceEventEXT(device, pDeviceEventInfo, pAllocator, pFence); |
| 6606 | validate_result(my_data->report_data, "vkRegisterDeviceEventEXT", result); |
| 6607 | } else { |
| 6608 | result = VK_SUCCESS; |
| 6609 | } |
| 6610 | } |
| 6611 | |
| 6612 | return result; |
| 6613 | } |
| 6614 | |
| 6615 | VKAPI_ATTR VkResult VKAPI_CALL RegisterDisplayEventEXT(VkDevice device, VkDisplayKHR display, |
| 6616 | const VkDisplayEventInfoEXT *pDisplayEventInfo, |
| 6617 | const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
| 6618 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6619 | bool skip = false; |
| 6620 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6621 | assert(my_data != NULL); |
| 6622 | |
| 6623 | skip |= require_device_extension(my_data, my_data->enables.ext_display_control, "vkRegisterDisplayEventEXT", |
| 6624 | VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME); |
| 6625 | |
| 6626 | skip |= parameter_validation_vkRegisterDisplayEventEXT(my_data->report_data, display, pDisplayEventInfo, pAllocator, pFence); |
| 6627 | |
| 6628 | if (!skip) { |
| 6629 | if (my_data->dispatch_table.RegisterDisplayEventEXT) { |
| 6630 | result = my_data->dispatch_table.RegisterDisplayEventEXT(device, display, pDisplayEventInfo, pAllocator, pFence); |
| 6631 | validate_result(my_data->report_data, "vkRegisterDisplayEventEXT", result); |
| 6632 | } else { |
| 6633 | result = VK_SUCCESS; |
| 6634 | } |
| 6635 | } |
| 6636 | |
| 6637 | return result; |
| 6638 | } |
| 6639 | |
| 6640 | VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainCounterEXT(VkDevice device, VkSwapchainKHR swapchain, |
| 6641 | VkSurfaceCounterFlagBitsEXT counter, uint64_t *pCounterValue) { |
| 6642 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6643 | bool skip = false; |
| 6644 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6645 | assert(my_data != NULL); |
| 6646 | |
| 6647 | skip |= require_device_extension(my_data, my_data->enables.ext_display_control, "vkGetSwapchainCounterEXT", |
| 6648 | VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME); |
| 6649 | |
| 6650 | skip |= parameter_validation_vkGetSwapchainCounterEXT(my_data->report_data, swapchain, counter, pCounterValue); |
| 6651 | |
| 6652 | if (!skip) { |
| 6653 | if (my_data->dispatch_table.GetSwapchainCounterEXT) { |
| 6654 | result = my_data->dispatch_table.GetSwapchainCounterEXT(device, swapchain, counter, pCounterValue); |
| 6655 | validate_result(my_data->report_data, "vkGetSwapchainCounterEXT", result); |
| 6656 | } else { |
| 6657 | result = VK_SUCCESS; |
| 6658 | } |
| 6659 | } |
| 6660 | |
| 6661 | return result; |
| 6662 | } |
| 6663 | |
| 6664 | // Definitions for the VK_AMD_draw_indirect_count extension |
| 6665 | |
| 6666 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 6667 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, |
| 6668 | uint32_t stride) { |
| 6669 | bool skip = false; |
| 6670 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6671 | assert(my_data != NULL); |
| 6672 | skip |= require_device_extension(my_data, my_data->enables.amd_draw_indirect_count, "vkCmdDrawIndirectCountAMD", |
| 6673 | VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME); |
| 6674 | skip |= parameter_validation_vkCmdDrawIndirectCountAMD(my_data->report_data, buffer, offset, countBuffer, countBufferOffset, |
| 6675 | maxDrawCount, stride); |
| 6676 | if (!skip) { |
| 6677 | my_data->dispatch_table.CmdDrawIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, |
| 6678 | stride); |
| 6679 | } |
| 6680 | } |
| 6681 | |
| 6682 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 6683 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, |
| 6684 | uint32_t maxDrawCount, uint32_t stride) { |
| 6685 | bool skip = false; |
| 6686 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6687 | assert(my_data != NULL); |
| 6688 | skip |= require_device_extension(my_data, my_data->enables.amd_draw_indirect_count, "vkCmdDrawIndexedIndirectCountAMD", |
| 6689 | VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME); |
| 6690 | skip |= parameter_validation_vkCmdDrawIndexedIndirectCountAMD(my_data->report_data, buffer, offset, countBuffer, |
| 6691 | countBufferOffset, maxDrawCount, stride); |
| 6692 | if (!skip) { |
| 6693 | my_data->dispatch_table.CmdDrawIndexedIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, |
| 6694 | maxDrawCount, stride); |
| 6695 | } |
| 6696 | } |
| 6697 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6698 | // Definitions for the VK_EXT_display_surface_counter extension |
| 6699 | |
| 6700 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 6701 | VkSurfaceCapabilities2EXT *pSurfaceCapabilities) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6702 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6703 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6704 | assert(my_data != NULL); |
| 6705 | bool skip = false; |
| 6706 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::ext_display_surface_counter_enabled, |
| 6707 | "vkGetPhysicalDeviceSurfaceCapabilities2EXT", VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME); |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 6708 | skip |= parameter_validation_vkGetPhysicalDeviceSurfaceCapabilities2EXT(my_data->report_data, surface, pSurfaceCapabilities); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6709 | if (!skip) { |
| 6710 | result = my_data->dispatch_table.GetPhysicalDeviceSurfaceCapabilities2EXT(physicalDevice, surface, pSurfaceCapabilities); |
| 6711 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceCapabilities2EXT", result); |
| 6712 | } |
| 6713 | return result; |
| 6714 | } |
| 6715 | |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6716 | // Definitions for the VK_NV_clip_space_w_scaling Extension |
| 6717 | |
| 6718 | VKAPI_ATTR void VKAPI_CALL CmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
| 6719 | const VkViewportWScalingNV *pViewportWScalings) { |
| 6720 | bool skip = false; |
| 6721 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6722 | assert(my_data != NULL); |
| 6723 | skip |= require_device_extension(my_data, my_data->enables.amd_draw_indirect_count, "vkCmdSetViewportWScalingNV", |
| 6724 | VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME); |
| 6725 | #if 0 // Validation not automatically generated |
| 6726 | skip |= parameter_validation_vkCmdSetViewportWScalingNV(my_data->report_data, firstViewport, viewportCount, pViewportWScalings); |
| 6727 | #endif |
| 6728 | if (!skip) { |
| 6729 | my_data->dispatch_table.CmdSetViewportWScalingNV(commandBuffer, firstViewport, viewportCount, pViewportWScalings); |
| 6730 | } |
| 6731 | } |
| 6732 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6733 | // Definitions for the VK_NV_external_memory_capabilities Extension |
| 6734 | |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6735 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceExternalImageFormatPropertiesNV( |
| 6736 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, |
| 6737 | VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, |
| 6738 | VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) { |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6739 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6740 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6741 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6742 | assert(my_data != NULL); |
| 6743 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6744 | skip |= require_instance_extension(physicalDevice, &instance_extension_enables::nv_external_memory_capabilities_enabled, |
| 6745 | "vkGetPhysicalDeviceExternalImageFormatPropertiesNV", |
| 6746 | VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME); |
| 6747 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6748 | skip |= parameter_validation_vkGetPhysicalDeviceExternalImageFormatPropertiesNV( |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6749 | my_data->report_data, format, type, tiling, usage, flags, externalHandleType, pExternalImageFormatProperties); |
| 6750 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6751 | if (!skip) { |
Chris Forbes | 6444bba | 2016-11-24 14:15:23 +1300 | [diff] [blame] | 6752 | result = my_data->dispatch_table.GetPhysicalDeviceExternalImageFormatPropertiesNV( |
| 6753 | physicalDevice, format, type, tiling, usage, flags, externalHandleType, pExternalImageFormatProperties); |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6754 | |
| 6755 | validate_result(my_data->report_data, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV", result); |
| 6756 | } |
| 6757 | |
| 6758 | return result; |
| 6759 | } |
| 6760 | |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6761 | // VK_NV_external_memory_win32 Extension |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6762 | |
| 6763 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6764 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleNV(VkDevice device, VkDeviceMemory memory, |
| 6765 | VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE *pHandle) { |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6766 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6767 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6768 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6769 | assert(my_data != NULL); |
| 6770 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6771 | skip |= require_device_extension(my_data, my_data->enables.nv_external_memory_win32, "vkGetMemoryWin32HandleNV", |
| 6772 | VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME); |
| 6773 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6774 | skip |= parameter_validation_vkGetMemoryWin32HandleNV(my_data->report_data, memory, handleType, pHandle); |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6775 | |
Chris Forbes | 04b61da | 2016-11-03 09:53:59 +1300 | [diff] [blame] | 6776 | if (!skip) { |
Chris Forbes | e58c9fe | 2016-11-24 14:44:17 +1300 | [diff] [blame] | 6777 | result = my_data->dispatch_table.GetMemoryWin32HandleNV(device, memory, handleType, pHandle); |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 6778 | } |
| 6779 | |
| 6780 | return result; |
| 6781 | } |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 6782 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6783 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6784 | // VK_NVX_device_generated_commands Extension |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 6785 | |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6786 | VKAPI_ATTR void VKAPI_CALL CmdProcessCommandsNVX(VkCommandBuffer commandBuffer, |
| 6787 | const VkCmdProcessCommandsInfoNVX *pProcessCommandsInfo) { |
| 6788 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6789 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6790 | assert(my_data != NULL); |
| 6791 | 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] | 6792 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6793 | skip |= parameter_validation_vkCmdProcessCommandsNVX(my_data->report_data, pProcessCommandsInfo); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6794 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6795 | my_data->dispatch_table.CmdProcessCommandsNVX(commandBuffer, pProcessCommandsInfo); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6796 | } |
| 6797 | } |
| 6798 | |
| 6799 | VKAPI_ATTR void VKAPI_CALL CmdReserveSpaceForCommandsNVX(VkCommandBuffer commandBuffer, |
| 6800 | const VkCmdReserveSpaceForCommandsInfoNVX *pReserveSpaceInfo) { |
| 6801 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6802 | auto my_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6803 | assert(my_data != NULL); |
| 6804 | skip |= require_device_extension(my_data, my_data->enables.nvx_device_generated_commands, "vkCmdReserveSpaceForCommandsNVX", |
| 6805 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
| 6806 | skip |= parameter_validation_vkCmdReserveSpaceForCommandsNVX(my_data->report_data, pReserveSpaceInfo); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6807 | if (!skip) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6808 | my_data->dispatch_table.CmdReserveSpaceForCommandsNVX(commandBuffer, pReserveSpaceInfo); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6809 | } |
| 6810 | } |
| 6811 | |
| 6812 | VKAPI_ATTR VkResult VKAPI_CALL CreateIndirectCommandsLayoutNVX(VkDevice device, |
| 6813 | const VkIndirectCommandsLayoutCreateInfoNVX *pCreateInfo, |
| 6814 | const VkAllocationCallbacks *pAllocator, |
| 6815 | VkIndirectCommandsLayoutNVX *pIndirectCommandsLayout) { |
| 6816 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6817 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6818 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6819 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6820 | skip |= require_device_extension(my_data, my_data->enables.nvx_device_generated_commands, "vkCreateIndirectCommandsLayoutNVX", |
| 6821 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6822 | skip |= parameter_validation_vkCreateIndirectCommandsLayoutNVX(my_data->report_data, pCreateInfo, pAllocator, |
| 6823 | pIndirectCommandsLayout); |
| 6824 | if (!skip) { |
| 6825 | result = my_data->dispatch_table.CreateIndirectCommandsLayoutNVX(device, pCreateInfo, pAllocator, pIndirectCommandsLayout); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6826 | validate_result(my_data->report_data, "vkCreateIndirectCommandsLayoutNVX", result); |
| 6827 | } |
| 6828 | return result; |
| 6829 | } |
| 6830 | |
| 6831 | VKAPI_ATTR void VKAPI_CALL DestroyIndirectCommandsLayoutNVX(VkDevice device, VkIndirectCommandsLayoutNVX indirectCommandsLayout, |
| 6832 | const VkAllocationCallbacks *pAllocator) { |
| 6833 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6834 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6835 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6836 | skip |= require_device_extension(my_data, my_data->enables.nvx_device_generated_commands, "vkDestroyIndirectCommandsLayoutNVX", |
| 6837 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 6838 | #if 0 // Validation not automatically generated |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6839 | skip |= parameter_validation_vkDestroyIndirectCommandsLayoutNVX(my_data->report_data, indirectCommandsLayout, pAllocator); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6840 | #endif |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6841 | if (!skip) { |
| 6842 | my_data->dispatch_table.DestroyIndirectCommandsLayoutNVX(device, indirectCommandsLayout, pAllocator); |
| 6843 | } |
| 6844 | } |
| 6845 | |
| 6846 | VKAPI_ATTR VkResult VKAPI_CALL CreateObjectTableNVX(VkDevice device, const VkObjectTableCreateInfoNVX *pCreateInfo, |
| 6847 | const VkAllocationCallbacks *pAllocator, VkObjectTableNVX *pObjectTable) { |
| 6848 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6849 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6850 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6851 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6852 | 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] | 6853 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
| 6854 | skip |= parameter_validation_vkCreateObjectTableNVX(my_data->report_data, pCreateInfo, pAllocator, pObjectTable); |
| 6855 | if (!skip) { |
| 6856 | result = my_data->dispatch_table.CreateObjectTableNVX(device, pCreateInfo, pAllocator, pObjectTable); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6857 | validate_result(my_data->report_data, "vkCreateObjectTableNVX", result); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6858 | } |
| 6859 | return result; |
| 6860 | } |
| 6861 | |
| 6862 | VKAPI_ATTR void VKAPI_CALL DestroyObjectTableNVX(VkDevice device, VkObjectTableNVX objectTable, |
| 6863 | const VkAllocationCallbacks *pAllocator) { |
| 6864 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6865 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6866 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6867 | 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] | 6868 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 6869 | #if 0 // Validation not automatically generated |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6870 | skip |= parameter_validation_vkDestroyObjectTableNVX(my_data->report_data, objectTable, pAllocator); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6871 | #endif |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6872 | if (!skip) { |
| 6873 | my_data->dispatch_table.DestroyObjectTableNVX(device, objectTable, pAllocator); |
| 6874 | } |
| 6875 | } |
| 6876 | |
| 6877 | VKAPI_ATTR VkResult VKAPI_CALL RegisterObjectsNVX(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, |
| 6878 | const VkObjectTableEntryNVX *const *ppObjectTableEntries, |
| 6879 | const uint32_t *pObjectIndices) { |
| 6880 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6881 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6882 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6883 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6884 | 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] | 6885 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
| 6886 | skip |= parameter_validation_vkRegisterObjectsNVX(my_data->report_data, objectTable, objectCount, ppObjectTableEntries, |
| 6887 | pObjectIndices); |
| 6888 | if (!skip) { |
| 6889 | result = my_data->dispatch_table.RegisterObjectsNVX(device, objectTable, objectCount, ppObjectTableEntries, pObjectIndices); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6890 | validate_result(my_data->report_data, "vkRegisterObjectsNVX", result); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6891 | } |
| 6892 | return result; |
| 6893 | } |
| 6894 | |
| 6895 | VKAPI_ATTR VkResult VKAPI_CALL UnregisterObjectsNVX(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, |
| 6896 | const VkObjectEntryTypeNVX *pObjectEntryTypes, const uint32_t *pObjectIndices) { |
| 6897 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6898 | bool skip = false; |
Mark Young | 0f183a8 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 6899 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6900 | assert(my_data != NULL); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6901 | 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] | 6902 | VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME); |
| 6903 | skip |= parameter_validation_vkUnregisterObjectsNVX(my_data->report_data, objectTable, objectCount, pObjectEntryTypes, |
| 6904 | pObjectIndices); |
| 6905 | if (!skip) { |
| 6906 | result = my_data->dispatch_table.UnregisterObjectsNVX(device, objectTable, objectCount, pObjectEntryTypes, pObjectIndices); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6907 | validate_result(my_data->report_data, "vkUnregisterObjectsNVX", result); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6908 | } |
| 6909 | return result; |
| 6910 | } |
| 6911 | |
| 6912 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceGeneratedCommandsPropertiesNVX(VkPhysicalDevice physicalDevice, |
| 6913 | VkDeviceGeneratedCommandsFeaturesNVX *pFeatures, |
| 6914 | VkDeviceGeneratedCommandsLimitsNVX *pLimits) { |
| 6915 | bool skip = false; |
Tobin Ehlis | 8d6acde | 2017-02-08 07:40:40 -0700 | [diff] [blame] | 6916 | auto my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6917 | assert(my_data != NULL); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6918 | skip |= parameter_validation_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX(my_data->report_data, pFeatures, pLimits); |
Mark Young | fa55278 | 2016-12-12 16:14:55 -0700 | [diff] [blame] | 6919 | if (!skip) { |
| 6920 | my_data->dispatch_table.GetPhysicalDeviceGeneratedCommandsPropertiesNVX(physicalDevice, pFeatures, pLimits); |
| 6921 | } |
| 6922 | } |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 6923 | |
Mark Lobodzinski | 1d218cc | 2017-03-14 10:12:43 -0600 | [diff] [blame] | 6924 | VKAPI_ATTR VkResult VKAPI_CALL GetPastPresentationTimingGOOGLE(VkDevice device, VkSwapchainKHR swapchain, |
| 6925 | uint32_t *pPresentationTimingCount, |
| 6926 | VkPastPresentationTimingGOOGLE *pPresentationTimings) { |
| 6927 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6928 | bool skip = false; |
| 6929 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6930 | assert(my_data != NULL); |
| 6931 | skip |= parameter_validation_vkGetPastPresentationTimingGOOGLE(my_data->report_data, swapchain, pPresentationTimingCount, |
| 6932 | pPresentationTimings); |
| 6933 | if (!skip) { |
| 6934 | result = my_data->dispatch_table.GetPastPresentationTimingGOOGLE(device, swapchain, pPresentationTimingCount, |
| 6935 | pPresentationTimings); |
| 6936 | } |
| 6937 | return result; |
| 6938 | } |
| 6939 | |
| 6940 | VKAPI_ATTR VkResult VKAPI_CALL GetRefreshCycleDurationGOOGLE(VkDevice device, VkSwapchainKHR swapchain, |
| 6941 | VkRefreshCycleDurationGOOGLE *pDisplayTimingProperties) { |
| 6942 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 6943 | bool skip = false; |
| 6944 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6945 | assert(my_data != NULL); |
| 6946 | skip |= parameter_validation_vkGetRefreshCycleDurationGOOGLE(my_data->report_data, swapchain, pDisplayTimingProperties); |
| 6947 | if (!skip) { |
| 6948 | result = my_data->dispatch_table.GetRefreshCycleDurationGOOGLE(device, swapchain, pDisplayTimingProperties); |
| 6949 | } |
| 6950 | return result; |
| 6951 | } |
| 6952 | |
| 6953 | VKAPI_ATTR void VKAPI_CALL SetHdrMetadataEXT(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR *pSwapchains, |
| 6954 | const VkHdrMetadataEXT *pMetadata) { |
| 6955 | bool skip = false; |
| 6956 | auto my_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6957 | assert(my_data != NULL); |
| 6958 | skip |= parameter_validation_vkSetHdrMetadataEXT(my_data->report_data, swapchainCount, pSwapchains, pMetadata); |
| 6959 | if (!skip) { |
| 6960 | my_data->dispatch_table.SetHdrMetadataEXT(device, swapchainCount, pSwapchains, pMetadata); |
| 6961 | } |
| 6962 | } |
| 6963 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6964 | static inline PFN_vkVoidFunction layer_intercept_proc(const char *name) { |
| 6965 | for (unsigned int i = 0; i < sizeof(procmap) / sizeof(procmap[0]); i++) { |
| 6966 | if (!strcmp(name, procmap[i].name)) return procmap[i].pFunc; |
| 6967 | } |
| 6968 | return NULL; |
| 6969 | } |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6970 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 6971 | 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] | 6972 | assert(device); |
| 6973 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6974 | PFN_vkVoidFunction addr = layer_intercept_proc(funcName); |
| 6975 | if (addr) return addr; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 6976 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6977 | layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 6978 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6979 | if (!dev_data->dispatch_table.GetDeviceProcAddr) return nullptr; |
| 6980 | return dev_data->dispatch_table.GetDeviceProcAddr(device, funcName); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 6981 | } |
| 6982 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 6983 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char *funcName) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 6984 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6985 | PFN_vkVoidFunction addr = layer_intercept_proc(funcName); |
| 6986 | if (addr) return addr; |
Courtney Goeltzenleuchter | 500b89b | 2015-06-01 14:45:27 -0600 | [diff] [blame] | 6987 | |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 6988 | assert(instance); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 6989 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6990 | auto instance_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 6991 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6992 | if (!instance_data->dispatch_table.GetInstanceProcAddr) return nullptr; |
| 6993 | return instance_data->dispatch_table.GetInstanceProcAddr(instance, funcName); |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 6994 | } |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 6995 | |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6996 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetPhysicalDeviceProcAddr(VkInstance instance, const char *funcName) { |
| 6997 | assert(instance); |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 6998 | auto pdev_data = GetLayerDataPtr(get_dispatch_key(instance), instance_layer_data_map); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 6999 | |
Mark Young | 4e423c0 | 2017-03-07 13:09:00 -0700 | [diff] [blame] | 7000 | if (!pdev_data->dispatch_table.GetPhysicalDeviceProcAddr) return nullptr; |
| 7001 | return pdev_data->dispatch_table.GetPhysicalDeviceProcAddr(instance, funcName); |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 7002 | } |
| 7003 | |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 7004 | } // namespace parameter_validation |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7005 | |
| 7006 | // vk_layer_logging.h expects these to be defined |
| 7007 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 7008 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(VkInstance instance, |
| 7009 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 7010 | const VkAllocationCallbacks *pAllocator, |
| 7011 | VkDebugReportCallbackEXT *pMsgCallback) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 7012 | return parameter_validation::CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7013 | } |
| 7014 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 7015 | VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, |
| 7016 | const VkAllocationCallbacks *pAllocator) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 7017 | parameter_validation::DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
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 vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 7021 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 7022 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 7023 | parameter_validation::DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7024 | } |
| 7025 | |
| 7026 | // loader-layer interface v0 |
| 7027 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 7028 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 7029 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 7030 | return parameter_validation::EnumerateInstanceExtensionProperties(pLayerName, pCount, pProperties); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 7031 | } |
| 7032 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 7033 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pCount, |
| 7034 | VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 7035 | return parameter_validation::EnumerateInstanceLayerProperties(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 vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 7039 | VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 7040 | // the layer command handles VK_NULL_HANDLE just fine internally |
| 7041 | assert(physicalDevice == VK_NULL_HANDLE); |
| 7042 | return parameter_validation::EnumerateDeviceLayerProperties(VK_NULL_HANDLE, pCount, pProperties); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7043 | } |
| 7044 | |
| 7045 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, |
| 7046 | const char *pLayerName, uint32_t *pCount, |
| 7047 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 7048 | // the layer command handles VK_NULL_HANDLE just fine internally |
| 7049 | assert(physicalDevice == VK_NULL_HANDLE); |
Chia-I Wu | 76a3466 | 2016-05-16 07:34:09 +0800 | [diff] [blame] | 7050 | return parameter_validation::EnumerateDeviceExtensionProperties(VK_NULL_HANDLE, pLayerName, pCount, pProperties); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7051 | } |
| 7052 | |
| 7053 | 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] | 7054 | return parameter_validation::GetDeviceProcAddr(dev, funcName); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 7055 | } |
| 7056 | |
| 7057 | 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] | 7058 | return parameter_validation::GetInstanceProcAddr(instance, funcName); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 7059 | } |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 7060 | |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 7061 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_layerGetPhysicalDeviceProcAddr(VkInstance instance, |
| 7062 | const char *funcName) { |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 7063 | return parameter_validation::GetPhysicalDeviceProcAddr(instance, funcName); |
| 7064 | } |
| 7065 | |
| 7066 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *pVersionStruct) { |
| 7067 | assert(pVersionStruct != NULL); |
| 7068 | assert(pVersionStruct->sType == LAYER_NEGOTIATE_INTERFACE_STRUCT); |
| 7069 | |
| 7070 | // Fill in the function pointers if our version is at least capable of having the structure contain them. |
| 7071 | if (pVersionStruct->loaderLayerInterfaceVersion >= 2) { |
| 7072 | pVersionStruct->pfnGetInstanceProcAddr = vkGetInstanceProcAddr; |
| 7073 | pVersionStruct->pfnGetDeviceProcAddr = vkGetDeviceProcAddr; |
| 7074 | pVersionStruct->pfnGetPhysicalDeviceProcAddr = vk_layerGetPhysicalDeviceProcAddr; |
| 7075 | } |
| 7076 | |
| 7077 | if (pVersionStruct->loaderLayerInterfaceVersion < CURRENT_LOADER_LAYER_INTERFACE_VERSION) { |
| 7078 | parameter_validation::loader_layer_if_version = pVersionStruct->loaderLayerInterfaceVersion; |
| 7079 | } else if (pVersionStruct->loaderLayerInterfaceVersion > CURRENT_LOADER_LAYER_INTERFACE_VERSION) { |
| 7080 | pVersionStruct->loaderLayerInterfaceVersion = CURRENT_LOADER_LAYER_INTERFACE_VERSION; |
| 7081 | } |
| 7082 | |
| 7083 | return VK_SUCCESS; |
| 7084 | } |