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> |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 22 | */ |
| 23 | |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 24 | #define NOMINMAX |
| 25 | |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame^] | 26 | #include <limits.h> |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 27 | #include <math.h> |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 28 | #include <stdio.h> |
| 29 | #include <stdlib.h> |
| 30 | #include <string.h> |
| 31 | |
| 32 | #include <iostream> |
| 33 | #include <string> |
| 34 | #include <sstream> |
Mark Lobodzinski | 2eed1eb | 2015-05-26 10:58:40 -0500 | [diff] [blame] | 35 | #include <unordered_map> |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 36 | #include <unordered_set> |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 37 | #include <vector> |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 38 | |
Tobin Ehlis | b835d1b | 2015-07-03 10:34:49 -0600 | [diff] [blame] | 39 | #include "vk_loader_platform.h" |
David Pinedo | 9316d3b | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 40 | #include "vulkan/vk_layer.h" |
Tobin Ehlis | a0cb02e | 2015-07-03 10:15:26 -0600 | [diff] [blame] | 41 | #include "vk_layer_config.h" |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 42 | #include "vk_enum_validate_helper.h" |
| 43 | #include "vk_struct_validate_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 | |
Cody Northrop | 55443ef | 2015-09-28 15:09:32 -0600 | [diff] [blame] | 56 | struct layer_data { |
Chia-I Wu | a570b7c | 2016-05-16 07:48:14 +0800 | [diff] [blame] | 57 | VkInstance instance; |
| 58 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 59 | debug_report_data *report_data; |
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: |
| 64 | uint32_t num_tmp_callbacks; |
| 65 | VkDebugReportCallbackCreateInfoEXT *tmp_dbg_create_infos; |
| 66 | VkDebugReportCallbackEXT *tmp_callbacks; |
| 67 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 68 | // TODO: Split instance/device structs |
| 69 | // Device Data |
| 70 | // Map for queue family index to queue count |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 71 | std::unordered_map<uint32_t, uint32_t> queueFamilyIndexMap; |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 72 | VkPhysicalDeviceLimits device_limits; |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 73 | VkPhysicalDeviceFeatures physical_device_features; |
| 74 | VkPhysicalDevice physical_device; |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 75 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 76 | bool wsi_enabled; |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 77 | bool wsi_display_swapchain_enabled; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 78 | |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 79 | layer_data() |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 80 | : report_data(nullptr), num_tmp_callbacks(0), tmp_dbg_create_infos(nullptr), tmp_callbacks(nullptr), device_limits{}, |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 81 | physical_device_features{}, physical_device{}, wsi_enabled(false), wsi_display_swapchain_enabled(false) {}; |
Cody Northrop | 55443ef | 2015-09-28 15:09:32 -0600 | [diff] [blame] | 82 | }; |
Mark Lobodzinski | 2eed1eb | 2015-05-26 10:58:40 -0500 | [diff] [blame] | 83 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 84 | static std::unordered_map<void *, struct instance_extension_enables> instance_extension_map; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 85 | static std::unordered_map<void *, layer_data *> layer_data_map; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 86 | static device_table_map pc_device_table_map; |
| 87 | static instance_table_map pc_instance_table_map; |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 88 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 89 | // "my instance data" |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 90 | debug_report_data *mid(VkInstance object) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 91 | dispatch_key key = get_dispatch_key(object); |
Tobin Ehlis | bfbac25 | 2015-09-01 11:46:36 -0600 | [diff] [blame] | 92 | layer_data *data = get_my_data_ptr(key, layer_data_map); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 93 | #if DISPATCH_MAP_DEBUG |
Mark Mueller | aab3650 | 2016-05-03 13:17:29 -0600 | [diff] [blame] | 94 | fprintf(stderr, "MID: map: 0x%p, object: 0x%p, key: 0x%p, data: 0x%p\n", &layer_data_map, object, key, data); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 95 | #endif |
Courtney Goeltzenleuchter | 876a4f5 | 2015-07-17 10:20:11 -0600 | [diff] [blame] | 96 | assert(data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 97 | |
| 98 | return data->report_data; |
| 99 | } |
| 100 | |
| 101 | // "my device data" |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 102 | debug_report_data *mdd(void *object) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 103 | dispatch_key key = get_dispatch_key(object); |
| 104 | layer_data *data = get_my_data_ptr(key, layer_data_map); |
| 105 | #if DISPATCH_MAP_DEBUG |
Mark Mueller | aab3650 | 2016-05-03 13:17:29 -0600 | [diff] [blame] | 106 | fprintf(stderr, "MDD: map: 0x%p, object: 0x%p, key: 0x%p, data: 0x%p\n", &layer_data_map, object, key, data); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 107 | #endif |
Courtney Goeltzenleuchter | 876a4f5 | 2015-07-17 10:20:11 -0600 | [diff] [blame] | 108 | assert(data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 109 | return data->report_data; |
| 110 | } |
| 111 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 112 | static void init_parameter_validation(layer_data *my_data, const VkAllocationCallbacks *pAllocator) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 113 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 114 | 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] | 115 | } |
| 116 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 117 | VKAPI_ATTR VkResult VKAPI_CALL CreateDebugReportCallbackEXT(VkInstance instance, |
| 118 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 119 | const VkAllocationCallbacks *pAllocator, |
| 120 | VkDebugReportCallbackEXT *pMsgCallback) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 121 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 122 | VkResult result = pTable->CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 123 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 124 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 125 | layer_data *data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
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) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 134 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 135 | pTable->DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 136 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 137 | layer_data *data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
Courtney Goeltzenleuchter | 05854bf | 2015-11-30 12:13:14 -0700 | [diff] [blame] | 138 | layer_destroy_msg_callback(data->report_data, msgCallback, pAllocator); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 139 | } |
| 140 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 141 | VKAPI_ATTR void VKAPI_CALL DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 142 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 143 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 144 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
| 145 | pTable->DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
Courtney Goeltzenleuchter | f0de724 | 2015-12-01 14:10:55 -0700 | [diff] [blame] | 146 | } |
| 147 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 148 | 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] | 149 | |
Chia-I Wu | 3384db8 | 2016-05-16 07:30:58 +0800 | [diff] [blame] | 150 | static const VkLayerProperties global_layer = { |
Jon Ashburn | dc9111c | 2016-03-22 12:57:13 -0600 | [diff] [blame] | 151 | "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] | 152 | }; |
Courtney Goeltzenleuchter | 5285766 | 2015-12-01 14:08:28 -0700 | [diff] [blame] | 153 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 154 | static bool ValidateEnumerator(VkFormatFeatureFlagBits const &enumerator) { |
Courtney Goeltzenleuchter | f1ece60 | 2015-09-10 16:25:49 -0600 | [diff] [blame] | 155 | VkFormatFeatureFlagBits allFlags = (VkFormatFeatureFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 156 | VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT | VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | |
| 157 | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT | |
| 158 | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT | VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | |
| 159 | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | |
| 160 | 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] | 161 | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 162 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 163 | return false; |
| 164 | } |
| 165 | |
| 166 | return true; |
| 167 | } |
| 168 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 169 | static std::string EnumeratorString(VkFormatFeatureFlagBits const &enumerator) { |
| 170 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 171 | return "unrecognized enumerator"; |
| 172 | } |
| 173 | |
| 174 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 175 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 176 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT"); |
| 177 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 178 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 179 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT"); |
| 180 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 181 | if (enumerator & VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 182 | strings.push_back("VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT"); |
| 183 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 184 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 185 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT"); |
| 186 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 187 | if (enumerator & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 188 | strings.push_back("VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT"); |
| 189 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 190 | if (enumerator & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 191 | strings.push_back("VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT"); |
| 192 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 193 | if (enumerator & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 194 | strings.push_back("VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT"); |
| 195 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 196 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 197 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT"); |
| 198 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 199 | if (enumerator & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 200 | strings.push_back("VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT"); |
| 201 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 202 | if (enumerator & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 203 | strings.push_back("VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
| 204 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 205 | if (enumerator & VK_FORMAT_FEATURE_BLIT_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 206 | strings.push_back("VK_FORMAT_FEATURE_BLIT_SRC_BIT"); |
Cody Northrop | 61d6dd6 | 2015-08-18 14:58:29 -0600 | [diff] [blame] | 207 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 208 | if (enumerator & VK_FORMAT_FEATURE_BLIT_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 209 | strings.push_back("VK_FORMAT_FEATURE_BLIT_DST_BIT"); |
Cody Northrop | 61d6dd6 | 2015-08-18 14:58:29 -0600 | [diff] [blame] | 210 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 211 | if (enumerator & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) { |
Jon Ashburn | 766866a | 2016-01-22 15:39:20 -0700 | [diff] [blame] | 212 | strings.push_back("VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT"); |
| 213 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 214 | |
| 215 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 216 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 217 | enumeratorString += string; |
| 218 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 219 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 220 | enumeratorString += '|'; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | return enumeratorString; |
| 225 | } |
| 226 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 227 | static bool ValidateEnumerator(VkImageUsageFlagBits const &enumerator) { |
| 228 | VkImageUsageFlagBits allFlags = (VkImageUsageFlagBits)( |
| 229 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | |
| 230 | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | |
| 231 | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT); |
| 232 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 233 | return false; |
| 234 | } |
| 235 | |
| 236 | return true; |
| 237 | } |
| 238 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 239 | static std::string EnumeratorString(VkImageUsageFlagBits const &enumerator) { |
| 240 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 241 | return "unrecognized enumerator"; |
| 242 | } |
| 243 | |
| 244 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 245 | if (enumerator & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 246 | strings.push_back("VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT"); |
| 247 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 248 | if (enumerator & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) { |
Courtney Goeltzenleuchter | 660f0ca | 2015-09-10 14:14:11 -0600 | [diff] [blame] | 249 | strings.push_back("VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 250 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 251 | if (enumerator & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 252 | strings.push_back("VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT"); |
| 253 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 254 | if (enumerator & VK_IMAGE_USAGE_STORAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 255 | strings.push_back("VK_IMAGE_USAGE_STORAGE_BIT"); |
| 256 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 257 | if (enumerator & VK_IMAGE_USAGE_SAMPLED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 258 | strings.push_back("VK_IMAGE_USAGE_SAMPLED_BIT"); |
| 259 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 260 | if (enumerator & VK_IMAGE_USAGE_TRANSFER_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 261 | strings.push_back("VK_IMAGE_USAGE_TRANSFER_DST_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 262 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 263 | if (enumerator & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 264 | strings.push_back("VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT"); |
| 265 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 266 | if (enumerator & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 267 | strings.push_back("VK_IMAGE_USAGE_TRANSFER_SRC_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 268 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 269 | |
| 270 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 271 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 272 | enumeratorString += string; |
| 273 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 274 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 275 | enumeratorString += '|'; |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | return enumeratorString; |
| 280 | } |
| 281 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 282 | static bool ValidateEnumerator(VkQueueFlagBits const &enumerator) { |
| 283 | VkQueueFlagBits allFlags = |
| 284 | (VkQueueFlagBits)(VK_QUEUE_TRANSFER_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_SPARSE_BINDING_BIT | VK_QUEUE_GRAPHICS_BIT); |
| 285 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 286 | return false; |
| 287 | } |
| 288 | |
| 289 | return true; |
| 290 | } |
| 291 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 292 | static std::string EnumeratorString(VkQueueFlagBits const &enumerator) { |
| 293 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 294 | return "unrecognized enumerator"; |
| 295 | } |
| 296 | |
| 297 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 298 | if (enumerator & VK_QUEUE_TRANSFER_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 299 | strings.push_back("VK_QUEUE_TRANSFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 300 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 301 | if (enumerator & VK_QUEUE_COMPUTE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 302 | strings.push_back("VK_QUEUE_COMPUTE_BIT"); |
| 303 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 304 | if (enumerator & VK_QUEUE_SPARSE_BINDING_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 305 | strings.push_back("VK_QUEUE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 306 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 307 | if (enumerator & VK_QUEUE_GRAPHICS_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 308 | strings.push_back("VK_QUEUE_GRAPHICS_BIT"); |
| 309 | } |
| 310 | |
| 311 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 312 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 313 | enumeratorString += string; |
| 314 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 315 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 316 | enumeratorString += '|'; |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | return enumeratorString; |
| 321 | } |
| 322 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 323 | static bool ValidateEnumerator(VkMemoryPropertyFlagBits const &enumerator) { |
| 324 | VkMemoryPropertyFlagBits allFlags = (VkMemoryPropertyFlagBits)( |
| 325 | VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | |
| 326 | VK_MEMORY_PROPERTY_HOST_CACHED_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); |
| 327 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 328 | return false; |
| 329 | } |
| 330 | |
| 331 | return true; |
| 332 | } |
| 333 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 334 | static std::string EnumeratorString(VkMemoryPropertyFlagBits const &enumerator) { |
| 335 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 336 | return "unrecognized enumerator"; |
| 337 | } |
| 338 | |
| 339 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 340 | if (enumerator & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 341 | strings.push_back("VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT"); |
| 342 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 343 | if (enumerator & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 344 | strings.push_back("VK_MEMORY_PROPERTY_HOST_COHERENT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 345 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 346 | if (enumerator & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 347 | strings.push_back("VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT"); |
| 348 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 349 | if (enumerator & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 350 | strings.push_back("VK_MEMORY_PROPERTY_HOST_CACHED_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 351 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 352 | if (enumerator & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 353 | strings.push_back("VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 354 | } |
| 355 | |
| 356 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 357 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 358 | enumeratorString += string; |
| 359 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 360 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 361 | enumeratorString += '|'; |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | return enumeratorString; |
| 366 | } |
| 367 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 368 | static bool ValidateEnumerator(VkMemoryHeapFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 369 | VkMemoryHeapFlagBits allFlags = (VkMemoryHeapFlagBits)(VK_MEMORY_HEAP_DEVICE_LOCAL_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 370 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 371 | return false; |
| 372 | } |
| 373 | |
| 374 | return true; |
| 375 | } |
| 376 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 377 | static std::string EnumeratorString(VkMemoryHeapFlagBits const &enumerator) { |
| 378 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 379 | return "unrecognized enumerator"; |
| 380 | } |
| 381 | |
| 382 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 383 | if (enumerator & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 384 | strings.push_back("VK_MEMORY_HEAP_DEVICE_LOCAL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 388 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 389 | enumeratorString += string; |
| 390 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 391 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 392 | enumeratorString += '|'; |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | return enumeratorString; |
| 397 | } |
| 398 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 399 | static bool ValidateEnumerator(VkSparseImageFormatFlagBits const &enumerator) { |
| 400 | VkSparseImageFormatFlagBits allFlags = |
| 401 | (VkSparseImageFormatFlagBits)(VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT | |
| 402 | VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT | VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT); |
| 403 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 404 | return false; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 405 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 406 | |
| 407 | return true; |
| 408 | } |
| 409 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 410 | static std::string EnumeratorString(VkSparseImageFormatFlagBits const &enumerator) { |
| 411 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 412 | return "unrecognized enumerator"; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 413 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 414 | |
| 415 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 416 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 417 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 418 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 419 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 420 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 421 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 422 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 423 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 424 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 425 | |
| 426 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 427 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 428 | enumeratorString += string; |
| 429 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 430 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 431 | enumeratorString += '|'; |
| 432 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 433 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 434 | |
| 435 | return enumeratorString; |
| 436 | } |
| 437 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 438 | static bool ValidateEnumerator(VkFenceCreateFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 439 | VkFenceCreateFlagBits allFlags = (VkFenceCreateFlagBits)(VK_FENCE_CREATE_SIGNALED_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 440 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 441 | return false; |
| 442 | } |
| 443 | |
| 444 | return true; |
| 445 | } |
| 446 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 447 | static std::string EnumeratorString(VkFenceCreateFlagBits const &enumerator) { |
| 448 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 449 | return "unrecognized enumerator"; |
| 450 | } |
| 451 | |
| 452 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 453 | if (enumerator & VK_FENCE_CREATE_SIGNALED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 454 | strings.push_back("VK_FENCE_CREATE_SIGNALED_BIT"); |
| 455 | } |
| 456 | |
| 457 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 458 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 459 | enumeratorString += string; |
| 460 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 461 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 462 | enumeratorString += '|'; |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | return enumeratorString; |
| 467 | } |
| 468 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 469 | static bool ValidateEnumerator(VkQueryPipelineStatisticFlagBits const &enumerator) { |
| 470 | VkQueryPipelineStatisticFlagBits allFlags = (VkQueryPipelineStatisticFlagBits)( |
| 471 | VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT | VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT | |
| 472 | VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT | VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT | |
| 473 | VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT | VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT | |
| 474 | 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] | 475 | VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT | |
| 476 | VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT | |
| 477 | VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 478 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 479 | return false; |
| 480 | } |
| 481 | |
| 482 | return true; |
| 483 | } |
| 484 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 485 | static std::string EnumeratorString(VkQueryPipelineStatisticFlagBits const &enumerator) { |
| 486 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 487 | return "unrecognized enumerator"; |
| 488 | } |
| 489 | |
| 490 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 491 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 492 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 493 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 494 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 495 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 496 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 497 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 498 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 499 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 500 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 501 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 502 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 503 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 504 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 505 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 506 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 507 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 508 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 509 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 510 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 511 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 512 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 513 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 514 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 515 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 516 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 517 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 518 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 519 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 520 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 521 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 522 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 523 | } |
| 524 | |
| 525 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 526 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 527 | enumeratorString += string; |
| 528 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 529 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 530 | enumeratorString += '|'; |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | return enumeratorString; |
| 535 | } |
| 536 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 537 | static bool ValidateEnumerator(VkQueryResultFlagBits const &enumerator) { |
| 538 | VkQueryResultFlagBits allFlags = (VkQueryResultFlagBits)(VK_QUERY_RESULT_PARTIAL_BIT | VK_QUERY_RESULT_WITH_AVAILABILITY_BIT | |
| 539 | VK_QUERY_RESULT_WAIT_BIT | VK_QUERY_RESULT_64_BIT); |
| 540 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 541 | return false; |
| 542 | } |
| 543 | |
| 544 | return true; |
| 545 | } |
| 546 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 547 | static std::string EnumeratorString(VkQueryResultFlagBits const &enumerator) { |
| 548 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 549 | return "unrecognized enumerator"; |
| 550 | } |
| 551 | |
| 552 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 553 | if (enumerator & VK_QUERY_RESULT_PARTIAL_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 554 | strings.push_back("VK_QUERY_RESULT_PARTIAL_BIT"); |
| 555 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 556 | if (enumerator & VK_QUERY_RESULT_WITH_AVAILABILITY_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 557 | strings.push_back("VK_QUERY_RESULT_WITH_AVAILABILITY_BIT"); |
| 558 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 559 | if (enumerator & VK_QUERY_RESULT_WAIT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 560 | strings.push_back("VK_QUERY_RESULT_WAIT_BIT"); |
| 561 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 562 | if (enumerator & VK_QUERY_RESULT_64_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 563 | strings.push_back("VK_QUERY_RESULT_64_BIT"); |
| 564 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 565 | |
| 566 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 567 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 568 | enumeratorString += string; |
| 569 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 570 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 571 | enumeratorString += '|'; |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | return enumeratorString; |
| 576 | } |
| 577 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 578 | static bool ValidateEnumerator(VkBufferUsageFlagBits const &enumerator) { |
| 579 | VkBufferUsageFlagBits allFlags = (VkBufferUsageFlagBits)( |
| 580 | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT | |
| 581 | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | |
| 582 | VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT); |
| 583 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 584 | return false; |
| 585 | } |
| 586 | |
| 587 | return true; |
| 588 | } |
| 589 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 590 | static std::string EnumeratorString(VkBufferUsageFlagBits const &enumerator) { |
| 591 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 592 | return "unrecognized enumerator"; |
| 593 | } |
| 594 | |
| 595 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 596 | if (enumerator & VK_BUFFER_USAGE_VERTEX_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 597 | strings.push_back("VK_BUFFER_USAGE_VERTEX_BUFFER_BIT"); |
| 598 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 599 | if (enumerator & VK_BUFFER_USAGE_INDEX_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 600 | strings.push_back("VK_BUFFER_USAGE_INDEX_BUFFER_BIT"); |
| 601 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 602 | if (enumerator & VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 603 | strings.push_back("VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT"); |
| 604 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 605 | if (enumerator & VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 606 | strings.push_back("VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT"); |
| 607 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 608 | if (enumerator & VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 609 | strings.push_back("VK_BUFFER_USAGE_STORAGE_BUFFER_BIT"); |
| 610 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 611 | if (enumerator & VK_BUFFER_USAGE_TRANSFER_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 612 | strings.push_back("VK_BUFFER_USAGE_TRANSFER_DST_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 613 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 614 | if (enumerator & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 615 | strings.push_back("VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT"); |
| 616 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 617 | if (enumerator & VK_BUFFER_USAGE_TRANSFER_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 618 | strings.push_back("VK_BUFFER_USAGE_TRANSFER_SRC_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 619 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 620 | if (enumerator & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 621 | strings.push_back("VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT"); |
| 622 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 623 | |
| 624 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 625 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 626 | enumeratorString += string; |
| 627 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 628 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 629 | enumeratorString += '|'; |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | return enumeratorString; |
| 634 | } |
| 635 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 636 | static bool ValidateEnumerator(VkBufferCreateFlagBits const &enumerator) { |
| 637 | VkBufferCreateFlagBits allFlags = (VkBufferCreateFlagBits)( |
| 638 | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT | VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT | VK_BUFFER_CREATE_SPARSE_BINDING_BIT); |
| 639 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 640 | return false; |
| 641 | } |
| 642 | |
| 643 | return true; |
| 644 | } |
| 645 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 646 | static std::string EnumeratorString(VkBufferCreateFlagBits const &enumerator) { |
| 647 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 648 | return "unrecognized enumerator"; |
| 649 | } |
| 650 | |
| 651 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 652 | if (enumerator & VK_BUFFER_CREATE_SPARSE_ALIASED_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 653 | strings.push_back("VK_BUFFER_CREATE_SPARSE_ALIASED_BIT"); |
| 654 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 655 | if (enumerator & VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 656 | strings.push_back("VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT"); |
| 657 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 658 | if (enumerator & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) { |
Courtney Goeltzenleuchter | 8134da0 | 2015-09-10 17:00:22 -0600 | [diff] [blame] | 659 | strings.push_back("VK_BUFFER_CREATE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 660 | } |
| 661 | |
| 662 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 663 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 664 | enumeratorString += string; |
| 665 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 666 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 667 | enumeratorString += '|'; |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | return enumeratorString; |
| 672 | } |
| 673 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 674 | static bool ValidateEnumerator(VkImageCreateFlagBits const &enumerator) { |
| 675 | VkImageCreateFlagBits allFlags = (VkImageCreateFlagBits)( |
| 676 | VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | |
| 677 | VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_SPARSE_BINDING_BIT); |
| 678 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 679 | return false; |
| 680 | } |
| 681 | |
| 682 | return true; |
| 683 | } |
| 684 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 685 | static std::string EnumeratorString(VkImageCreateFlagBits const &enumerator) { |
| 686 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 687 | return "unrecognized enumerator"; |
| 688 | } |
| 689 | |
| 690 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 691 | if (enumerator & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 692 | strings.push_back("VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT"); |
| 693 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 694 | if (enumerator & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 695 | strings.push_back("VK_IMAGE_CREATE_SPARSE_ALIASED_BIT"); |
| 696 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 697 | if (enumerator & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 698 | strings.push_back("VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT"); |
| 699 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 700 | if (enumerator & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 701 | strings.push_back("VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT"); |
| 702 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 703 | if (enumerator & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) { |
Courtney Goeltzenleuchter | 8134da0 | 2015-09-10 17:00:22 -0600 | [diff] [blame] | 704 | strings.push_back("VK_IMAGE_CREATE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 705 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 706 | |
| 707 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 708 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 709 | enumeratorString += string; |
| 710 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 711 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 712 | enumeratorString += '|'; |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | return enumeratorString; |
| 717 | } |
| 718 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 719 | static bool ValidateEnumerator(VkColorComponentFlagBits const &enumerator) { |
| 720 | VkColorComponentFlagBits allFlags = (VkColorComponentFlagBits)(VK_COLOR_COMPONENT_A_BIT | VK_COLOR_COMPONENT_B_BIT | |
| 721 | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_R_BIT); |
| 722 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 723 | return false; |
| 724 | } |
| 725 | |
| 726 | return true; |
| 727 | } |
| 728 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 729 | static std::string EnumeratorString(VkColorComponentFlagBits const &enumerator) { |
| 730 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 731 | return "unrecognized enumerator"; |
| 732 | } |
| 733 | |
| 734 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 735 | if (enumerator & VK_COLOR_COMPONENT_A_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 736 | strings.push_back("VK_COLOR_COMPONENT_A_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 737 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 738 | if (enumerator & VK_COLOR_COMPONENT_B_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 739 | strings.push_back("VK_COLOR_COMPONENT_B_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 740 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 741 | if (enumerator & VK_COLOR_COMPONENT_G_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 742 | strings.push_back("VK_COLOR_COMPONENT_G_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 743 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 744 | if (enumerator & VK_COLOR_COMPONENT_R_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 745 | strings.push_back("VK_COLOR_COMPONENT_R_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 746 | } |
| 747 | |
| 748 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 749 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 750 | enumeratorString += string; |
| 751 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 752 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 753 | enumeratorString += '|'; |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | return enumeratorString; |
| 758 | } |
| 759 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 760 | static bool ValidateEnumerator(VkPipelineCreateFlagBits const &enumerator) { |
| 761 | VkPipelineCreateFlagBits allFlags = (VkPipelineCreateFlagBits)( |
| 762 | VK_PIPELINE_CREATE_DERIVATIVE_BIT | VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT | VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT); |
| 763 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 764 | return false; |
| 765 | } |
| 766 | |
| 767 | return true; |
| 768 | } |
| 769 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 770 | static std::string EnumeratorString(VkPipelineCreateFlagBits const &enumerator) { |
| 771 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 772 | return "unrecognized enumerator"; |
| 773 | } |
| 774 | |
| 775 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 776 | if (enumerator & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 777 | strings.push_back("VK_PIPELINE_CREATE_DERIVATIVE_BIT"); |
| 778 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 779 | if (enumerator & VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 780 | strings.push_back("VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT"); |
| 781 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 782 | if (enumerator & VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 783 | strings.push_back("VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 784 | } |
| 785 | |
| 786 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 787 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 788 | enumeratorString += string; |
| 789 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 790 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 791 | enumeratorString += '|'; |
| 792 | } |
| 793 | } |
| 794 | |
| 795 | return enumeratorString; |
| 796 | } |
| 797 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 798 | static bool ValidateEnumerator(VkShaderStageFlagBits const &enumerator) { |
| 799 | VkShaderStageFlagBits allFlags = (VkShaderStageFlagBits)( |
| 800 | VK_SHADER_STAGE_ALL | VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_GEOMETRY_BIT | VK_SHADER_STAGE_COMPUTE_BIT | |
| 801 | VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT | VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT | VK_SHADER_STAGE_VERTEX_BIT); |
| 802 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 803 | return false; |
| 804 | } |
| 805 | |
| 806 | return true; |
| 807 | } |
| 808 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 809 | static std::string EnumeratorString(VkShaderStageFlagBits const &enumerator) { |
| 810 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 811 | return "unrecognized enumerator"; |
| 812 | } |
| 813 | |
| 814 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 815 | if (enumerator & VK_SHADER_STAGE_ALL) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 816 | strings.push_back("VK_SHADER_STAGE_ALL"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 817 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 818 | if (enumerator & VK_SHADER_STAGE_FRAGMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 819 | strings.push_back("VK_SHADER_STAGE_FRAGMENT_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 820 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 821 | if (enumerator & VK_SHADER_STAGE_GEOMETRY_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 822 | strings.push_back("VK_SHADER_STAGE_GEOMETRY_BIT"); |
| 823 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 824 | if (enumerator & VK_SHADER_STAGE_COMPUTE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 825 | strings.push_back("VK_SHADER_STAGE_COMPUTE_BIT"); |
| 826 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 827 | if (enumerator & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 828 | strings.push_back("VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 829 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 830 | if (enumerator & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 831 | strings.push_back("VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 832 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 833 | if (enumerator & VK_SHADER_STAGE_VERTEX_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 834 | strings.push_back("VK_SHADER_STAGE_VERTEX_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 835 | } |
| 836 | |
| 837 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 838 | for (auto const &string : strings) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 839 | enumeratorString += string; |
| 840 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 841 | if (string != strings.back()) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 842 | enumeratorString += '|'; |
| 843 | } |
| 844 | } |
| 845 | |
| 846 | return enumeratorString; |
| 847 | } |
| 848 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 849 | static bool ValidateEnumerator(VkPipelineStageFlagBits const &enumerator) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 850 | VkPipelineStageFlagBits allFlags = (VkPipelineStageFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 851 | VK_PIPELINE_STAGE_ALL_COMMANDS_BIT | VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | VK_PIPELINE_STAGE_HOST_BIT | |
| 852 | VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | |
| 853 | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | |
| 854 | VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | |
| 855 | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT | |
| 856 | 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] | 857 | VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 858 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 859 | return false; |
| 860 | } |
| 861 | |
| 862 | return true; |
| 863 | } |
| 864 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 865 | static std::string EnumeratorString(VkPipelineStageFlagBits const &enumerator) { |
| 866 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 867 | return "unrecognized enumerator"; |
| 868 | } |
| 869 | |
| 870 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 871 | if (enumerator & VK_PIPELINE_STAGE_ALL_COMMANDS_BIT) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 872 | strings.push_back("VK_PIPELINE_STAGE_ALL_COMMANDS_BIT"); |
| 873 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 874 | if (enumerator & VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 875 | strings.push_back("VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 876 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 877 | if (enumerator & VK_PIPELINE_STAGE_HOST_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 878 | strings.push_back("VK_PIPELINE_STAGE_HOST_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 879 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 880 | if (enumerator & VK_PIPELINE_STAGE_TRANSFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 881 | strings.push_back("VK_PIPELINE_STAGE_TRANSFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 882 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 883 | if (enumerator & VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 884 | strings.push_back("VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 885 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 886 | if (enumerator & VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT) { |
Jon Ashburn | 4bf8ba4 | 2015-12-31 12:14:37 -0700 | [diff] [blame] | 887 | strings.push_back("VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 888 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 889 | if (enumerator & VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 890 | strings.push_back("VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 891 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 892 | if (enumerator & VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 893 | strings.push_back("VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 894 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 895 | if (enumerator & VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 896 | strings.push_back("VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 897 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 898 | if (enumerator & VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 899 | strings.push_back("VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 900 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 901 | if (enumerator & VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 902 | strings.push_back("VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT"); |
| 903 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 904 | if (enumerator & VK_PIPELINE_STAGE_VERTEX_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 905 | strings.push_back("VK_PIPELINE_STAGE_VERTEX_SHADER_BIT"); |
| 906 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 907 | if (enumerator & VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 908 | strings.push_back("VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 909 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 910 | if (enumerator & VK_PIPELINE_STAGE_VERTEX_INPUT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 911 | strings.push_back("VK_PIPELINE_STAGE_VERTEX_INPUT_BIT"); |
| 912 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 913 | if (enumerator & VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 914 | strings.push_back("VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT"); |
| 915 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 916 | if (enumerator & VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 917 | strings.push_back("VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT"); |
| 918 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 919 | if (enumerator & VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 920 | strings.push_back("VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 921 | } |
| 922 | |
| 923 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 924 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 925 | enumeratorString += string; |
| 926 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 927 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 928 | enumeratorString += '|'; |
| 929 | } |
| 930 | } |
| 931 | |
| 932 | return enumeratorString; |
| 933 | } |
| 934 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 935 | static bool ValidateEnumerator(VkAccessFlagBits const &enumerator) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 936 | VkAccessFlagBits allFlags = (VkAccessFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 937 | VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_INDEX_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | |
| 938 | VK_ACCESS_UNIFORM_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT | VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT | |
| 939 | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | |
| 940 | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT | |
| 941 | 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] | 942 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 943 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 944 | return false; |
| 945 | } |
| 946 | |
| 947 | return true; |
| 948 | } |
| 949 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 950 | static std::string EnumeratorString(VkAccessFlagBits const &enumerator) { |
| 951 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 952 | return "unrecognized enumerator"; |
| 953 | } |
| 954 | |
| 955 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 956 | if (enumerator & VK_ACCESS_INDIRECT_COMMAND_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 957 | strings.push_back("VK_ACCESS_INDIRECT_COMMAND_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 958 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 959 | if (enumerator & VK_ACCESS_INDEX_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 960 | strings.push_back("VK_ACCESS_INDEX_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 961 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 962 | if (enumerator & VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 963 | strings.push_back("VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 964 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 965 | if (enumerator & VK_ACCESS_UNIFORM_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 966 | strings.push_back("VK_ACCESS_UNIFORM_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 967 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 968 | if (enumerator & VK_ACCESS_INPUT_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 969 | strings.push_back("VK_ACCESS_INPUT_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 970 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 971 | if (enumerator & VK_ACCESS_SHADER_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 972 | strings.push_back("VK_ACCESS_SHADER_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 973 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 974 | if (enumerator & VK_ACCESS_SHADER_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 975 | strings.push_back("VK_ACCESS_SHADER_WRITE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 976 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 977 | if (enumerator & VK_ACCESS_COLOR_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 978 | strings.push_back("VK_ACCESS_COLOR_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 979 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 980 | if (enumerator & VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 981 | strings.push_back("VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 982 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 983 | if (enumerator & VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 984 | strings.push_back("VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 985 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 986 | if (enumerator & VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 987 | strings.push_back("VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 988 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 989 | if (enumerator & VK_ACCESS_TRANSFER_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 990 | strings.push_back("VK_ACCESS_TRANSFER_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 991 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 992 | if (enumerator & VK_ACCESS_TRANSFER_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 993 | strings.push_back("VK_ACCESS_TRANSFER_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 994 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 995 | if (enumerator & VK_ACCESS_HOST_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 996 | strings.push_back("VK_ACCESS_HOST_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 997 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 998 | if (enumerator & VK_ACCESS_HOST_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 999 | strings.push_back("VK_ACCESS_HOST_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1000 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1001 | if (enumerator & VK_ACCESS_MEMORY_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 1002 | strings.push_back("VK_ACCESS_MEMORY_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1003 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1004 | if (enumerator & VK_ACCESS_MEMORY_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 1005 | strings.push_back("VK_ACCESS_MEMORY_WRITE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1006 | } |
| 1007 | |
| 1008 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1009 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1010 | enumeratorString += string; |
| 1011 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1012 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1013 | enumeratorString += '|'; |
| 1014 | } |
| 1015 | } |
| 1016 | |
| 1017 | return enumeratorString; |
| 1018 | } |
| 1019 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1020 | static bool ValidateEnumerator(VkCommandPoolCreateFlagBits const &enumerator) { |
| 1021 | VkCommandPoolCreateFlagBits allFlags = |
| 1022 | (VkCommandPoolCreateFlagBits)(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT | VK_COMMAND_POOL_CREATE_TRANSIENT_BIT); |
| 1023 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1024 | return false; |
| 1025 | } |
| 1026 | |
| 1027 | return true; |
| 1028 | } |
| 1029 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1030 | static std::string EnumeratorString(VkCommandPoolCreateFlagBits const &enumerator) { |
| 1031 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1032 | return "unrecognized enumerator"; |
| 1033 | } |
| 1034 | |
| 1035 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1036 | if (enumerator & VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1037 | strings.push_back("VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1038 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1039 | if (enumerator & VK_COMMAND_POOL_CREATE_TRANSIENT_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1040 | strings.push_back("VK_COMMAND_POOL_CREATE_TRANSIENT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1041 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1042 | |
| 1043 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1044 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1045 | enumeratorString += string; |
| 1046 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1047 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1048 | enumeratorString += '|'; |
| 1049 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1050 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1051 | |
| 1052 | return enumeratorString; |
| 1053 | } |
| 1054 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1055 | static bool ValidateEnumerator(VkCommandPoolResetFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1056 | VkCommandPoolResetFlagBits allFlags = (VkCommandPoolResetFlagBits)(VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1057 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1058 | return false; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1059 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1060 | |
| 1061 | return true; |
| 1062 | } |
| 1063 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1064 | static std::string EnumeratorString(VkCommandPoolResetFlagBits const &enumerator) { |
| 1065 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1066 | return "unrecognized enumerator"; |
| 1067 | } |
| 1068 | |
| 1069 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1070 | if (enumerator & VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1071 | strings.push_back("VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1072 | } |
| 1073 | |
| 1074 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1075 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1076 | enumeratorString += string; |
| 1077 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1078 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1079 | enumeratorString += '|'; |
| 1080 | } |
| 1081 | } |
| 1082 | |
| 1083 | return enumeratorString; |
| 1084 | } |
| 1085 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1086 | static bool ValidateEnumerator(VkCommandBufferUsageFlags const &enumerator) { |
| 1087 | VkCommandBufferUsageFlags allFlags = |
| 1088 | (VkCommandBufferUsageFlags)(VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT | VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT | |
| 1089 | VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT); |
| 1090 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1091 | return false; |
| 1092 | } |
| 1093 | |
| 1094 | return true; |
| 1095 | } |
| 1096 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1097 | static std::string EnumeratorString(VkCommandBufferUsageFlags const &enumerator) { |
| 1098 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1099 | return "unrecognized enumerator"; |
| 1100 | } |
| 1101 | |
| 1102 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1103 | if (enumerator & VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1104 | strings.push_back("VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1105 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1106 | if (enumerator & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1107 | strings.push_back("VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1108 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1109 | if (enumerator & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1110 | strings.push_back("VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1111 | } |
| 1112 | |
| 1113 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1114 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1115 | enumeratorString += string; |
| 1116 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1117 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1118 | enumeratorString += '|'; |
| 1119 | } |
| 1120 | } |
| 1121 | |
| 1122 | return enumeratorString; |
| 1123 | } |
| 1124 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1125 | static bool ValidateEnumerator(VkCommandBufferResetFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1126 | VkCommandBufferResetFlagBits allFlags = (VkCommandBufferResetFlagBits)(VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1127 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1128 | return false; |
| 1129 | } |
| 1130 | |
| 1131 | return true; |
| 1132 | } |
| 1133 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1134 | static std::string EnumeratorString(VkCommandBufferResetFlagBits const &enumerator) { |
| 1135 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1136 | return "unrecognized enumerator"; |
| 1137 | } |
| 1138 | |
| 1139 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1140 | if (enumerator & VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1141 | strings.push_back("VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1142 | } |
| 1143 | |
| 1144 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1145 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1146 | enumeratorString += string; |
| 1147 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1148 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1149 | enumeratorString += '|'; |
| 1150 | } |
| 1151 | } |
| 1152 | |
| 1153 | return enumeratorString; |
| 1154 | } |
| 1155 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1156 | static bool ValidateEnumerator(VkImageAspectFlagBits const &enumerator) { |
| 1157 | VkImageAspectFlagBits allFlags = (VkImageAspectFlagBits)(VK_IMAGE_ASPECT_METADATA_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 1158 | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_COLOR_BIT); |
| 1159 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1160 | return false; |
| 1161 | } |
| 1162 | |
| 1163 | return true; |
| 1164 | } |
| 1165 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1166 | static std::string EnumeratorString(VkImageAspectFlagBits const &enumerator) { |
| 1167 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1168 | return "unrecognized enumerator"; |
| 1169 | } |
| 1170 | |
| 1171 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1172 | if (enumerator & VK_IMAGE_ASPECT_METADATA_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1173 | strings.push_back("VK_IMAGE_ASPECT_METADATA_BIT"); |
| 1174 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1175 | if (enumerator & VK_IMAGE_ASPECT_STENCIL_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1176 | strings.push_back("VK_IMAGE_ASPECT_STENCIL_BIT"); |
| 1177 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1178 | if (enumerator & VK_IMAGE_ASPECT_DEPTH_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1179 | strings.push_back("VK_IMAGE_ASPECT_DEPTH_BIT"); |
| 1180 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1181 | if (enumerator & VK_IMAGE_ASPECT_COLOR_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1182 | strings.push_back("VK_IMAGE_ASPECT_COLOR_BIT"); |
| 1183 | } |
| 1184 | |
| 1185 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1186 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1187 | enumeratorString += string; |
| 1188 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1189 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1190 | enumeratorString += '|'; |
| 1191 | } |
| 1192 | } |
| 1193 | |
| 1194 | return enumeratorString; |
| 1195 | } |
| 1196 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1197 | static bool ValidateEnumerator(VkQueryControlFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1198 | VkQueryControlFlagBits allFlags = (VkQueryControlFlagBits)(VK_QUERY_CONTROL_PRECISE_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1199 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1200 | return false; |
| 1201 | } |
| 1202 | |
| 1203 | return true; |
| 1204 | } |
| 1205 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1206 | static std::string EnumeratorString(VkQueryControlFlagBits const &enumerator) { |
| 1207 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1208 | return "unrecognized enumerator"; |
| 1209 | } |
| 1210 | |
| 1211 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1212 | if (enumerator & VK_QUERY_CONTROL_PRECISE_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 1213 | strings.push_back("VK_QUERY_CONTROL_PRECISE_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1214 | } |
| 1215 | |
| 1216 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1217 | for (auto const &string : strings) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1218 | enumeratorString += string; |
| 1219 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1220 | if (string != strings.back()) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1221 | enumeratorString += '|'; |
| 1222 | } |
| 1223 | } |
| 1224 | |
| 1225 | return enumeratorString; |
| 1226 | } |
| 1227 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1228 | static const int MaxParamCheckerStringLength = 256; |
| 1229 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 1230 | 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] | 1231 | const char *validateString) { |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1232 | assert(apiName != nullptr); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1233 | assert(validateString != nullptr); |
| 1234 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1235 | bool skip_call = false; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1236 | |
| 1237 | VkStringErrorFlags result = vk_string_validate(MaxParamCheckerStringLength, validateString); |
| 1238 | |
| 1239 | if (result == VK_STRING_ERROR_NONE) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1240 | return skip_call; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1241 | } else if (result & VK_STRING_ERROR_LENGTH) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 1242 | |
| 1243 | skip_call = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 1244 | INVALID_USAGE, LayerName, "%s: string %s exceeds max length %d", apiName, stringName.get_name().c_str(), |
| 1245 | MaxParamCheckerStringLength); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1246 | } else if (result & VK_STRING_ERROR_BAD_DATA) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 1247 | skip_call = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 1248 | INVALID_USAGE, LayerName, "%s: string %s contains invalid characters or is badly formed", apiName, |
| 1249 | stringName.get_name().c_str()); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1250 | } |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1251 | return skip_call; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1252 | } |
| 1253 | |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1254 | static bool validate_queue_family_index(layer_data *device_data, const char *function_name, const char *parameter_name, |
| 1255 | uint32_t index) { |
| 1256 | assert(device_data != nullptr); |
| 1257 | debug_report_data *report_data = device_data->report_data; |
| 1258 | bool skip_call = false; |
| 1259 | |
| 1260 | if (index == VK_QUEUE_FAMILY_IGNORED) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1261 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 1262 | "%s: %s cannot be VK_QUEUE_FAMILY_IGNORED.", function_name, parameter_name); |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1263 | } else { |
| 1264 | const auto &queue_data = device_data->queueFamilyIndexMap.find(index); |
| 1265 | if (queue_data == device_data->queueFamilyIndexMap.end()) { |
| 1266 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1267 | LayerName, "%s: %s (%d) must be one of the indices specified when the device was created, via " |
| 1268 | "the VkDeviceQueueCreateInfo structure.", |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1269 | function_name, parameter_name, index); |
| 1270 | return false; |
| 1271 | } |
| 1272 | } |
| 1273 | |
| 1274 | return skip_call; |
| 1275 | } |
| 1276 | |
| 1277 | static bool validate_queue_family_indices(layer_data *device_data, const char *function_name, const char *parameter_name, |
| 1278 | const uint32_t count, const uint32_t *indices) { |
| 1279 | assert(device_data != nullptr); |
| 1280 | debug_report_data *report_data = device_data->report_data; |
| 1281 | bool skip_call = false; |
| 1282 | |
| 1283 | if (indices != nullptr) { |
| 1284 | for (uint32_t i = 0; i < count; i++) { |
| 1285 | if (indices[i] == VK_QUEUE_FAMILY_IGNORED) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1286 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 1287 | 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] | 1288 | } else { |
| 1289 | const auto &queue_data = device_data->queueFamilyIndexMap.find(indices[i]); |
| 1290 | if (queue_data == device_data->queueFamilyIndexMap.end()) { |
| 1291 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1292 | LayerName, "%s: %s[%d] (%d) must be one of the indices specified when the device was " |
| 1293 | "created, via the VkDeviceQueueCreateInfo structure.", |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1294 | function_name, parameter_name, i, indices[i]); |
| 1295 | return false; |
| 1296 | } |
| 1297 | } |
| 1298 | } |
| 1299 | } |
| 1300 | |
| 1301 | return skip_call; |
| 1302 | } |
| 1303 | |
Mark Lobodzinski | 7d80ef6 | 2016-08-15 16:22:50 -0600 | [diff] [blame] | 1304 | static void CheckInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance); |
| 1305 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1306 | VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 1307 | VkInstance *pInstance) { |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1308 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1309 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1310 | VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1311 | assert(chain_info != nullptr); |
| 1312 | assert(chain_info->u.pLayerInfo != nullptr); |
| 1313 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1314 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 1315 | PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)fpGetInstanceProcAddr(NULL, "vkCreateInstance"); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1316 | if (fpCreateInstance == NULL) { |
| 1317 | return VK_ERROR_INITIALIZATION_FAILED; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1318 | } |
| 1319 | |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1320 | // Advance the link info for the next element on the chain |
| 1321 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 1322 | |
| 1323 | result = fpCreateInstance(pCreateInfo, pAllocator, pInstance); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1324 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1325 | if (result == VK_SUCCESS) { |
| 1326 | layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map); |
| 1327 | assert(my_instance_data != nullptr); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1328 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1329 | VkLayerInstanceDispatchTable *pTable = initInstanceTable(*pInstance, fpGetInstanceProcAddr, pc_instance_table_map); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1330 | |
Chia-I Wu | a570b7c | 2016-05-16 07:48:14 +0800 | [diff] [blame] | 1331 | my_instance_data->instance = *pInstance; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1332 | my_instance_data->report_data = debug_report_create_instance(pTable, *pInstance, pCreateInfo->enabledExtensionCount, |
| 1333 | pCreateInfo->ppEnabledExtensionNames); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1334 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1335 | // Look for one or more debug report create info structures |
| 1336 | // and setup a callback(s) for each one found. |
| 1337 | if (!layer_copy_tmp_callbacks(pCreateInfo->pNext, &my_instance_data->num_tmp_callbacks, |
| 1338 | &my_instance_data->tmp_dbg_create_infos, &my_instance_data->tmp_callbacks)) { |
| 1339 | if (my_instance_data->num_tmp_callbacks > 0) { |
| 1340 | // Setup the temporary callback(s) here to catch early issues: |
| 1341 | if (layer_enable_tmp_callbacks(my_instance_data->report_data, my_instance_data->num_tmp_callbacks, |
| 1342 | my_instance_data->tmp_dbg_create_infos, my_instance_data->tmp_callbacks)) { |
| 1343 | // Failure of setting up one or more of the callback. |
| 1344 | // Therefore, clean up and don't use those callbacks: |
| 1345 | layer_free_tmp_callbacks(my_instance_data->tmp_dbg_create_infos, my_instance_data->tmp_callbacks); |
| 1346 | my_instance_data->num_tmp_callbacks = 0; |
| 1347 | } |
| 1348 | } |
| 1349 | } |
| 1350 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1351 | init_parameter_validation(my_instance_data, pAllocator); |
Mark Lobodzinski | 7d80ef6 | 2016-08-15 16:22:50 -0600 | [diff] [blame] | 1352 | CheckInstanceRegisterExtensions(pCreateInfo, *pInstance); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1353 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1354 | // Ordinarily we'd check these before calling down the chain, but none of the layer |
| 1355 | // support is in place until now, if we survive we can report the issue now. |
| 1356 | parameter_validation_vkCreateInstance(my_instance_data->report_data, pCreateInfo, pAllocator, pInstance); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1357 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1358 | if (pCreateInfo->pApplicationInfo) { |
| 1359 | if (pCreateInfo->pApplicationInfo->pApplicationName) { |
| 1360 | validate_string(my_instance_data->report_data, "vkCreateInstance", |
| 1361 | "pCreateInfo->VkApplicationInfo->pApplicationName", |
| 1362 | pCreateInfo->pApplicationInfo->pApplicationName); |
| 1363 | } |
Courtney Goeltzenleuchter | 842691b | 2016-02-10 14:00:52 -0700 | [diff] [blame] | 1364 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1365 | if (pCreateInfo->pApplicationInfo->pEngineName) { |
| 1366 | validate_string(my_instance_data->report_data, "vkCreateInstance", "pCreateInfo->VkApplicationInfo->pEngineName", |
| 1367 | pCreateInfo->pApplicationInfo->pEngineName); |
| 1368 | } |
Courtney Goeltzenleuchter | 41c5c4b | 2016-02-10 15:13:55 -0700 | [diff] [blame] | 1369 | } |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1370 | |
| 1371 | // Disable the tmp callbacks: |
| 1372 | if (my_instance_data->num_tmp_callbacks > 0) { |
| 1373 | layer_disable_tmp_callbacks(my_instance_data->report_data, my_instance_data->num_tmp_callbacks, |
| 1374 | my_instance_data->tmp_callbacks); |
| 1375 | } |
Courtney Goeltzenleuchter | 842691b | 2016-02-10 14:00:52 -0700 | [diff] [blame] | 1376 | } |
| 1377 | |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1378 | return result; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1379 | } |
| 1380 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1381 | VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1382 | // Grab the key before the instance is destroyed. |
| 1383 | dispatch_key key = get_dispatch_key(instance); |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1384 | bool skip_call = false; |
Courtney Goeltzenleuchter | d29f4f0 | 2015-10-05 15:59:45 -0600 | [diff] [blame] | 1385 | layer_data *my_data = get_my_data_ptr(key, layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1386 | assert(my_data != NULL); |
| 1387 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1388 | // Enable the temporary callback(s) here to catch vkDestroyInstance issues: |
| 1389 | bool callback_setup = false; |
| 1390 | if (my_data->num_tmp_callbacks > 0) { |
| 1391 | if (!layer_enable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_dbg_create_infos, |
| 1392 | my_data->tmp_callbacks)) { |
| 1393 | callback_setup = true; |
| 1394 | } |
| 1395 | } |
| 1396 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1397 | skip_call |= parameter_validation_vkDestroyInstance(my_data->report_data, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1398 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1399 | // Disable and cleanup the temporary callback(s): |
| 1400 | if (callback_setup) { |
| 1401 | layer_disable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_callbacks); |
| 1402 | } |
| 1403 | if (my_data->num_tmp_callbacks > 0) { |
| 1404 | layer_free_tmp_callbacks(my_data->tmp_dbg_create_infos, my_data->tmp_callbacks); |
| 1405 | my_data->num_tmp_callbacks = 0; |
| 1406 | } |
| 1407 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1408 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1409 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1410 | pTable->DestroyInstance(instance, pAllocator); |
| 1411 | |
| 1412 | // Clean up logging callback, if any |
| 1413 | while (my_data->logging_callback.size() > 0) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1414 | VkDebugReportCallbackEXT callback = my_data->logging_callback.back(); |
| 1415 | layer_destroy_msg_callback(my_data->report_data, callback, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1416 | my_data->logging_callback.pop_back(); |
| 1417 | } |
| 1418 | |
| 1419 | layer_debug_report_destroy_instance(mid(instance)); |
| 1420 | layer_data_map.erase(pTable); |
| 1421 | |
| 1422 | pc_instance_table_map.erase(key); |
Tony Barbour | 24edb7c | 2016-03-22 13:23:24 -0600 | [diff] [blame] | 1423 | layer_data_map.erase(key); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1424 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1425 | } |
| 1426 | |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 1427 | VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, |
| 1428 | VkPhysicalDevice *pPhysicalDevices) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1429 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1430 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1431 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1432 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1433 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1434 | skip_call |= parameter_validation_vkEnumeratePhysicalDevices(my_data->report_data, pPhysicalDeviceCount, pPhysicalDevices); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1435 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1436 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1437 | result = get_dispatch_table(pc_instance_table_map, instance) |
| 1438 | ->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1439 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1440 | validate_result(my_data->report_data, "vkEnumeratePhysicalDevices", result); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 1441 | if ((result == VK_SUCCESS) && (NULL != pPhysicalDevices)) { |
| 1442 | for (uint32_t i = 0; i < *pPhysicalDeviceCount; i++) { |
| 1443 | layer_data *phy_dev_data = get_my_data_ptr(get_dispatch_key(pPhysicalDevices[i]), layer_data_map); |
| 1444 | // Save the supported features for each physical device |
| 1445 | VkLayerInstanceDispatchTable *disp_table = get_dispatch_table(pc_instance_table_map, pPhysicalDevices[i]); |
| 1446 | disp_table->GetPhysicalDeviceFeatures(pPhysicalDevices[i], &(phy_dev_data->physical_device_features)); |
| 1447 | } |
| 1448 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1449 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1450 | return result; |
| 1451 | } |
| 1452 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1453 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) { |
| 1454 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1455 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1456 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1457 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1458 | skip_call |= parameter_validation_vkGetPhysicalDeviceFeatures(my_data->report_data, pFeatures); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1459 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1460 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1461 | get_dispatch_table(pc_instance_table_map, physicalDevice)->GetPhysicalDeviceFeatures(physicalDevice, pFeatures); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1462 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1463 | } |
| 1464 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1465 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 1466 | VkFormatProperties *pFormatProperties) { |
| 1467 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1468 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1469 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1470 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1471 | skip_call |= parameter_validation_vkGetPhysicalDeviceFormatProperties(my_data->report_data, format, pFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1472 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1473 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1474 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1475 | ->GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1476 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1477 | } |
| 1478 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1479 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 1480 | VkImageType type, VkImageTiling tiling, |
| 1481 | VkImageUsageFlags usage, VkImageCreateFlags flags, |
| 1482 | VkImageFormatProperties *pImageFormatProperties) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1483 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1484 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1485 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1486 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1487 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1488 | skip_call |= parameter_validation_vkGetPhysicalDeviceImageFormatProperties(my_data->report_data, format, type, tiling, usage, |
| 1489 | flags, pImageFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1490 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1491 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1492 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1493 | ->GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, |
| 1494 | pImageFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1495 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1496 | validate_result(my_data->report_data, "vkGetPhysicalDeviceImageFormatProperties", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1497 | } |
Chia-I Wu | 1724104 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 1498 | |
| 1499 | return result; |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1500 | } |
| 1501 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1502 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) { |
| 1503 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1504 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1505 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1506 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1507 | skip_call |= parameter_validation_vkGetPhysicalDeviceProperties(my_data->report_data, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1508 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1509 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1510 | get_dispatch_table(pc_instance_table_map, physicalDevice)->GetPhysicalDeviceProperties(physicalDevice, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1511 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1512 | } |
| 1513 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1514 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, |
| 1515 | uint32_t *pQueueFamilyPropertyCount, |
| 1516 | VkQueueFamilyProperties *pQueueFamilyProperties) { |
| 1517 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1518 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1519 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1520 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1521 | skip_call |= parameter_validation_vkGetPhysicalDeviceQueueFamilyProperties(my_data->report_data, pQueueFamilyPropertyCount, |
| 1522 | pQueueFamilyProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1523 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1524 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1525 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1526 | ->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1527 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1528 | } |
| 1529 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1530 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, |
| 1531 | VkPhysicalDeviceMemoryProperties *pMemoryProperties) { |
| 1532 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1533 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1534 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1535 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1536 | skip_call |= parameter_validation_vkGetPhysicalDeviceMemoryProperties(my_data->report_data, pMemoryProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1537 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1538 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1539 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1540 | ->GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1541 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1542 | } |
| 1543 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1544 | void validateDeviceCreateInfo(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
| 1545 | const std::vector<VkQueueFamilyProperties> properties) { |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 1546 | std::unordered_set<uint32_t> set; |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1547 | |
| 1548 | if ((pCreateInfo != nullptr) && (pCreateInfo->pQueueCreateInfos != nullptr)) { |
| 1549 | for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { |
| 1550 | if (set.count(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex)) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1551 | log_msg(mdd(physicalDevice), 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] | 1552 | INVALID_USAGE, LayerName, |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1553 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueFamilyIndex, is not unique within this " |
| 1554 | "structure.", |
| 1555 | i); |
| 1556 | } else { |
| 1557 | set.insert(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex); |
Michael Lentine | fa71bd5 | 2016-01-27 12:50:30 -0600 | [diff] [blame] | 1558 | } |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1559 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1560 | if (pCreateInfo->pQueueCreateInfos[i].pQueuePriorities != nullptr) { |
| 1561 | for (uint32_t j = 0; j < pCreateInfo->pQueueCreateInfos[i].queueCount; ++j) { |
| 1562 | if ((pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j] < 0.f) || |
| 1563 | (pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j] > 1.f)) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1564 | log_msg(mdd(physicalDevice), 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] | 1565 | __LINE__, INVALID_USAGE, LayerName, |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1566 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->pQueuePriorities[%d], must be " |
| 1567 | "between 0 and 1. Actual value is %f", |
| 1568 | i, j, pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j]); |
| 1569 | } |
| 1570 | } |
| 1571 | } |
| 1572 | |
| 1573 | if (pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex >= properties.size()) { |
| 1574 | log_msg( |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1575 | mdd(physicalDevice), 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] | 1576 | INVALID_USAGE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1577 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueFamilyIndex cannot be more than the number " |
| 1578 | "of queue families.", |
| 1579 | i); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1580 | } else if (pCreateInfo->pQueueCreateInfos[i].queueCount > |
| 1581 | properties[pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex].queueCount) { |
| 1582 | log_msg( |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1583 | mdd(physicalDevice), 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] | 1584 | INVALID_USAGE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1585 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueCount cannot be more than the number of " |
| 1586 | "queues for the given family index.", |
| 1587 | i); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1588 | } |
Michael Lentine | 774704f | 2016-01-27 13:36:46 -0600 | [diff] [blame] | 1589 | } |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 1590 | } |
| 1591 | } |
| 1592 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1593 | static void CheckInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1594 | VkLayerInstanceDispatchTable *dispatch_table = get_dispatch_table(pc_instance_table_map, instance); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1595 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1596 | instance_extension_map[dispatch_table] = {}; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1597 | |
| 1598 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
| 1599 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1600 | instance_extension_map[dispatch_table].wsi_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1601 | } |
| 1602 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 1603 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1604 | instance_extension_map[dispatch_table].xlib_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1605 | } |
| 1606 | #endif |
| 1607 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 1608 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1609 | instance_extension_map[dispatch_table].xcb_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1610 | } |
| 1611 | #endif |
| 1612 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 1613 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1614 | instance_extension_map[dispatch_table].wayland_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1615 | } |
| 1616 | #endif |
| 1617 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 1618 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1619 | instance_extension_map[dispatch_table].mir_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1620 | } |
| 1621 | #endif |
| 1622 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 1623 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1624 | instance_extension_map[dispatch_table].android_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1625 | } |
| 1626 | #endif |
| 1627 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 1628 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1629 | instance_extension_map[dispatch_table].win32_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1630 | } |
| 1631 | #endif |
| 1632 | } |
| 1633 | } |
| 1634 | |
| 1635 | static void CheckDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, VkDevice device) { |
| 1636 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1637 | device_data->wsi_enabled = false; |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 1638 | device_data->wsi_display_swapchain_enabled = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1639 | |
| 1640 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
| 1641 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0) { |
| 1642 | device_data->wsi_enabled = true; |
| 1643 | } |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 1644 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME) == 0) { |
| 1645 | device_data->wsi_display_swapchain_enabled = true; |
| 1646 | } |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1647 | } |
| 1648 | } |
| 1649 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1650 | void storeCreateDeviceData(VkDevice device, const VkDeviceCreateInfo *pCreateInfo) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1651 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1652 | |
| 1653 | if ((pCreateInfo != nullptr) && (pCreateInfo->pQueueCreateInfos != nullptr)) { |
| 1654 | for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { |
| 1655 | my_device_data->queueFamilyIndexMap.insert( |
| 1656 | std::make_pair(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex, pCreateInfo->pQueueCreateInfos[i].queueCount)); |
| 1657 | } |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1658 | } |
| 1659 | } |
| 1660 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1661 | VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1662 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { |
Courtney Goeltzenleuchter | bafcdf3 | 2015-09-08 17:42:57 -0600 | [diff] [blame] | 1663 | /* |
Courtney Goeltzenleuchter | bafcdf3 | 2015-09-08 17:42:57 -0600 | [diff] [blame] | 1664 | * NOTE: We do not validate physicalDevice or any dispatchable |
| 1665 | * object as the first parameter. We couldn't get here if it was wrong! |
| 1666 | */ |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1667 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1668 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1669 | bool skip_call = false; |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1670 | layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1671 | assert(my_instance_data != nullptr); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1672 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1673 | skip_call |= parameter_validation_vkCreateDevice(my_instance_data->report_data, pCreateInfo, pAllocator, pDevice); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1674 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1675 | if (pCreateInfo != NULL) { |
| 1676 | if ((pCreateInfo->enabledLayerCount > 0) && (pCreateInfo->ppEnabledLayerNames != NULL)) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 1677 | for (size_t i = 0; i < pCreateInfo->enabledLayerCount; i++) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1678 | skip_call |= validate_string(my_instance_data->report_data, "vkCreateDevice", "pCreateInfo->ppEnabledLayerNames", |
| 1679 | pCreateInfo->ppEnabledLayerNames[i]); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1680 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1681 | } |
Michael Lentine | 774704f | 2016-01-27 13:36:46 -0600 | [diff] [blame] | 1682 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1683 | if ((pCreateInfo->enabledExtensionCount > 0) && (pCreateInfo->ppEnabledExtensionNames != NULL)) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 1684 | for (size_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1685 | skip_call |= validate_string(my_instance_data->report_data, "vkCreateDevice", |
| 1686 | "pCreateInfo->ppEnabledExtensionNames", pCreateInfo->ppEnabledExtensionNames[i]); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1687 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1688 | } |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1689 | } |
| 1690 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1691 | if (!skip_call) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1692 | VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1693 | assert(chain_info != nullptr); |
| 1694 | assert(chain_info->u.pLayerInfo != nullptr); |
| 1695 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1696 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 1697 | PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; |
Chia-I Wu | a570b7c | 2016-05-16 07:48:14 +0800 | [diff] [blame] | 1698 | PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(my_instance_data->instance, "vkCreateDevice"); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1699 | if (fpCreateDevice == NULL) { |
| 1700 | return VK_ERROR_INITIALIZATION_FAILED; |
| 1701 | } |
| 1702 | |
| 1703 | // Advance the link info for the next element on the chain |
| 1704 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 1705 | |
| 1706 | result = fpCreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1707 | |
| 1708 | validate_result(my_instance_data->report_data, "vkCreateDevice", result); |
| 1709 | |
| 1710 | if (result == VK_SUCCESS) { |
| 1711 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map); |
| 1712 | assert(my_device_data != nullptr); |
| 1713 | |
| 1714 | my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice); |
| 1715 | initDeviceTable(*pDevice, fpGetDeviceProcAddr, pc_device_table_map); |
| 1716 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1717 | CheckDeviceRegisterExtensions(pCreateInfo, *pDevice); |
| 1718 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1719 | uint32_t count; |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 1720 | VkLayerInstanceDispatchTable *instance_dispatch_table = get_dispatch_table(pc_instance_table_map, physicalDevice); |
| 1721 | instance_dispatch_table->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, nullptr); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1722 | std::vector<VkQueueFamilyProperties> properties(count); |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 1723 | instance_dispatch_table->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, &properties[0]); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1724 | |
| 1725 | validateDeviceCreateInfo(physicalDevice, pCreateInfo, properties); |
| 1726 | storeCreateDeviceData(*pDevice, pCreateInfo); |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 1727 | |
| 1728 | // Query and save physical device limits for this device |
| 1729 | VkPhysicalDeviceProperties device_properties = {}; |
| 1730 | instance_dispatch_table->GetPhysicalDeviceProperties(physicalDevice, &device_properties); |
| 1731 | memcpy(&my_device_data->device_limits, &device_properties.limits, sizeof(VkPhysicalDeviceLimits)); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 1732 | my_device_data->physical_device = physicalDevice; |
Mark Lobodzinski | 7bdd9f2 | 2016-08-09 13:41:09 -0600 | [diff] [blame] | 1733 | |
| 1734 | // Save app-enabled features in this device's layer_data structure |
| 1735 | if (pCreateInfo->pEnabledFeatures) { |
| 1736 | my_device_data->physical_device_features = *pCreateInfo->pEnabledFeatures; |
| 1737 | } else { |
| 1738 | memset(&my_device_data->physical_device_features, 0, sizeof(VkPhysicalDeviceFeatures)); |
| 1739 | } |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1740 | } |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1741 | } |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 1742 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1743 | return result; |
| 1744 | } |
| 1745 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1746 | VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1747 | dispatch_key key = get_dispatch_key(device); |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1748 | bool skip_call = false; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1749 | layer_data *my_data = get_my_data_ptr(key, layer_data_map); |
| 1750 | assert(my_data != NULL); |
| 1751 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1752 | skip_call |= parameter_validation_vkDestroyDevice(my_data->report_data, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1753 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1754 | if (!skip_call) { |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1755 | layer_debug_report_destroy_device(device); |
| 1756 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1757 | #if DISPATCH_MAP_DEBUG |
Mark Mueller | aab3650 | 2016-05-03 13:17:29 -0600 | [diff] [blame] | 1758 | fprintf(stderr, "Device: 0x%p, key: 0x%p\n", device, key); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1759 | #endif |
| 1760 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1761 | get_dispatch_table(pc_device_table_map, device)->DestroyDevice(device, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1762 | pc_device_table_map.erase(key); |
Tony Barbour | d4eb06d | 2016-03-29 15:14:59 -0600 | [diff] [blame] | 1763 | layer_data_map.erase(key); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1764 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1765 | } |
| 1766 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1767 | bool PreGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1768 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1769 | assert(my_device_data != nullptr); |
| 1770 | |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1771 | validate_queue_family_index(my_device_data, "vkGetDeviceQueue", "queueFamilyIndex", queueFamilyIndex); |
Mark Lobodzinski | f20f094 | 2016-03-22 10:07:26 -0600 | [diff] [blame] | 1772 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1773 | const auto &queue_data = my_device_data->queueFamilyIndexMap.find(queueFamilyIndex); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1774 | if (queue_data->second <= queueIndex) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1775 | log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1776 | LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1777 | "VkGetDeviceQueue parameter, uint32_t queueIndex %d, must be less than the number of queues given when the device " |
| 1778 | "was created.", |
| 1779 | queueIndex); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1780 | return false; |
| 1781 | } |
| 1782 | return true; |
| 1783 | } |
| 1784 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1785 | VKAPI_ATTR void VKAPI_CALL GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) { |
| 1786 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1787 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1788 | assert(my_data != NULL); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1789 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1790 | skip_call |= parameter_validation_vkGetDeviceQueue(my_data->report_data, queueFamilyIndex, queueIndex, pQueue); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1791 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1792 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1793 | PreGetDeviceQueue(device, queueFamilyIndex, queueIndex); |
| 1794 | |
| 1795 | get_dispatch_table(pc_device_table_map, device)->GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1796 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1797 | } |
| 1798 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1799 | 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] | 1800 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1801 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1802 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1803 | assert(my_data != NULL); |
| 1804 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1805 | skip_call |= parameter_validation_vkQueueSubmit(my_data->report_data, submitCount, pSubmits, fence); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1806 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1807 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1808 | result = get_dispatch_table(pc_device_table_map, queue)->QueueSubmit(queue, submitCount, pSubmits, fence); |
| 1809 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1810 | validate_result(my_data->report_data, "vkQueueSubmit", result); |
Courtney Goeltzenleuchter | 646b907 | 2015-10-20 18:04:07 -0600 | [diff] [blame] | 1811 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1812 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1813 | return result; |
| 1814 | } |
| 1815 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1816 | VKAPI_ATTR VkResult VKAPI_CALL QueueWaitIdle(VkQueue queue) { |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1817 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map); |
| 1818 | assert(my_data != NULL); |
| 1819 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1820 | VkResult result = get_dispatch_table(pc_device_table_map, queue)->QueueWaitIdle(queue); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1821 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1822 | validate_result(my_data->report_data, "vkQueueWaitIdle", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1823 | |
| 1824 | return result; |
| 1825 | } |
| 1826 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1827 | VKAPI_ATTR VkResult VKAPI_CALL DeviceWaitIdle(VkDevice device) { |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1828 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1829 | assert(my_data != NULL); |
| 1830 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1831 | VkResult result = get_dispatch_table(pc_device_table_map, device)->DeviceWaitIdle(device); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1832 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1833 | validate_result(my_data->report_data, "vkDeviceWaitIdle", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1834 | |
| 1835 | return result; |
| 1836 | } |
| 1837 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1838 | VKAPI_ATTR VkResult VKAPI_CALL AllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1839 | const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1840 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1841 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1842 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1843 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1844 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1845 | skip_call |= parameter_validation_vkAllocateMemory(my_data->report_data, pAllocateInfo, pAllocator, pMemory); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1846 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1847 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1848 | result = get_dispatch_table(pc_device_table_map, device)->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory); |
| 1849 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1850 | validate_result(my_data->report_data, "vkAllocateMemory", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1851 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1852 | |
| 1853 | return result; |
| 1854 | } |
| 1855 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1856 | VKAPI_ATTR void VKAPI_CALL FreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator) { |
| 1857 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1858 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1859 | assert(my_data != NULL); |
| 1860 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1861 | skip_call |= parameter_validation_vkFreeMemory(my_data->report_data, memory, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1862 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1863 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1864 | get_dispatch_table(pc_device_table_map, device)->FreeMemory(device, memory, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1865 | } |
| 1866 | } |
| 1867 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1868 | VKAPI_ATTR VkResult VKAPI_CALL MapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, |
| 1869 | VkMemoryMapFlags flags, void **ppData) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1870 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1871 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1872 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1873 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1874 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1875 | skip_call |= parameter_validation_vkMapMemory(my_data->report_data, memory, offset, size, flags, ppData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1876 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1877 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1878 | result = get_dispatch_table(pc_device_table_map, device)->MapMemory(device, memory, offset, size, flags, ppData); |
| 1879 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1880 | validate_result(my_data->report_data, "vkMapMemory", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1881 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1882 | |
| 1883 | return result; |
| 1884 | } |
| 1885 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1886 | VKAPI_ATTR void VKAPI_CALL UnmapMemory(VkDevice device, VkDeviceMemory memory) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1887 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1888 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1889 | assert(my_data != NULL); |
| 1890 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1891 | skip_call |= parameter_validation_vkUnmapMemory(my_data->report_data, memory); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1892 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1893 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1894 | get_dispatch_table(pc_device_table_map, device)->UnmapMemory(device, memory); |
| 1895 | } |
| 1896 | } |
| 1897 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1898 | VKAPI_ATTR VkResult VKAPI_CALL FlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, |
| 1899 | const VkMappedMemoryRange *pMemoryRanges) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1900 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1901 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1902 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1903 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1904 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1905 | skip_call |= parameter_validation_vkFlushMappedMemoryRanges(my_data->report_data, memoryRangeCount, pMemoryRanges); |
Tony Barbour | b125054 | 2015-04-16 19:23:13 -0600 | [diff] [blame] | 1906 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1907 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1908 | result = get_dispatch_table(pc_device_table_map, device)->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
| 1909 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1910 | validate_result(my_data->report_data, "vkFlushMappedMemoryRanges", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1911 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1912 | |
Courtney Goeltzenleuchter | f69f8a2 | 2015-04-29 17:16:21 -0600 | [diff] [blame] | 1913 | return result; |
| 1914 | } |
| 1915 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1916 | VKAPI_ATTR VkResult VKAPI_CALL InvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, |
| 1917 | const VkMappedMemoryRange *pMemoryRanges) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1918 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1919 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1920 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1921 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1922 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1923 | skip_call |= parameter_validation_vkInvalidateMappedMemoryRanges(my_data->report_data, memoryRangeCount, pMemoryRanges); |
Courtney Goeltzenleuchter | f69f8a2 | 2015-04-29 17:16:21 -0600 | [diff] [blame] | 1924 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1925 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1926 | result = |
| 1927 | get_dispatch_table(pc_device_table_map, device)->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1928 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1929 | validate_result(my_data->report_data, "vkInvalidateMappedMemoryRanges", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1930 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1931 | |
Tony Barbour | b125054 | 2015-04-16 19:23:13 -0600 | [diff] [blame] | 1932 | return result; |
| 1933 | } |
| 1934 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1935 | VKAPI_ATTR void VKAPI_CALL GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, |
| 1936 | VkDeviceSize *pCommittedMemoryInBytes) { |
| 1937 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1938 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1939 | assert(my_data != NULL); |
Courtney Goeltzenleuchter | fb71f22 | 2015-07-09 21:57:28 -0600 | [diff] [blame] | 1940 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1941 | skip_call |= parameter_validation_vkGetDeviceMemoryCommitment(my_data->report_data, memory, pCommittedMemoryInBytes); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1942 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1943 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1944 | get_dispatch_table(pc_device_table_map, device)->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1945 | } |
Courtney Goeltzenleuchter | fb71f22 | 2015-07-09 21:57:28 -0600 | [diff] [blame] | 1946 | } |
| 1947 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1948 | VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, |
| 1949 | VkDeviceSize memoryOffset) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1950 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1951 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1952 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1953 | assert(my_data != NULL); |
| 1954 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1955 | skip_call |= parameter_validation_vkBindBufferMemory(my_data->report_data, buffer, memory, memoryOffset); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1956 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1957 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1958 | result = get_dispatch_table(pc_device_table_map, device)->BindBufferMemory(device, buffer, memory, memoryOffset); |
| 1959 | |
| 1960 | validate_result(my_data->report_data, "vkBindBufferMemory", result); |
| 1961 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1962 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1963 | return result; |
| 1964 | } |
| 1965 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1966 | 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] | 1967 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1968 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1969 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1970 | assert(my_data != NULL); |
| 1971 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1972 | skip_call |= parameter_validation_vkBindImageMemory(my_data->report_data, image, memory, memoryOffset); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1973 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1974 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1975 | result = get_dispatch_table(pc_device_table_map, device)->BindImageMemory(device, image, memory, memoryOffset); |
| 1976 | |
| 1977 | validate_result(my_data->report_data, "vkBindImageMemory", result); |
| 1978 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1979 | |
| 1980 | return result; |
| 1981 | } |
| 1982 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1983 | VKAPI_ATTR void VKAPI_CALL GetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, |
| 1984 | VkMemoryRequirements *pMemoryRequirements) { |
| 1985 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1986 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1987 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1988 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1989 | skip_call |= parameter_validation_vkGetBufferMemoryRequirements(my_data->report_data, buffer, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1990 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1991 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1992 | get_dispatch_table(pc_device_table_map, device)->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1993 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1994 | } |
| 1995 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1996 | VKAPI_ATTR void VKAPI_CALL GetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements) { |
| 1997 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1998 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1999 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2000 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2001 | skip_call |= parameter_validation_vkGetImageMemoryRequirements(my_data->report_data, image, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2002 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2003 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2004 | get_dispatch_table(pc_device_table_map, device)->GetImageMemoryRequirements(device, image, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2005 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2006 | } |
| 2007 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2008 | bool PostGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pNumRequirements, |
| 2009 | VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { |
| 2010 | if (pSparseMemoryRequirements != nullptr) { |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 2011 | if ((pSparseMemoryRequirements->formatProperties.aspectMask & |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2012 | (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 2013 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 2014 | log_msg(mdd(device), 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] | 2015 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2016 | "vkGetImageSparseMemoryRequirements parameter, VkImageAspect " |
| 2017 | "pSparseMemoryRequirements->formatProperties.aspectMask, is an unrecognized enumerator"); |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 2018 | return false; |
| 2019 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2020 | } |
| 2021 | |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2022 | return true; |
| 2023 | } |
| 2024 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2025 | VKAPI_ATTR void VKAPI_CALL GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, |
| 2026 | VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { |
| 2027 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2028 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2029 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2030 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2031 | skip_call |= parameter_validation_vkGetImageSparseMemoryRequirements(my_data->report_data, image, pSparseMemoryRequirementCount, |
| 2032 | pSparseMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2033 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2034 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2035 | get_dispatch_table(pc_device_table_map, device) |
| 2036 | ->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2037 | |
| 2038 | PostGetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 2039 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2040 | } |
| 2041 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2042 | bool PostGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, |
| 2043 | VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, |
| 2044 | uint32_t *pNumProperties, VkSparseImageFormatProperties *pProperties) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2045 | if (pProperties != nullptr) { |
| 2046 | if ((pProperties->aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 2047 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 2048 | log_msg(mdd(physicalDevice), 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] | 2049 | LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2050 | "vkGetPhysicalDeviceSparseImageFormatProperties parameter, VkImageAspect pProperties->aspectMask, is an " |
| 2051 | "unrecognized enumerator"); |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 2052 | return false; |
| 2053 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2054 | } |
| 2055 | |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2056 | return true; |
| 2057 | } |
| 2058 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2059 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 2060 | VkImageType type, VkSampleCountFlagBits samples, |
| 2061 | VkImageUsageFlags usage, VkImageTiling tiling, |
| 2062 | uint32_t *pPropertyCount, |
| 2063 | VkSparseImageFormatProperties *pProperties) { |
| 2064 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2065 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2066 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2067 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2068 | skip_call |= parameter_validation_vkGetPhysicalDeviceSparseImageFormatProperties(my_data->report_data, format, type, samples, |
| 2069 | usage, tiling, pPropertyCount, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2070 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2071 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2072 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 2073 | ->GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, |
| 2074 | pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2075 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2076 | PostGetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, |
| 2077 | pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2078 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2079 | } |
| 2080 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2081 | VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, |
| 2082 | VkFence fence) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2083 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2084 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2085 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2086 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2087 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2088 | skip_call |= parameter_validation_vkQueueBindSparse(my_data->report_data, bindInfoCount, pBindInfo, fence); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2089 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2090 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2091 | result = get_dispatch_table(pc_device_table_map, queue)->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); |
| 2092 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2093 | validate_result(my_data->report_data, "vkQueueBindSparse", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2094 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2095 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 2096 | return result; |
| 2097 | } |
| 2098 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2099 | VKAPI_ATTR VkResult VKAPI_CALL CreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, |
| 2100 | const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2101 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2102 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2103 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2104 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2105 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2106 | skip_call |= parameter_validation_vkCreateFence(my_data->report_data, pCreateInfo, pAllocator, pFence); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2107 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2108 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2109 | result = get_dispatch_table(pc_device_table_map, device)->CreateFence(device, pCreateInfo, pAllocator, pFence); |
| 2110 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2111 | validate_result(my_data->report_data, "vkCreateFence", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2112 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2113 | |
| 2114 | return result; |
| 2115 | } |
| 2116 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2117 | VKAPI_ATTR void VKAPI_CALL DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2118 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2119 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2120 | assert(my_data != NULL); |
| 2121 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2122 | skip_call |= parameter_validation_vkDestroyFence(my_data->report_data, fence, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2123 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2124 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2125 | get_dispatch_table(pc_device_table_map, device)->DestroyFence(device, fence, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2126 | } |
| 2127 | } |
| 2128 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2129 | 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] | 2130 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2131 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2132 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2133 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2134 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2135 | skip_call |= parameter_validation_vkResetFences(my_data->report_data, fenceCount, pFences); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2136 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2137 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2138 | result = get_dispatch_table(pc_device_table_map, device)->ResetFences(device, fenceCount, pFences); |
| 2139 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2140 | validate_result(my_data->report_data, "vkResetFences", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2141 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2142 | |
| 2143 | return result; |
| 2144 | } |
| 2145 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2146 | VKAPI_ATTR VkResult VKAPI_CALL GetFenceStatus(VkDevice device, VkFence fence) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2147 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2148 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2149 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2150 | assert(my_data != NULL); |
| 2151 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2152 | skip_call |= parameter_validation_vkGetFenceStatus(my_data->report_data, fence); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2153 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2154 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2155 | result = get_dispatch_table(pc_device_table_map, device)->GetFenceStatus(device, fence); |
| 2156 | |
| 2157 | validate_result(my_data->report_data, "vkGetFenceStatus", result); |
| 2158 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2159 | |
| 2160 | return result; |
| 2161 | } |
| 2162 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2163 | VKAPI_ATTR VkResult VKAPI_CALL WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, |
| 2164 | uint64_t timeout) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2165 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2166 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2167 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2168 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2169 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2170 | skip_call |= parameter_validation_vkWaitForFences(my_data->report_data, fenceCount, pFences, waitAll, timeout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2171 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2172 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2173 | result = get_dispatch_table(pc_device_table_map, device)->WaitForFences(device, fenceCount, pFences, waitAll, timeout); |
| 2174 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2175 | validate_result(my_data->report_data, "vkWaitForFences", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2176 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2177 | |
| 2178 | return result; |
| 2179 | } |
| 2180 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2181 | VKAPI_ATTR VkResult VKAPI_CALL CreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2182 | const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2183 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2184 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2185 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2186 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2187 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2188 | skip_call |= parameter_validation_vkCreateSemaphore(my_data->report_data, pCreateInfo, pAllocator, pSemaphore); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2189 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2190 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2191 | result = get_dispatch_table(pc_device_table_map, device)->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore); |
| 2192 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2193 | validate_result(my_data->report_data, "vkCreateSemaphore", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2194 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2195 | |
| 2196 | return result; |
| 2197 | } |
| 2198 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2199 | VKAPI_ATTR void VKAPI_CALL DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator) { |
| 2200 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2201 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2202 | assert(my_data != NULL); |
| 2203 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2204 | skip_call |= parameter_validation_vkDestroySemaphore(my_data->report_data, semaphore, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2205 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2206 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2207 | get_dispatch_table(pc_device_table_map, device)->DestroySemaphore(device, semaphore, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2208 | } |
| 2209 | } |
| 2210 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2211 | VKAPI_ATTR VkResult VKAPI_CALL CreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, |
| 2212 | const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2213 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2214 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2215 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2216 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2217 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2218 | skip_call |= parameter_validation_vkCreateEvent(my_data->report_data, pCreateInfo, pAllocator, pEvent); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2219 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2220 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2221 | result = get_dispatch_table(pc_device_table_map, device)->CreateEvent(device, pCreateInfo, pAllocator, pEvent); |
| 2222 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2223 | validate_result(my_data->report_data, "vkCreateEvent", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2224 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2225 | |
| 2226 | return result; |
| 2227 | } |
| 2228 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2229 | VKAPI_ATTR void VKAPI_CALL DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2230 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2231 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2232 | assert(my_data != NULL); |
| 2233 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2234 | skip_call |= parameter_validation_vkDestroyEvent(my_data->report_data, event, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2235 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2236 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2237 | get_dispatch_table(pc_device_table_map, device)->DestroyEvent(device, event, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2238 | } |
| 2239 | } |
| 2240 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2241 | VKAPI_ATTR VkResult VKAPI_CALL GetEventStatus(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2242 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2243 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2244 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2245 | assert(my_data != NULL); |
| 2246 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2247 | skip_call |= parameter_validation_vkGetEventStatus(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2248 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2249 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2250 | result = get_dispatch_table(pc_device_table_map, device)->GetEventStatus(device, event); |
| 2251 | |
| 2252 | validate_result(my_data->report_data, "vkGetEventStatus", result); |
| 2253 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2254 | |
| 2255 | return result; |
| 2256 | } |
| 2257 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2258 | VKAPI_ATTR VkResult VKAPI_CALL SetEvent(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2259 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2260 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2261 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2262 | assert(my_data != NULL); |
| 2263 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2264 | skip_call |= parameter_validation_vkSetEvent(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2265 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2266 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2267 | result = get_dispatch_table(pc_device_table_map, device)->SetEvent(device, event); |
| 2268 | |
| 2269 | validate_result(my_data->report_data, "vkSetEvent", result); |
| 2270 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2271 | |
| 2272 | return result; |
| 2273 | } |
| 2274 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2275 | VKAPI_ATTR VkResult VKAPI_CALL ResetEvent(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2276 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2277 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2278 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2279 | assert(my_data != NULL); |
| 2280 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2281 | skip_call |= parameter_validation_vkResetEvent(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2282 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2283 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2284 | result = get_dispatch_table(pc_device_table_map, device)->ResetEvent(device, event); |
| 2285 | |
| 2286 | validate_result(my_data->report_data, "vkResetEvent", result); |
| 2287 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2288 | |
| 2289 | return result; |
| 2290 | } |
| 2291 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2292 | VKAPI_ATTR VkResult VKAPI_CALL CreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2293 | const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2294 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2295 | bool skip_call = false; |
| 2296 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2297 | assert(device_data != nullptr); |
| 2298 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2299 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2300 | skip_call |= parameter_validation_vkCreateQueryPool(device_data->report_data, pCreateInfo, pAllocator, pQueryPool); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2301 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2302 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2303 | if (pCreateInfo != nullptr) { |
| 2304 | // If queryType is VK_QUERY_TYPE_PIPELINE_STATISTICS, pipelineStatistics must be a valid combination of |
| 2305 | // VkQueryPipelineStatisticFlagBits values |
| 2306 | if ((pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS) && (pCreateInfo->pipelineStatistics != 0) && |
| 2307 | ((pCreateInfo->pipelineStatistics & (~AllVkQueryPipelineStatisticFlagBits)) != 0)) { |
| 2308 | skip_call |= |
| 2309 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2310 | UNRECOGNIZED_VALUE, LayerName, "vkCreateQueryPool: if pCreateInfo->queryType is " |
| 2311 | "VK_QUERY_TYPE_PIPELINE_STATISTICS, pCreateInfo->pipelineStatistics must be " |
| 2312 | "a valid combination of VkQueryPipelineStatisticFlagBits values"); |
| 2313 | } |
| 2314 | } |
| 2315 | |
| 2316 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2317 | result = get_dispatch_table(pc_device_table_map, device)->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); |
| 2318 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2319 | validate_result(report_data, "vkCreateQueryPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2320 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2321 | |
| 2322 | return result; |
| 2323 | } |
| 2324 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2325 | VKAPI_ATTR void VKAPI_CALL DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator) { |
| 2326 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2327 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2328 | assert(my_data != NULL); |
| 2329 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2330 | skip_call |= parameter_validation_vkDestroyQueryPool(my_data->report_data, queryPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2331 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2332 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2333 | get_dispatch_table(pc_device_table_map, device)->DestroyQueryPool(device, queryPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2334 | } |
| 2335 | } |
| 2336 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2337 | VKAPI_ATTR VkResult VKAPI_CALL GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, |
| 2338 | size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2339 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2340 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2341 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2342 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2343 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2344 | skip_call |= parameter_validation_vkGetQueryPoolResults(my_data->report_data, queryPool, firstQuery, queryCount, dataSize, |
| 2345 | pData, stride, flags); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2346 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2347 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2348 | result = get_dispatch_table(pc_device_table_map, device) |
| 2349 | ->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2350 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2351 | validate_result(my_data->report_data, "vkGetQueryPoolResults", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2352 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2353 | |
| 2354 | return result; |
| 2355 | } |
| 2356 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2357 | VKAPI_ATTR VkResult VKAPI_CALL CreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, |
| 2358 | const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2359 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2360 | bool skip_call = false; |
| 2361 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2362 | assert(device_data != nullptr); |
| 2363 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2364 | |
Karl Schultz | a9ef1e5 | 2016-10-06 17:53:48 -0600 | [diff] [blame] | 2365 | // TODO: Add check for VALIDATION_ERROR_00660 |
| 2366 | // TODO: Add check for VALIDATION_ERROR_00661 |
| 2367 | // TODO: Add check for VALIDATION_ERROR_00662 |
| 2368 | // TODO: Add check for VALIDATION_ERROR_00670 |
| 2369 | // TODO: Add check for VALIDATION_ERROR_00671 |
| 2370 | // TODO: Add check for VALIDATION_ERROR_00672 |
| 2371 | // TODO: Add check for VALIDATION_ERROR_00673 |
| 2372 | // TODO: Add check for VALIDATION_ERROR_00674 |
| 2373 | // TODO: Add check for VALIDATION_ERROR_00675 |
| 2374 | // TODO: Note that the above errors need to be generated from the next function, which is codegened. |
| 2375 | // TODO: Add check for VALIDATION_ERROR_00663 |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2376 | skip_call |= parameter_validation_vkCreateBuffer(report_data, pCreateInfo, pAllocator, pBuffer); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2377 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2378 | if (pCreateInfo != nullptr) { |
| 2379 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2380 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 2381 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 2382 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Karl Schultz | a9ef1e5 | 2016-10-06 17:53:48 -0600 | [diff] [blame] | 2383 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2384 | __LINE__, VALIDATION_ERROR_00665, LayerName, |
| 2385 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2386 | "pCreateInfo->queueFamilyIndexCount must be greater than 1. %s", |
| 2387 | validation_error_map[VALIDATION_ERROR_00665]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2388 | } |
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 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 2391 | // queueFamilyIndexCount uint32_t values |
| 2392 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
| 2393 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Karl Schultz | a9ef1e5 | 2016-10-06 17:53:48 -0600 | [diff] [blame] | 2394 | __LINE__, VALIDATION_ERROR_00664, LayerName, |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2395 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2396 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
Karl Schultz | a9ef1e5 | 2016-10-06 17:53:48 -0600 | [diff] [blame] | 2397 | "pCreateInfo->queueFamilyIndexCount uint32_t values. %s", |
| 2398 | validation_error_map[VALIDATION_ERROR_00664]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2399 | } |
| 2400 | |
| 2401 | // Ensure that the queue family indices were specified at device creation |
| 2402 | skip_call |= validate_queue_family_indices(device_data, "vkCreateBuffer", "pCreateInfo->pQueueFamilyIndices", |
| 2403 | pCreateInfo->queueFamilyIndexCount, pCreateInfo->pQueueFamilyIndices); |
| 2404 | } |
| 2405 | } |
| 2406 | |
| 2407 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2408 | result = get_dispatch_table(pc_device_table_map, device)->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); |
| 2409 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2410 | validate_result(report_data, "vkCreateBuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2411 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2412 | |
| 2413 | return result; |
| 2414 | } |
| 2415 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2416 | VKAPI_ATTR void VKAPI_CALL DestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator) { |
| 2417 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2418 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2419 | assert(my_data != NULL); |
| 2420 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2421 | skip_call |= parameter_validation_vkDestroyBuffer(my_data->report_data, buffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2422 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2423 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2424 | get_dispatch_table(pc_device_table_map, device)->DestroyBuffer(device, buffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2425 | } |
| 2426 | } |
| 2427 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2428 | VKAPI_ATTR VkResult VKAPI_CALL CreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, |
| 2429 | const VkAllocationCallbacks *pAllocator, VkBufferView *pView) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2430 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2431 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2432 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2433 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2434 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2435 | skip_call |= parameter_validation_vkCreateBufferView(my_data->report_data, pCreateInfo, pAllocator, pView); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2436 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2437 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2438 | result = get_dispatch_table(pc_device_table_map, device)->CreateBufferView(device, pCreateInfo, pAllocator, pView); |
| 2439 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2440 | validate_result(my_data->report_data, "vkCreateBufferView", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2441 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2442 | |
| 2443 | return result; |
| 2444 | } |
| 2445 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2446 | VKAPI_ATTR void VKAPI_CALL DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator) { |
| 2447 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2448 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2449 | assert(my_data != NULL); |
| 2450 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2451 | skip_call |= parameter_validation_vkDestroyBufferView(my_data->report_data, bufferView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2452 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2453 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2454 | get_dispatch_table(pc_device_table_map, device)->DestroyBufferView(device, bufferView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2455 | } |
| 2456 | } |
| 2457 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2458 | VKAPI_ATTR VkResult VKAPI_CALL CreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, |
| 2459 | const VkAllocationCallbacks *pAllocator, VkImage *pImage) { |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2460 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 2461 | bool skip_call = false; |
| 2462 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2463 | assert(device_data != nullptr); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2464 | debug_report_data *report_data = device_data->report_data; |
| 2465 | |
| 2466 | skip_call |= parameter_validation_vkCreateImage(report_data, pCreateInfo, pAllocator, pImage); |
| 2467 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2468 | if (pCreateInfo != nullptr) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2469 | // 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] | 2470 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2471 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 2472 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
| 2473 | skip_call |= |
| 2474 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2475 | INVALID_USAGE, LayerName, "vkCreateImage: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2476 | "pCreateInfo->queueFamilyIndexCount must be greater than 1"); |
| 2477 | } |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2478 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2479 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 2480 | // queueFamilyIndexCount uint32_t values |
| 2481 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
| 2482 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2483 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 2484 | "vkCreateImage: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2485 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
| 2486 | "pCreateInfo->queueFamilyIndexCount uint32_t values"); |
| 2487 | } |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2488 | |
| 2489 | skip_call |= validate_queue_family_indices(device_data, "vkCreateImage", "pCreateInfo->pQueueFamilyIndices", |
| 2490 | pCreateInfo->queueFamilyIndexCount, pCreateInfo->pQueueFamilyIndices); |
| 2491 | } |
| 2492 | |
| 2493 | // width, height, and depth members of extent must be greater than 0 |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2494 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.width", pCreateInfo->extent.width, 0u); |
| 2495 | skip_call |= |
| 2496 | ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.height", pCreateInfo->extent.height, 0u); |
| 2497 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.depth", pCreateInfo->extent.depth, 0u); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2498 | |
| 2499 | // mipLevels must be greater than 0 |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2500 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->mipLevels", pCreateInfo->mipLevels, 0u); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2501 | |
| 2502 | // arrayLayers must be greater than 0 |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2503 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->arrayLayers", pCreateInfo->arrayLayers, 0u); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2504 | |
| 2505 | // If imageType is VK_IMAGE_TYPE_1D, both extent.height and extent.depth must be 1 |
| 2506 | if ((pCreateInfo->imageType == VK_IMAGE_TYPE_1D) && (pCreateInfo->extent.height != 1) && (pCreateInfo->extent.depth != 1)) { |
| 2507 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2508 | LayerName, "vkCreateImage: if pCreateInfo->imageType is VK_IMAGE_TYPE_1D, both " |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2509 | "pCreateInfo->extent.height and pCreateInfo->extent.depth must be 1"); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2510 | } |
| 2511 | |
| 2512 | if (pCreateInfo->imageType == VK_IMAGE_TYPE_2D) { |
| 2513 | // If imageType is VK_IMAGE_TYPE_2D and flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, extent.width and |
| 2514 | // extent.height must be equal |
| 2515 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) && |
| 2516 | (pCreateInfo->extent.width != pCreateInfo->extent.height)) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2517 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2518 | LayerName, "vkCreateImage: if pCreateInfo->imageType is VK_IMAGE_TYPE_2D and " |
| 2519 | "pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, " |
| 2520 | "pCreateInfo->extent.width and pCreateInfo->extent.height must be equal"); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2521 | } |
| 2522 | |
| 2523 | if (pCreateInfo->extent.depth != 1) { |
| 2524 | skip_call |= |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2525 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2526 | "vkCreateImage: if pCreateInfo->imageType is VK_IMAGE_TYPE_2D, pCreateInfo->extent.depth must be 1"); |
| 2527 | } |
| 2528 | } |
| 2529 | |
| 2530 | // mipLevels must be less than or equal to floor(log2(max(extent.width,extent.height,extent.depth)))+1 |
| 2531 | uint32_t maxDim = std::max(std::max(pCreateInfo->extent.width, pCreateInfo->extent.height), pCreateInfo->extent.depth); |
| 2532 | if (pCreateInfo->mipLevels > (floor(log2(maxDim)) + 1)) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2533 | skip_call |= |
| 2534 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 2535 | "vkCreateImage: pCreateInfo->mipLevels must be less than or equal to " |
| 2536 | "floor(log2(max(pCreateInfo->extent.width, pCreateInfo->extent.height, pCreateInfo->extent.depth)))+1"); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2537 | } |
| 2538 | |
| 2539 | // If flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, it must also contain |
| 2540 | // VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
| 2541 | if (((pCreateInfo->flags & (VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT)) != 0) && |
| 2542 | ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) != VK_IMAGE_CREATE_SPARSE_BINDING_BIT)) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2543 | skip_call |= |
| 2544 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 2545 | "vkCreateImage: pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or " |
| 2546 | "VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, it must also contain VK_IMAGE_CREATE_SPARSE_BINDING_BIT"); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2547 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2548 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2549 | |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2550 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2551 | result = get_dispatch_table(pc_device_table_map, device)->CreateImage(device, pCreateInfo, pAllocator, pImage); |
| 2552 | |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2553 | validate_result(report_data, "vkCreateImage", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2554 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2555 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 2556 | return result; |
| 2557 | } |
| 2558 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2559 | VKAPI_ATTR void VKAPI_CALL DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2560 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2561 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2562 | assert(my_data != NULL); |
| 2563 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2564 | skip_call |= parameter_validation_vkDestroyImage(my_data->report_data, image, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2565 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2566 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2567 | get_dispatch_table(pc_device_table_map, device)->DestroyImage(device, image, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2568 | } |
| 2569 | } |
| 2570 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2571 | bool PreGetImageSubresourceLayout(VkDevice device, const VkImageSubresource *pSubresource) { |
| 2572 | if (pSubresource != nullptr) { |
| 2573 | if ((pSubresource->aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 2574 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 2575 | log_msg(mdd(device), 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] | 2576 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2577 | "vkGetImageSubresourceLayout parameter, VkImageAspect pSubresource->aspectMask, is an unrecognized enumerator"); |
| 2578 | return false; |
| 2579 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2580 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2581 | |
| 2582 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2583 | } |
| 2584 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2585 | VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, |
| 2586 | VkSubresourceLayout *pLayout) { |
| 2587 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2588 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2589 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2590 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2591 | skip_call |= parameter_validation_vkGetImageSubresourceLayout(my_data->report_data, image, pSubresource, pLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2592 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2593 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2594 | PreGetImageSubresourceLayout(device, pSubresource); |
| 2595 | |
| 2596 | get_dispatch_table(pc_device_table_map, device)->GetImageSubresourceLayout(device, image, pSubresource, pLayout); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2597 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2598 | } |
| 2599 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2600 | VKAPI_ATTR VkResult VKAPI_CALL CreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, |
| 2601 | const VkAllocationCallbacks *pAllocator, VkImageView *pView) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2602 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2603 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2604 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2605 | assert(my_data != NULL); |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2606 | debug_report_data *report_data = my_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2607 | |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2608 | skip_call |= parameter_validation_vkCreateImageView(report_data, pCreateInfo, pAllocator, pView); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2609 | |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2610 | if (pCreateInfo != nullptr) { |
| 2611 | 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] | 2612 | if ((pCreateInfo->subresourceRange.layerCount != 1) && |
| 2613 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2614 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2615 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_%dD, " |
| 2616 | "pCreateInfo->subresourceRange.layerCount must be 1", |
| 2617 | ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D) ? 1 : 2)); |
| 2618 | } |
| 2619 | } else if ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY) || |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2620 | (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_2D_ARRAY)) { |
| 2621 | if ((pCreateInfo->subresourceRange.layerCount < 1) && |
| 2622 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2623 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2624 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_%dD_ARRAY, " |
| 2625 | "pCreateInfo->subresourceRange.layerCount must be >= 1", |
| 2626 | ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY) ? 1 : 2)); |
| 2627 | } |
| 2628 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE) { |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2629 | if ((pCreateInfo->subresourceRange.layerCount != 6) && |
| 2630 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2631 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2632 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_CUBE, " |
| 2633 | "pCreateInfo->subresourceRange.layerCount must be 6"); |
| 2634 | } |
| 2635 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY) { |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2636 | if (((pCreateInfo->subresourceRange.layerCount == 0) || ((pCreateInfo->subresourceRange.layerCount % 6) != 0)) && |
| 2637 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2638 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2639 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_CUBE_ARRAY, " |
| 2640 | "pCreateInfo->subresourceRange.layerCount must be a multiple of 6"); |
| 2641 | } |
| 2642 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_3D) { |
| 2643 | if (pCreateInfo->subresourceRange.baseArrayLayer != 0) { |
| 2644 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2645 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_3D, " |
| 2646 | "pCreateInfo->subresourceRange.baseArrayLayer must be 0"); |
| 2647 | } |
| 2648 | |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2649 | if ((pCreateInfo->subresourceRange.layerCount != 1) && |
| 2650 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2651 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2652 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_3D, " |
| 2653 | "pCreateInfo->subresourceRange.layerCount must be 1"); |
| 2654 | } |
| 2655 | } |
| 2656 | } |
| 2657 | |
| 2658 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2659 | result = get_dispatch_table(pc_device_table_map, device)->CreateImageView(device, pCreateInfo, pAllocator, pView); |
| 2660 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2661 | validate_result(my_data->report_data, "vkCreateImageView", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2662 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2663 | |
| 2664 | return result; |
| 2665 | } |
| 2666 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2667 | VKAPI_ATTR void VKAPI_CALL DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) { |
| 2668 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2669 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2670 | assert(my_data != NULL); |
| 2671 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2672 | skip_call |= parameter_validation_vkDestroyImageView(my_data->report_data, imageView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2673 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2674 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2675 | get_dispatch_table(pc_device_table_map, device)->DestroyImageView(device, imageView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2676 | } |
| 2677 | } |
| 2678 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2679 | VKAPI_ATTR VkResult VKAPI_CALL CreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2680 | const VkAllocationCallbacks *pAllocator, VkShaderModule *pShaderModule) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2681 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2682 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2683 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2684 | assert(my_data != NULL); |
| 2685 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2686 | skip_call |= parameter_validation_vkCreateShaderModule(my_data->report_data, pCreateInfo, pAllocator, pShaderModule); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2687 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2688 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2689 | result = |
| 2690 | get_dispatch_table(pc_device_table_map, device)->CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2691 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2692 | validate_result(my_data->report_data, "vkCreateShaderModule", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2693 | } |
| 2694 | |
Michael Lentine | 03d8e57 | 2015-09-15 14:59:14 -0500 | [diff] [blame] | 2695 | return result; |
| 2696 | } |
| 2697 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2698 | VKAPI_ATTR void VKAPI_CALL DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, |
| 2699 | const VkAllocationCallbacks *pAllocator) { |
| 2700 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2701 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2702 | assert(my_data != NULL); |
| 2703 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2704 | skip_call |= parameter_validation_vkDestroyShaderModule(my_data->report_data, shaderModule, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2705 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2706 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2707 | get_dispatch_table(pc_device_table_map, device)->DestroyShaderModule(device, shaderModule, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2708 | } |
| 2709 | } |
| 2710 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2711 | VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2712 | const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2713 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2714 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2715 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2716 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2717 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2718 | skip_call |= parameter_validation_vkCreatePipelineCache(my_data->report_data, pCreateInfo, pAllocator, pPipelineCache); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2719 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2720 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2721 | result = |
| 2722 | get_dispatch_table(pc_device_table_map, device)->CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2723 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2724 | validate_result(my_data->report_data, "vkCreatePipelineCache", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2725 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2726 | |
| 2727 | return result; |
| 2728 | } |
| 2729 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2730 | VKAPI_ATTR void VKAPI_CALL DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, |
| 2731 | const VkAllocationCallbacks *pAllocator) { |
| 2732 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2733 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2734 | assert(my_data != NULL); |
| 2735 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2736 | skip_call |= parameter_validation_vkDestroyPipelineCache(my_data->report_data, pipelineCache, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2737 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2738 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2739 | get_dispatch_table(pc_device_table_map, device)->DestroyPipelineCache(device, pipelineCache, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2740 | } |
| 2741 | } |
| 2742 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2743 | VKAPI_ATTR VkResult VKAPI_CALL GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, |
| 2744 | void *pData) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2745 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2746 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2747 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2748 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2749 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2750 | skip_call |= parameter_validation_vkGetPipelineCacheData(my_data->report_data, pipelineCache, pDataSize, pData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2751 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2752 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2753 | result = get_dispatch_table(pc_device_table_map, device)->GetPipelineCacheData(device, pipelineCache, pDataSize, pData); |
| 2754 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2755 | validate_result(my_data->report_data, "vkGetPipelineCacheData", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2756 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2757 | |
| 2758 | return result; |
| 2759 | } |
| 2760 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2761 | VKAPI_ATTR VkResult VKAPI_CALL MergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, |
| 2762 | const VkPipelineCache *pSrcCaches) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2763 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2764 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2765 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2766 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2767 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2768 | skip_call |= parameter_validation_vkMergePipelineCaches(my_data->report_data, dstCache, srcCacheCount, pSrcCaches); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2769 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2770 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2771 | result = get_dispatch_table(pc_device_table_map, device)->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches); |
| 2772 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2773 | validate_result(my_data->report_data, "vkMergePipelineCaches", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2774 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2775 | |
| 2776 | return result; |
| 2777 | } |
| 2778 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2779 | bool PreCreateGraphicsPipelines(VkDevice device, const VkGraphicsPipelineCreateInfo *pCreateInfos) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 2780 | layer_data *data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2781 | |
| 2782 | // TODO: Handle count |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2783 | if (pCreateInfos != nullptr) { |
| 2784 | if (pCreateInfos->flags | VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
| 2785 | if (pCreateInfos->basePipelineIndex != -1) { |
| 2786 | if (pCreateInfos->basePipelineHandle != VK_NULL_HANDLE) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 2787 | log_msg(mdd(device), 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] | 2788 | INVALID_USAGE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2789 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineHandle, must be VK_NULL_HANDLE if " |
| 2790 | "pCreateInfos->flags " |
| 2791 | "contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and pCreateInfos->basePipelineIndex is not -1"); |
| 2792 | return false; |
| 2793 | } |
| 2794 | } |
| 2795 | |
| 2796 | if (pCreateInfos->basePipelineHandle != VK_NULL_HANDLE) { |
| 2797 | if (pCreateInfos->basePipelineIndex != -1) { |
| 2798 | log_msg( |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 2799 | mdd(device), 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] | 2800 | INVALID_USAGE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2801 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineIndex, must be -1 if pCreateInfos->flags " |
| 2802 | "contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and pCreateInfos->basePipelineHandle is not " |
| 2803 | "VK_NULL_HANDLE"); |
| 2804 | return false; |
| 2805 | } |
Jeremy Hayes | 2fdaaf2 | 2016-03-01 17:51:54 -0700 | [diff] [blame] | 2806 | } |
| 2807 | } |
| 2808 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2809 | if (pCreateInfos->pRasterizationState != nullptr) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2810 | if (pCreateInfos->pRasterizationState->cullMode & ~VK_CULL_MODE_FRONT_AND_BACK) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 2811 | log_msg(mdd(device), 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] | 2812 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2813 | "vkCreateGraphicsPipelines parameter, VkCullMode pCreateInfos->pRasterizationState->cullMode, is an " |
| 2814 | "unrecognized enumerator"); |
| 2815 | return false; |
| 2816 | } |
Mark Lobodzinski | 2e67fdb | 2016-08-09 13:10:51 -0600 | [diff] [blame] | 2817 | |
| 2818 | if ((pCreateInfos->pRasterizationState->polygonMode != VK_POLYGON_MODE_FILL) && |
| 2819 | (data->physical_device_features.fillModeNonSolid == false)) { |
| 2820 | log_msg( |
| 2821 | mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2822 | DEVICE_FEATURE, LayerName, |
| 2823 | "vkCreateGraphicsPipelines parameter, VkPolygonMode pCreateInfos->pRasterizationState->polygonMode cannot be " |
| 2824 | "VK_POLYGON_MODE_POINT or VK_POLYGON_MODE_LINE if VkPhysicalDeviceFeatures->fillModeNonSolid is false."); |
| 2825 | return false; |
| 2826 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2827 | } |
Jeremy Hayes | 2fdaaf2 | 2016-03-01 17:51:54 -0700 | [diff] [blame] | 2828 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2829 | size_t i = 0; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 2830 | for (size_t j = 0; j < pCreateInfos[i].stageCount; j++) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2831 | validate_string(data->report_data, "vkCreateGraphicsPipelines", |
| 2832 | ParameterName("pCreateInfos[%i].pStages[%i].pName", ParameterName::IndexVector{i, j}), |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2833 | pCreateInfos[i].pStages[j].pName); |
| 2834 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2835 | } |
| 2836 | |
| 2837 | return true; |
| 2838 | } |
| 2839 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2840 | VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 2841 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
| 2842 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2843 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2844 | bool skip_call = false; |
| 2845 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2846 | assert(device_data != nullptr); |
| 2847 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2848 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2849 | skip_call |= parameter_validation_vkCreateGraphicsPipelines(report_data, pipelineCache, createInfoCount, pCreateInfos, |
| 2850 | pAllocator, pPipelines); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2851 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2852 | if (pCreateInfos != nullptr) { |
| 2853 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
| 2854 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2855 | if (pCreateInfos[i].pTessellationState == nullptr) { |
| 2856 | if (pCreateInfos[i].pStages != nullptr) { |
| 2857 | // If pStages includes a tessellation control shader stage and a tessellation evaluation shader stage, |
| 2858 | // pTessellationState must not be NULL |
| 2859 | bool has_control = false; |
| 2860 | bool has_eval = false; |
| 2861 | |
| 2862 | for (uint32_t stage_index = 0; stage_index < pCreateInfos[i].stageCount; ++stage_index) { |
| 2863 | if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { |
| 2864 | has_control = true; |
| 2865 | } else if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { |
| 2866 | has_eval = true; |
| 2867 | } |
| 2868 | } |
| 2869 | |
| 2870 | if (has_control && has_eval) { |
| 2871 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2872 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 2873 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pStages includes a tessellation " |
| 2874 | "control shader stage and a tessellation evaluation shader stage, " |
| 2875 | "pCreateInfos[%d].pTessellationState must not be NULL", |
| 2876 | i, i); |
| 2877 | } |
| 2878 | } |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2879 | } else { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2880 | skip_call |= validate_struct_pnext( |
| 2881 | report_data, "vkCreateGraphicsPipelines", |
| 2882 | ParameterName("pCreateInfos[%i].pTessellationState->pNext", ParameterName::IndexVector{i}), NULL, |
| 2883 | pCreateInfos[i].pTessellationState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2884 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2885 | skip_call |= validate_reserved_flags( |
| 2886 | report_data, "vkCreateGraphicsPipelines", |
| 2887 | ParameterName("pCreateInfos[%i].pTessellationState->flags", ParameterName::IndexVector{i}), |
| 2888 | pCreateInfos[i].pTessellationState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2889 | |
| 2890 | if (pCreateInfos[i].pTessellationState->sType != VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO) { |
| 2891 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2892 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 2893 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pTessellationState->sType must be " |
| 2894 | "VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO", |
| 2895 | i); |
| 2896 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2897 | } |
| 2898 | |
| 2899 | if (pCreateInfos[i].pViewportState == nullptr) { |
| 2900 | // If the rasterizerDiscardEnable member of pRasterizationState is VK_FALSE, pViewportState must be a pointer to a |
| 2901 | // valid VkPipelineViewportStateCreateInfo structure |
| 2902 | if ((pCreateInfos[i].pRasterizationState != nullptr) && |
| 2903 | (pCreateInfos[i].pRasterizationState->rasterizerDiscardEnable == VK_FALSE)) { |
| 2904 | skip_call |= log_msg( |
| 2905 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2906 | REQUIRED_PARAMETER, LayerName, |
| 2907 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pRasterizationState->rasterizerDiscardEnable is VK_FALSE, " |
| 2908 | "pCreateInfos[%d].pViewportState must be a pointer to a valid VkPipelineViewportStateCreateInfo structure", |
| 2909 | i, i); |
| 2910 | } |
| 2911 | } else { |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2912 | skip_call |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2913 | validate_struct_pnext(report_data, "vkCreateGraphicsPipelines", |
| 2914 | ParameterName("pCreateInfos[%i].pViewportState->pNext", ParameterName::IndexVector{i}), |
| 2915 | NULL, pCreateInfos[i].pViewportState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2916 | |
| 2917 | skip_call |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2918 | validate_reserved_flags(report_data, "vkCreateGraphicsPipelines", |
| 2919 | ParameterName("pCreateInfos[%i].pViewportState->flags", ParameterName::IndexVector{i}), |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2920 | pCreateInfos[i].pViewportState->flags); |
| 2921 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2922 | if (pCreateInfos[i].pViewportState->sType != VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO) { |
| 2923 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2924 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 2925 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pViewportState->sType must be " |
| 2926 | "VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO", |
| 2927 | i); |
| 2928 | } |
| 2929 | |
| 2930 | if (pCreateInfos[i].pDynamicState != nullptr) { |
| 2931 | bool has_dynamic_viewport = false; |
| 2932 | bool has_dynamic_scissor = false; |
| 2933 | |
| 2934 | for (uint32_t state_index = 0; state_index < pCreateInfos[i].pDynamicState->dynamicStateCount; ++state_index) { |
| 2935 | if (pCreateInfos[i].pDynamicState->pDynamicStates[state_index] == VK_DYNAMIC_STATE_VIEWPORT) { |
| 2936 | has_dynamic_viewport = true; |
| 2937 | } else if (pCreateInfos[i].pDynamicState->pDynamicStates[state_index] == VK_DYNAMIC_STATE_SCISSOR) { |
| 2938 | has_dynamic_scissor = true; |
| 2939 | } |
| 2940 | } |
| 2941 | |
| 2942 | // viewportCount must be greater than 0 |
| 2943 | // TODO: viewportCount must be 1 when multiple_viewport feature is not enabled |
| 2944 | if (pCreateInfos[i].pViewportState->viewportCount == 0) { |
| 2945 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2946 | __LINE__, REQUIRED_PARAMETER, LayerName, |
Tobin Ehlis | bebd316 | 2016-08-18 10:53:58 -0600 | [diff] [blame] | 2947 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates does " |
| 2948 | "not contain VK_DYNAMIC_STATE_VIEWPORT, pCreateInfos[%d].pViewportState->viewportCount " |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2949 | "must be greater than 0", |
| 2950 | i, i); |
| 2951 | } |
| 2952 | |
| 2953 | // If no element of the pDynamicStates member of pDynamicState is VK_DYNAMIC_STATE_VIEWPORT, the pViewports |
| 2954 | // member of pViewportState must be a pointer to an array of pViewportState->viewportCount VkViewport structures |
| 2955 | if (!has_dynamic_viewport && (pCreateInfos[i].pViewportState->pViewports == nullptr)) { |
| 2956 | skip_call |= |
| 2957 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2958 | __LINE__, REQUIRED_PARAMETER, LayerName, |
Tobin Ehlis | bebd316 | 2016-08-18 10:53:58 -0600 | [diff] [blame] | 2959 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates does not contain " |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2960 | "VK_DYNAMIC_STATE_VIEWPORT, pCreateInfos[%d].pViewportState->pViewports must not be NULL", |
| 2961 | i, i); |
| 2962 | } |
| 2963 | |
| 2964 | // scissorCount must be greater than 0 |
| 2965 | // TODO: scissorCount must be 1 when multiple_viewport feature is not enabled |
| 2966 | if (pCreateInfos[i].pViewportState->scissorCount == 0) { |
| 2967 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2968 | __LINE__, REQUIRED_PARAMETER, LayerName, |
Tobin Ehlis | bebd316 | 2016-08-18 10:53:58 -0600 | [diff] [blame] | 2969 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates does " |
| 2970 | "not contain VK_DYNAMIC_STATE_SCISSOR, pCreateInfos[%d].pViewportState->scissorCount " |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2971 | "must be greater than 0", |
| 2972 | i, i); |
| 2973 | } |
| 2974 | |
| 2975 | // If no element of the pDynamicStates member of pDynamicState is VK_DYNAMIC_STATE_SCISSOR, the pScissors member |
| 2976 | // of pViewportState must be a pointer to an array of pViewportState->scissorCount VkRect2D structures |
| 2977 | if (!has_dynamic_scissor && (pCreateInfos[i].pViewportState->pScissors == nullptr)) { |
| 2978 | skip_call |= |
| 2979 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2980 | __LINE__, REQUIRED_PARAMETER, LayerName, |
Tobin Ehlis | bebd316 | 2016-08-18 10:53:58 -0600 | [diff] [blame] | 2981 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates does not contain " |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2982 | "VK_DYNAMIC_STATE_SCISSOR, pCreateInfos[%d].pViewportState->pScissors must not be NULL", |
| 2983 | i, i); |
| 2984 | } |
| 2985 | } |
| 2986 | } |
| 2987 | |
| 2988 | if (pCreateInfos[i].pMultisampleState == nullptr) { |
| 2989 | // If the rasterizerDiscardEnable member of pRasterizationState is VK_FALSE, pMultisampleState must be a pointer to |
| 2990 | // a valid VkPipelineMultisampleStateCreateInfo structure |
| 2991 | if ((pCreateInfos[i].pRasterizationState != nullptr) && |
| 2992 | pCreateInfos[i].pRasterizationState->rasterizerDiscardEnable == VK_FALSE) { |
| 2993 | skip_call |= |
| 2994 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2995 | REQUIRED_PARAMETER, LayerName, "vkCreateGraphicsPipelines: if " |
| 2996 | "pCreateInfos[%d].pRasterizationState->rasterizerDiscardEnable is " |
| 2997 | "VK_FALSE, pCreateInfos[%d].pMultisampleState must not be NULL", |
| 2998 | i, i); |
| 2999 | } |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3000 | } else { |
| 3001 | skip_call |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3002 | validate_struct_pnext(report_data, "vkCreateGraphicsPipelines", |
| 3003 | ParameterName("pCreateInfos[%i].pMultisampleState->pNext", ParameterName::IndexVector{i}), |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 3004 | NULL, pCreateInfos[i].pMultisampleState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3005 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3006 | skip_call |= validate_reserved_flags( |
| 3007 | report_data, "vkCreateGraphicsPipelines", |
| 3008 | ParameterName("pCreateInfos[%i].pMultisampleState->flags", ParameterName::IndexVector{i}), |
| 3009 | pCreateInfos[i].pMultisampleState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3010 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3011 | skip_call |= validate_bool32( |
| 3012 | report_data, "vkCreateGraphicsPipelines", |
| 3013 | ParameterName("pCreateInfos[%i].pMultisampleState->sampleShadingEnable", ParameterName::IndexVector{i}), |
| 3014 | pCreateInfos[i].pMultisampleState->sampleShadingEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3015 | |
| 3016 | skip_call |= validate_array( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3017 | report_data, "vkCreateGraphicsPipelines", |
| 3018 | ParameterName("pCreateInfos[%i].pMultisampleState->rasterizationSamples", ParameterName::IndexVector{i}), |
| 3019 | ParameterName("pCreateInfos[%i].pMultisampleState->pSampleMask", ParameterName::IndexVector{i}), |
| 3020 | pCreateInfos[i].pMultisampleState->rasterizationSamples, pCreateInfos[i].pMultisampleState->pSampleMask, true, |
| 3021 | false); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3022 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3023 | skip_call |= validate_bool32( |
| 3024 | report_data, "vkCreateGraphicsPipelines", |
| 3025 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToCoverageEnable", ParameterName::IndexVector{i}), |
| 3026 | pCreateInfos[i].pMultisampleState->alphaToCoverageEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3027 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3028 | skip_call |= validate_bool32( |
| 3029 | report_data, "vkCreateGraphicsPipelines", |
| 3030 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToOneEnable", ParameterName::IndexVector{i}), |
| 3031 | pCreateInfos[i].pMultisampleState->alphaToOneEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3032 | |
| 3033 | if (pCreateInfos[i].pMultisampleState->sType != VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO) { |
| 3034 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3035 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 3036 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pMultisampleState->sType must be " |
| 3037 | "VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO", |
| 3038 | i); |
| 3039 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3040 | } |
| 3041 | |
| 3042 | // TODO: Conditional NULL check based on rasterizerDiscardEnable and subpass |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3043 | if (pCreateInfos[i].pDepthStencilState != nullptr) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3044 | skip_call |= validate_struct_pnext( |
| 3045 | report_data, "vkCreateGraphicsPipelines", |
| 3046 | ParameterName("pCreateInfos[%i].pDepthStencilState->pNext", ParameterName::IndexVector{i}), NULL, |
| 3047 | pCreateInfos[i].pDepthStencilState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3048 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3049 | skip_call |= validate_reserved_flags( |
| 3050 | report_data, "vkCreateGraphicsPipelines", |
| 3051 | ParameterName("pCreateInfos[%i].pDepthStencilState->flags", ParameterName::IndexVector{i}), |
| 3052 | pCreateInfos[i].pDepthStencilState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3053 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3054 | skip_call |= validate_bool32( |
| 3055 | report_data, "vkCreateGraphicsPipelines", |
| 3056 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthTestEnable", ParameterName::IndexVector{i}), |
| 3057 | pCreateInfos[i].pDepthStencilState->depthTestEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3058 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3059 | skip_call |= validate_bool32( |
| 3060 | report_data, "vkCreateGraphicsPipelines", |
| 3061 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthWriteEnable", ParameterName::IndexVector{i}), |
| 3062 | pCreateInfos[i].pDepthStencilState->depthWriteEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3063 | |
| 3064 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3065 | report_data, "vkCreateGraphicsPipelines", |
| 3066 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthCompareOp", ParameterName::IndexVector{i}), |
| 3067 | "VkCompareOp", VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, |
| 3068 | pCreateInfos[i].pDepthStencilState->depthCompareOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3069 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3070 | skip_call |= validate_bool32( |
| 3071 | report_data, "vkCreateGraphicsPipelines", |
| 3072 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthBoundsTestEnable", ParameterName::IndexVector{i}), |
| 3073 | pCreateInfos[i].pDepthStencilState->depthBoundsTestEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3074 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3075 | skip_call |= validate_bool32( |
| 3076 | report_data, "vkCreateGraphicsPipelines", |
| 3077 | ParameterName("pCreateInfos[%i].pDepthStencilState->stencilTestEnable", ParameterName::IndexVector{i}), |
| 3078 | pCreateInfos[i].pDepthStencilState->stencilTestEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3079 | |
| 3080 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3081 | report_data, "vkCreateGraphicsPipelines", |
| 3082 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.failOp", ParameterName::IndexVector{i}), |
| 3083 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3084 | pCreateInfos[i].pDepthStencilState->front.failOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3085 | |
| 3086 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3087 | report_data, "vkCreateGraphicsPipelines", |
| 3088 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.passOp", ParameterName::IndexVector{i}), |
| 3089 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3090 | pCreateInfos[i].pDepthStencilState->front.passOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3091 | |
| 3092 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3093 | report_data, "vkCreateGraphicsPipelines", |
| 3094 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.depthFailOp", ParameterName::IndexVector{i}), |
| 3095 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3096 | pCreateInfos[i].pDepthStencilState->front.depthFailOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3097 | |
| 3098 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3099 | report_data, "vkCreateGraphicsPipelines", |
| 3100 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.compareOp", ParameterName::IndexVector{i}), |
| 3101 | "VkCompareOp", VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, |
| 3102 | pCreateInfos[i].pDepthStencilState->front.compareOp); |
| 3103 | |
| 3104 | skip_call |= validate_ranged_enum( |
| 3105 | report_data, "vkCreateGraphicsPipelines", |
| 3106 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.failOp", ParameterName::IndexVector{i}), "VkStencilOp", |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3107 | VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, pCreateInfos[i].pDepthStencilState->back.failOp); |
| 3108 | |
| 3109 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3110 | report_data, "vkCreateGraphicsPipelines", |
| 3111 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.passOp", ParameterName::IndexVector{i}), "VkStencilOp", |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3112 | VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, pCreateInfos[i].pDepthStencilState->back.passOp); |
| 3113 | |
| 3114 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3115 | report_data, "vkCreateGraphicsPipelines", |
| 3116 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.depthFailOp", ParameterName::IndexVector{i}), |
| 3117 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3118 | pCreateInfos[i].pDepthStencilState->back.depthFailOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3119 | |
| 3120 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3121 | report_data, "vkCreateGraphicsPipelines", |
| 3122 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.compareOp", ParameterName::IndexVector{i}), |
| 3123 | "VkCompareOp", VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, |
| 3124 | pCreateInfos[i].pDepthStencilState->back.compareOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3125 | |
| 3126 | if (pCreateInfos[i].pDepthStencilState->sType != VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO) { |
| 3127 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3128 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 3129 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pDepthStencilState->sType must be " |
| 3130 | "VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO", |
| 3131 | i); |
| 3132 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3133 | } |
| 3134 | |
| 3135 | // TODO: Conditional NULL check based on rasterizerDiscardEnable and subpass |
| 3136 | if (pCreateInfos[i].pColorBlendState != nullptr) { |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3137 | skip_call |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3138 | validate_struct_pnext(report_data, "vkCreateGraphicsPipelines", |
| 3139 | ParameterName("pCreateInfos[%i].pColorBlendState->pNext", ParameterName::IndexVector{i}), |
| 3140 | NULL, pCreateInfos[i].pColorBlendState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3141 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3142 | skip_call |= validate_reserved_flags( |
| 3143 | report_data, "vkCreateGraphicsPipelines", |
| 3144 | ParameterName("pCreateInfos[%i].pColorBlendState->flags", ParameterName::IndexVector{i}), |
| 3145 | pCreateInfos[i].pColorBlendState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3146 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3147 | skip_call |= validate_bool32( |
| 3148 | report_data, "vkCreateGraphicsPipelines", |
| 3149 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOpEnable", ParameterName::IndexVector{i}), |
| 3150 | pCreateInfos[i].pColorBlendState->logicOpEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3151 | |
| 3152 | skip_call |= validate_array( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3153 | report_data, "vkCreateGraphicsPipelines", |
| 3154 | ParameterName("pCreateInfos[%i].pColorBlendState->attachmentCount", ParameterName::IndexVector{i}), |
| 3155 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments", ParameterName::IndexVector{i}), |
| 3156 | pCreateInfos[i].pColorBlendState->attachmentCount, pCreateInfos[i].pColorBlendState->pAttachments, false, true); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3157 | |
| 3158 | if (pCreateInfos[i].pColorBlendState->pAttachments != NULL) { |
| 3159 | for (uint32_t attachmentIndex = 0; attachmentIndex < pCreateInfos[i].pColorBlendState->attachmentCount; |
| 3160 | ++attachmentIndex) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3161 | skip_call |= |
| 3162 | validate_bool32(report_data, "vkCreateGraphicsPipelines", |
| 3163 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].blendEnable", |
| 3164 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3165 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].blendEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3166 | |
| 3167 | skip_call |= validate_ranged_enum( |
| 3168 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3169 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcColorBlendFactor", |
| 3170 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3171 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3172 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].srcColorBlendFactor); |
| 3173 | |
| 3174 | skip_call |= validate_ranged_enum( |
| 3175 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3176 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstColorBlendFactor", |
| 3177 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3178 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3179 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].dstColorBlendFactor); |
| 3180 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3181 | skip_call |= |
| 3182 | validate_ranged_enum(report_data, "vkCreateGraphicsPipelines", |
| 3183 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorBlendOp", |
| 3184 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3185 | "VkBlendOp", VK_BLEND_OP_BEGIN_RANGE, VK_BLEND_OP_END_RANGE, |
| 3186 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].colorBlendOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3187 | |
| 3188 | skip_call |= validate_ranged_enum( |
| 3189 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3190 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcAlphaBlendFactor", |
| 3191 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3192 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3193 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].srcAlphaBlendFactor); |
| 3194 | |
| 3195 | skip_call |= validate_ranged_enum( |
| 3196 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3197 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstAlphaBlendFactor", |
| 3198 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3199 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3200 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].dstAlphaBlendFactor); |
| 3201 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3202 | skip_call |= |
| 3203 | validate_ranged_enum(report_data, "vkCreateGraphicsPipelines", |
| 3204 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].alphaBlendOp", |
| 3205 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3206 | "VkBlendOp", VK_BLEND_OP_BEGIN_RANGE, VK_BLEND_OP_END_RANGE, |
| 3207 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].alphaBlendOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3208 | |
| 3209 | skip_call |= |
| 3210 | validate_flags(report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3211 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorWriteMask", |
| 3212 | ParameterName::IndexVector{i, attachmentIndex}), |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3213 | "VkColorComponentFlagBits", AllVkColorComponentFlagBits, |
| 3214 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].colorWriteMask, false); |
| 3215 | } |
| 3216 | } |
| 3217 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3218 | if (pCreateInfos[i].pColorBlendState->sType != VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO) { |
| 3219 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3220 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 3221 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pColorBlendState->sType must be " |
| 3222 | "VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO", |
| 3223 | i); |
| 3224 | } |
| 3225 | |
| 3226 | // If logicOpEnable is VK_TRUE, logicOp must be a valid VkLogicOp value |
| 3227 | if (pCreateInfos[i].pColorBlendState->logicOpEnable == VK_TRUE) { |
| 3228 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3229 | report_data, "vkCreateGraphicsPipelines", |
| 3230 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOp", ParameterName::IndexVector{i}), "VkLogicOp", |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3231 | VK_LOGIC_OP_BEGIN_RANGE, VK_LOGIC_OP_END_RANGE, pCreateInfos[i].pColorBlendState->logicOp); |
| 3232 | } |
| 3233 | } |
| 3234 | } |
| 3235 | } |
| 3236 | |
| 3237 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3238 | PreCreateGraphicsPipelines(device, pCreateInfos); |
| 3239 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3240 | result = get_dispatch_table(pc_device_table_map, device) |
| 3241 | ->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3242 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3243 | validate_result(report_data, "vkCreateGraphicsPipelines", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3244 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3245 | |
| 3246 | return result; |
| 3247 | } |
| 3248 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3249 | bool PreCreateComputePipelines(VkDevice device, const VkComputePipelineCreateInfo *pCreateInfos) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 3250 | layer_data *data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3251 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3252 | if (pCreateInfos != nullptr) { |
| 3253 | // TODO: Handle count! |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3254 | uint32_t i = 0; |
| 3255 | validate_string(data->report_data, "vkCreateComputePipelines", |
| 3256 | ParameterName("pCreateInfos[%i].stage.pName", ParameterName::IndexVector{i}), pCreateInfos[i].stage.pName); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3257 | } |
| 3258 | |
| 3259 | return true; |
| 3260 | } |
| 3261 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3262 | VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 3263 | const VkComputePipelineCreateInfo *pCreateInfos, |
| 3264 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3265 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3266 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3267 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3268 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3269 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3270 | skip_call |= parameter_validation_vkCreateComputePipelines(my_data->report_data, pipelineCache, createInfoCount, pCreateInfos, |
| 3271 | pAllocator, pPipelines); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3272 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3273 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3274 | PreCreateComputePipelines(device, pCreateInfos); |
| 3275 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3276 | result = get_dispatch_table(pc_device_table_map, device) |
| 3277 | ->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3278 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3279 | validate_result(my_data->report_data, "vkCreateComputePipelines", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3280 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3281 | |
| 3282 | return result; |
| 3283 | } |
| 3284 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3285 | VKAPI_ATTR void VKAPI_CALL DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) { |
| 3286 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3287 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3288 | assert(my_data != NULL); |
| 3289 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3290 | skip_call |= parameter_validation_vkDestroyPipeline(my_data->report_data, pipeline, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3291 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3292 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3293 | get_dispatch_table(pc_device_table_map, device)->DestroyPipeline(device, pipeline, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3294 | } |
| 3295 | } |
| 3296 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3297 | VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, |
| 3298 | const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3299 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3300 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3301 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3302 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3303 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3304 | skip_call |= parameter_validation_vkCreatePipelineLayout(my_data->report_data, pCreateInfo, pAllocator, pPipelineLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3305 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3306 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3307 | result = |
| 3308 | get_dispatch_table(pc_device_table_map, device)->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3309 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3310 | validate_result(my_data->report_data, "vkCreatePipelineLayout", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3311 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3312 | |
| 3313 | return result; |
| 3314 | } |
| 3315 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3316 | VKAPI_ATTR void VKAPI_CALL DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, |
| 3317 | const VkAllocationCallbacks *pAllocator) { |
| 3318 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3319 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3320 | assert(my_data != NULL); |
| 3321 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3322 | skip_call |= parameter_validation_vkDestroyPipelineLayout(my_data->report_data, pipelineLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3323 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3324 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3325 | get_dispatch_table(pc_device_table_map, device)->DestroyPipelineLayout(device, pipelineLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3326 | } |
| 3327 | } |
| 3328 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3329 | VKAPI_ATTR VkResult VKAPI_CALL CreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, |
| 3330 | const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3331 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3332 | bool skip_call = false; |
| 3333 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3334 | assert(device_data != NULL); |
| 3335 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3336 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3337 | skip_call |= parameter_validation_vkCreateSampler(report_data, pCreateInfo, pAllocator, pSampler); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3338 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3339 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3340 | if (pCreateInfo != nullptr) { |
| 3341 | // If compareEnable is VK_TRUE, compareOp must be a valid VkCompareOp value |
| 3342 | if (pCreateInfo->compareEnable == VK_TRUE) { |
| 3343 | skip_call |= validate_ranged_enum(report_data, "vkCreateSampler", "pCreateInfo->compareOp", "VkCompareOp", |
| 3344 | VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, pCreateInfo->compareOp); |
| 3345 | } |
| 3346 | |
| 3347 | // If any of addressModeU, addressModeV or addressModeW are VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, borderColor must be a |
| 3348 | // valid VkBorderColor value |
| 3349 | if ((pCreateInfo->addressModeU == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 3350 | (pCreateInfo->addressModeV == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 3351 | (pCreateInfo->addressModeW == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)) { |
| 3352 | skip_call |= validate_ranged_enum(report_data, "vkCreateSampler", "pCreateInfo->borderColor", "VkBorderColor", |
| 3353 | VK_BORDER_COLOR_BEGIN_RANGE, VK_BORDER_COLOR_END_RANGE, pCreateInfo->borderColor); |
| 3354 | } |
| 3355 | } |
| 3356 | |
| 3357 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3358 | result = get_dispatch_table(pc_device_table_map, device)->CreateSampler(device, pCreateInfo, pAllocator, pSampler); |
| 3359 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3360 | validate_result(report_data, "vkCreateSampler", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3361 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3362 | |
| 3363 | return result; |
| 3364 | } |
| 3365 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3366 | VKAPI_ATTR void VKAPI_CALL DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator) { |
| 3367 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3368 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3369 | assert(my_data != NULL); |
| 3370 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3371 | skip_call |= parameter_validation_vkDestroySampler(my_data->report_data, sampler, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3372 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3373 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3374 | get_dispatch_table(pc_device_table_map, device)->DestroySampler(device, sampler, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3375 | } |
| 3376 | } |
| 3377 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3378 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
| 3379 | const VkAllocationCallbacks *pAllocator, |
| 3380 | VkDescriptorSetLayout *pSetLayout) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3381 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3382 | bool skip_call = false; |
| 3383 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3384 | assert(device_data != nullptr); |
| 3385 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3386 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3387 | skip_call |= parameter_validation_vkCreateDescriptorSetLayout(report_data, pCreateInfo, pAllocator, pSetLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3388 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3389 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3390 | if ((pCreateInfo != nullptr) && (pCreateInfo->pBindings != nullptr)) { |
| 3391 | for (uint32_t i = 0; i < pCreateInfo->bindingCount; ++i) { |
| 3392 | if (pCreateInfo->pBindings[i].descriptorCount != 0) { |
| 3393 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER or VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, and descriptorCount |
| 3394 | // is not 0 and pImmutableSamplers is not NULL, pImmutableSamplers must be a pointer to an array of descriptorCount |
| 3395 | // valid VkSampler handles |
| 3396 | if (((pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 3397 | (pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)) && |
| 3398 | (pCreateInfo->pBindings[i].pImmutableSamplers != nullptr)) { |
| 3399 | for (uint32_t descriptor_index = 0; descriptor_index < pCreateInfo->pBindings[i].descriptorCount; |
| 3400 | ++descriptor_index) { |
| 3401 | if (pCreateInfo->pBindings[i].pImmutableSamplers[descriptor_index] == VK_NULL_HANDLE) { |
| 3402 | skip_call |= |
| 3403 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3404 | __LINE__, REQUIRED_PARAMETER, LayerName, "vkCreateDescriptorSetLayout: required parameter " |
| 3405 | "pCreateInfo->pBindings[%d].pImmutableSamplers[%d]" |
| 3406 | " specified as VK_NULL_HANDLE", |
| 3407 | i, descriptor_index); |
| 3408 | } |
| 3409 | } |
| 3410 | } |
| 3411 | |
| 3412 | // If descriptorCount is not 0, stageFlags must be a valid combination of VkShaderStageFlagBits values |
| 3413 | if ((pCreateInfo->pBindings[i].stageFlags != 0) && |
| 3414 | ((pCreateInfo->pBindings[i].stageFlags & (~AllVkShaderStageFlagBits)) != 0)) { |
| 3415 | skip_call |= |
| 3416 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3417 | UNRECOGNIZED_VALUE, LayerName, |
| 3418 | "vkCreateDescriptorSetLayout: if pCreateInfo->pBindings[%d].descriptorCount is not 0, " |
| 3419 | "pCreateInfo->pBindings[%d].stageFlags must be a valid combination of VkShaderStageFlagBits values", |
| 3420 | i, i); |
| 3421 | } |
| 3422 | } |
| 3423 | } |
| 3424 | } |
| 3425 | |
| 3426 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3427 | result = |
| 3428 | get_dispatch_table(pc_device_table_map, device)->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3429 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3430 | validate_result(report_data, "vkCreateDescriptorSetLayout", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3431 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3432 | |
| 3433 | return result; |
| 3434 | } |
| 3435 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3436 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, |
| 3437 | const VkAllocationCallbacks *pAllocator) { |
| 3438 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3439 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3440 | assert(my_data != NULL); |
| 3441 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3442 | skip_call |= parameter_validation_vkDestroyDescriptorSetLayout(my_data->report_data, descriptorSetLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3443 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3444 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3445 | get_dispatch_table(pc_device_table_map, device)->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3446 | } |
| 3447 | } |
| 3448 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3449 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, |
| 3450 | const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3451 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3452 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3453 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3454 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3455 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3456 | skip_call |= parameter_validation_vkCreateDescriptorPool(my_data->report_data, pCreateInfo, pAllocator, pDescriptorPool); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3457 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3458 | /* TODOVV: How do we validate maxSets? Probably belongs in the limits layer? */ |
| 3459 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3460 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3461 | result = |
| 3462 | get_dispatch_table(pc_device_table_map, device)->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3463 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3464 | validate_result(my_data->report_data, "vkCreateDescriptorPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3465 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3466 | |
| 3467 | return result; |
| 3468 | } |
| 3469 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3470 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 3471 | const VkAllocationCallbacks *pAllocator) { |
| 3472 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3473 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3474 | assert(my_data != NULL); |
| 3475 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3476 | skip_call |= parameter_validation_vkDestroyDescriptorPool(my_data->report_data, descriptorPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3477 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3478 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3479 | get_dispatch_table(pc_device_table_map, device)->DestroyDescriptorPool(device, descriptorPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3480 | } |
| 3481 | } |
| 3482 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3483 | VKAPI_ATTR VkResult VKAPI_CALL ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 3484 | VkDescriptorPoolResetFlags flags) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3485 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3486 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3487 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3488 | assert(my_data != NULL); |
| 3489 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3490 | skip_call |= parameter_validation_vkResetDescriptorPool(my_data->report_data, descriptorPool, flags); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3491 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3492 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3493 | result = get_dispatch_table(pc_device_table_map, device)->ResetDescriptorPool(device, descriptorPool, flags); |
| 3494 | |
| 3495 | validate_result(my_data->report_data, "vkResetDescriptorPool", result); |
| 3496 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3497 | |
| 3498 | return result; |
| 3499 | } |
| 3500 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3501 | VKAPI_ATTR VkResult VKAPI_CALL AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, |
| 3502 | VkDescriptorSet *pDescriptorSets) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3503 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3504 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3505 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3506 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3507 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3508 | skip_call |= parameter_validation_vkAllocateDescriptorSets(my_data->report_data, pAllocateInfo, pDescriptorSets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3509 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3510 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3511 | result = get_dispatch_table(pc_device_table_map, device)->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets); |
| 3512 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3513 | validate_result(my_data->report_data, "vkAllocateDescriptorSets", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3514 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3515 | |
| 3516 | return result; |
| 3517 | } |
| 3518 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3519 | 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] | 3520 | const VkDescriptorSet *pDescriptorSets) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3521 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3522 | bool skip_call = false; |
| 3523 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3524 | assert(device_data != nullptr); |
| 3525 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3526 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3527 | skip_call |= parameter_validation_vkFreeDescriptorSets(report_data, descriptorPool, descriptorSetCount, pDescriptorSets); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3528 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3529 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3530 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 3531 | // validate_array() |
| 3532 | skip_call |= validate_array(report_data, "vkFreeDescriptorSets", "descriptorSetCount", "pDescriptorSets", descriptorSetCount, |
| 3533 | pDescriptorSets, true, true); |
| 3534 | |
| 3535 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3536 | result = get_dispatch_table(pc_device_table_map, device) |
| 3537 | ->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3538 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3539 | validate_result(report_data, "vkFreeDescriptorSets", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3540 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3541 | |
| 3542 | return result; |
| 3543 | } |
| 3544 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3545 | VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, |
| 3546 | const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, |
| 3547 | const VkCopyDescriptorSet *pDescriptorCopies) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3548 | bool skip_call = false; |
| 3549 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3550 | assert(device_data != NULL); |
| 3551 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3552 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3553 | skip_call |= parameter_validation_vkUpdateDescriptorSets(report_data, descriptorWriteCount, pDescriptorWrites, |
| 3554 | descriptorCopyCount, pDescriptorCopies); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3555 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3556 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3557 | if (pDescriptorWrites != NULL) { |
| 3558 | for (uint32_t i = 0; i < descriptorWriteCount; ++i) { |
| 3559 | // descriptorCount must be greater than 0 |
| 3560 | if (pDescriptorWrites[i].descriptorCount == 0) { |
| 3561 | skip_call |= |
| 3562 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3563 | REQUIRED_PARAMETER, LayerName, |
| 3564 | "vkUpdateDescriptorSets: parameter pDescriptorWrites[%d].descriptorCount must be greater than 0", i); |
| 3565 | } |
| 3566 | |
| 3567 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 3568 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || |
| 3569 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || |
| 3570 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || |
| 3571 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)) { |
| 3572 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, |
| 3573 | // VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, |
| 3574 | // pImageInfo must be a pointer to an array of descriptorCount valid VkDescriptorImageInfo structures |
| 3575 | if (pDescriptorWrites[i].pImageInfo == nullptr) { |
| 3576 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3577 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 3578 | "vkUpdateDescriptorSets: if pDescriptorWrites[%d].descriptorType is " |
| 3579 | "VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, " |
| 3580 | "VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or " |
| 3581 | "VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, pDescriptorWrites[%d].pImageInfo must not be NULL", |
| 3582 | i, i); |
| 3583 | } else if (pDescriptorWrites[i].descriptorType != VK_DESCRIPTOR_TYPE_SAMPLER) { |
| 3584 | // If descriptorType is VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, |
| 3585 | // VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, the imageView and imageLayout |
| 3586 | // members of any given element of pImageInfo must be a valid VkImageView and VkImageLayout, respectively |
| 3587 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3588 | ++descriptor_index) { |
| 3589 | skip_call |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3590 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageView", |
| 3591 | ParameterName::IndexVector{i, descriptor_index}), |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3592 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageView); |
| 3593 | skip_call |= validate_ranged_enum(report_data, "vkUpdateDescriptorSets", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3594 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageLayout", |
| 3595 | ParameterName::IndexVector{i, descriptor_index}), |
| 3596 | "VkImageLayout", VK_IMAGE_LAYOUT_BEGIN_RANGE, VK_IMAGE_LAYOUT_END_RANGE, |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3597 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageLayout); |
| 3598 | } |
| 3599 | } |
| 3600 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 3601 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 3602 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || |
| 3603 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 3604 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 3605 | // VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, pBufferInfo must be a |
| 3606 | // pointer to an array of descriptorCount valid VkDescriptorBufferInfo structures |
| 3607 | if (pDescriptorWrites[i].pBufferInfo == nullptr) { |
| 3608 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3609 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 3610 | "vkUpdateDescriptorSets: if pDescriptorWrites[%d].descriptorType is " |
| 3611 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, " |
| 3612 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, " |
| 3613 | "pDescriptorWrites[%d].pBufferInfo must not be NULL", |
| 3614 | i, i); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3615 | } else { |
| 3616 | for (uint32_t descriptorIndex = 0; descriptorIndex < pDescriptorWrites[i].descriptorCount; ++descriptorIndex) { |
| 3617 | skip_call |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3618 | ParameterName("pDescriptorWrites[%i].pBufferInfo[%i].buffer", |
| 3619 | ParameterName::IndexVector{i, descriptorIndex}), |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3620 | pDescriptorWrites[i].pBufferInfo[descriptorIndex].buffer); |
| 3621 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3622 | } |
| 3623 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || |
| 3624 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { |
| 3625 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, |
| 3626 | // pTexelBufferView must be a pointer to an array of descriptorCount valid VkBufferView handles |
| 3627 | if (pDescriptorWrites[i].pTexelBufferView == nullptr) { |
| 3628 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3629 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 3630 | "vkUpdateDescriptorSets: if pDescriptorWrites[%d].descriptorType is " |
| 3631 | "VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, " |
| 3632 | "pDescriptorWrites[%d].pTexelBufferView must not be NULL", |
| 3633 | i, i); |
| 3634 | } else { |
| 3635 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3636 | ++descriptor_index) { |
| 3637 | skip_call |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3638 | ParameterName("pDescriptorWrites[%i].pTexelBufferView[%i]", |
| 3639 | ParameterName::IndexVector{i, descriptor_index}), |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3640 | pDescriptorWrites[i].pTexelBufferView[descriptor_index]); |
| 3641 | } |
| 3642 | } |
| 3643 | } |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3644 | |
| 3645 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 3646 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)) { |
| 3647 | VkDeviceSize uniformAlignment = device_data->device_limits.minUniformBufferOffsetAlignment; |
| 3648 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 3649 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
| 3650 | if (vk_safe_modulo(pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment) != 0) { |
| 3651 | skip_call |= |
| 3652 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 3653 | VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, DEVICE_LIMIT, LayerName, |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3654 | "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 3655 | ") must be a multiple of device limit minUniformBufferOffsetAlignment 0x%" PRIxLEAST64, |
| 3656 | i, j, pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment); |
| 3657 | } |
| 3658 | } |
| 3659 | } |
| 3660 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 3661 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 3662 | VkDeviceSize storageAlignment = device_data->device_limits.minStorageBufferOffsetAlignment; |
| 3663 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 3664 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
| 3665 | if (vk_safe_modulo(pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment) != 0) { |
| 3666 | skip_call |= |
| 3667 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 3668 | VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, DEVICE_LIMIT, LayerName, |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3669 | "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 3670 | ") must be a multiple of device limit minStorageBufferOffsetAlignment 0x%" PRIxLEAST64, |
| 3671 | i, j, pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment); |
| 3672 | } |
| 3673 | } |
| 3674 | } |
| 3675 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3676 | } |
| 3677 | } |
| 3678 | |
| 3679 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3680 | get_dispatch_table(pc_device_table_map, device) |
| 3681 | ->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3682 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3683 | } |
| 3684 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3685 | VKAPI_ATTR VkResult VKAPI_CALL CreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3686 | const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3687 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3688 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3689 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3690 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3691 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3692 | skip_call |= parameter_validation_vkCreateFramebuffer(my_data->report_data, pCreateInfo, pAllocator, pFramebuffer); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3693 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3694 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3695 | result = get_dispatch_table(pc_device_table_map, device)->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer); |
| 3696 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3697 | validate_result(my_data->report_data, "vkCreateFramebuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3698 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3699 | |
| 3700 | return result; |
| 3701 | } |
| 3702 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3703 | VKAPI_ATTR void VKAPI_CALL DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator) { |
| 3704 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3705 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3706 | assert(my_data != NULL); |
| 3707 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3708 | skip_call |= parameter_validation_vkDestroyFramebuffer(my_data->report_data, framebuffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3709 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3710 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3711 | get_dispatch_table(pc_device_table_map, device)->DestroyFramebuffer(device, framebuffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3712 | } |
| 3713 | } |
| 3714 | |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3715 | bool PreCreateRenderPass(layer_data *dev_data, const VkRenderPassCreateInfo *pCreateInfo) { |
| 3716 | bool skip_call = false; |
| 3717 | uint32_t max_color_attachments = dev_data->device_limits.maxColorAttachments; |
| 3718 | |
| 3719 | for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) { |
| 3720 | if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) { |
| 3721 | skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3722 | __LINE__, DEVICE_LIMIT, "DL", "Cannot create a render pass with %d color attachments. Max is %d.", |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3723 | pCreateInfo->pSubpasses[i].colorAttachmentCount, max_color_attachments); |
| 3724 | } |
| 3725 | } |
| 3726 | return skip_call; |
| 3727 | } |
| 3728 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3729 | VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3730 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3731 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3732 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3733 | layer_data *my_data = get_my_data_ptr(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 | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3735 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3736 | skip_call |= parameter_validation_vkCreateRenderPass(my_data->report_data, pCreateInfo, pAllocator, pRenderPass); |
| 3737 | skip_call |= PreCreateRenderPass(my_data, pCreateInfo); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3738 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3739 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3740 | result = get_dispatch_table(pc_device_table_map, device)->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass); |
| 3741 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3742 | validate_result(my_data->report_data, "vkCreateRenderPass", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3743 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3744 | |
| 3745 | return result; |
| 3746 | } |
| 3747 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3748 | VKAPI_ATTR void VKAPI_CALL DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator) { |
| 3749 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3750 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3751 | assert(my_data != NULL); |
| 3752 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3753 | skip_call |= parameter_validation_vkDestroyRenderPass(my_data->report_data, renderPass, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3754 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3755 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3756 | get_dispatch_table(pc_device_table_map, device)->DestroyRenderPass(device, renderPass, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3757 | } |
| 3758 | } |
| 3759 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3760 | VKAPI_ATTR void VKAPI_CALL GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity) { |
| 3761 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3762 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3763 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3764 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3765 | skip_call |= parameter_validation_vkGetRenderAreaGranularity(my_data->report_data, renderPass, pGranularity); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3766 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3767 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3768 | get_dispatch_table(pc_device_table_map, device)->GetRenderAreaGranularity(device, renderPass, pGranularity); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3769 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3770 | } |
| 3771 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3772 | VKAPI_ATTR VkResult VKAPI_CALL CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3773 | const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3774 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3775 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3776 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3777 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3778 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3779 | skip_call |= |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 3780 | validate_queue_family_index(my_data, "vkCreateCommandPool", "pCreateInfo->queueFamilyIndex", pCreateInfo->queueFamilyIndex); |
Mark Lobodzinski | f20f094 | 2016-03-22 10:07:26 -0600 | [diff] [blame] | 3781 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3782 | skip_call |= parameter_validation_vkCreateCommandPool(my_data->report_data, pCreateInfo, pAllocator, pCommandPool); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3783 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3784 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3785 | result = get_dispatch_table(pc_device_table_map, device)->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); |
| 3786 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3787 | validate_result(my_data->report_data, "vkCreateCommandPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3788 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3789 | |
| 3790 | return result; |
| 3791 | } |
| 3792 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3793 | VKAPI_ATTR void VKAPI_CALL DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator) { |
| 3794 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3795 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3796 | assert(my_data != NULL); |
| 3797 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3798 | skip_call |= parameter_validation_vkDestroyCommandPool(my_data->report_data, commandPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3799 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3800 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3801 | get_dispatch_table(pc_device_table_map, device)->DestroyCommandPool(device, commandPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3802 | } |
| 3803 | } |
| 3804 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3805 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3806 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3807 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3808 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3809 | assert(my_data != NULL); |
| 3810 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3811 | skip_call |= parameter_validation_vkResetCommandPool(my_data->report_data, commandPool, flags); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3812 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3813 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3814 | result = get_dispatch_table(pc_device_table_map, device)->ResetCommandPool(device, commandPool, flags); |
| 3815 | |
| 3816 | validate_result(my_data->report_data, "vkResetCommandPool", result); |
| 3817 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3818 | |
| 3819 | return result; |
| 3820 | } |
| 3821 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3822 | VKAPI_ATTR VkResult VKAPI_CALL AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, |
| 3823 | VkCommandBuffer *pCommandBuffers) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3824 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3825 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3826 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3827 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3828 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3829 | skip_call |= parameter_validation_vkAllocateCommandBuffers(my_data->report_data, pAllocateInfo, pCommandBuffers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3830 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3831 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3832 | result = get_dispatch_table(pc_device_table_map, device)->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers); |
| 3833 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3834 | validate_result(my_data->report_data, "vkAllocateCommandBuffers", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3835 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3836 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3837 | return result; |
| 3838 | } |
| 3839 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3840 | 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] | 3841 | const VkCommandBuffer *pCommandBuffers) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3842 | bool skip_call = false; |
| 3843 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3844 | assert(device_data != nullptr); |
| 3845 | debug_report_data *report_data = device_data->report_data; |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3846 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3847 | skip_call |= parameter_validation_vkFreeCommandBuffers(report_data, commandPool, commandBufferCount, pCommandBuffers); |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3848 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3849 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3850 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 3851 | // validate_array() |
| 3852 | skip_call |= validate_array(report_data, "vkFreeCommandBuffers", "commandBufferCount", "pCommandBuffers", commandBufferCount, |
| 3853 | pCommandBuffers, true, true); |
| 3854 | |
| 3855 | if (!skip_call) { |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3856 | get_dispatch_table(pc_device_table_map, device) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3857 | ->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers); |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3858 | } |
| 3859 | } |
| 3860 | |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3861 | bool PreBeginCommandBuffer(layer_data *dev_data, VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) { |
| 3862 | bool skip_call = false; |
| 3863 | layer_data *phy_dev_data = get_my_data_ptr(get_dispatch_key(dev_data->physical_device), layer_data_map); |
| 3864 | const VkCommandBufferInheritanceInfo *pInfo = pBeginInfo->pInheritanceInfo; |
| 3865 | |
| 3866 | if (pInfo != NULL) { |
| 3867 | if ((phy_dev_data->physical_device_features.inheritedQueries == VK_FALSE) && (pInfo->occlusionQueryEnable != VK_FALSE)) { |
| 3868 | skip_call |= |
| 3869 | log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 3870 | reinterpret_cast<uint64_t>(commandBuffer), __LINE__, DEVICE_FEATURE, LayerName, |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3871 | "Cannot set inherited occlusionQueryEnable in vkBeginCommandBuffer() when device does not support " |
| 3872 | "inheritedQueries."); |
| 3873 | } |
| 3874 | |
| 3875 | if ((phy_dev_data->physical_device_features.inheritedQueries != VK_FALSE) && (pInfo->occlusionQueryEnable != VK_FALSE) && |
| 3876 | (!validate_VkQueryControlFlagBits(VkQueryControlFlagBits(pInfo->queryFlags)))) { |
| 3877 | skip_call |= |
| 3878 | log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 3879 | reinterpret_cast<uint64_t>(commandBuffer), __LINE__, DEVICE_FEATURE, LayerName, |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3880 | "Cannot enable in occlusion queries in vkBeginCommandBuffer() and set queryFlags to %d which is not a " |
| 3881 | "valid combination of VkQueryControlFlagBits.", |
| 3882 | pInfo->queryFlags); |
| 3883 | } |
| 3884 | } |
| 3885 | return skip_call; |
| 3886 | } |
| 3887 | |
| 3888 | VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3889 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3890 | bool skip_call = false; |
| 3891 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3892 | assert(device_data != nullptr); |
| 3893 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3894 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3895 | skip_call |= parameter_validation_vkBeginCommandBuffer(report_data, pBeginInfo); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3896 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3897 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3898 | // TODO: pBeginInfo->pInheritanceInfo must not be NULL if commandBuffer is a secondary command buffer |
| 3899 | skip_call |= validate_struct_type(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo", |
| 3900 | "VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO", pBeginInfo->pInheritanceInfo, |
| 3901 | VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, false); |
| 3902 | |
| 3903 | if (pBeginInfo->pInheritanceInfo != NULL) { |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3904 | skip_call |= validate_struct_pnext(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->pNext", NULL, |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 3905 | pBeginInfo->pInheritanceInfo->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3906 | |
| 3907 | skip_call |= validate_bool32(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->occlusionQueryEnable", |
| 3908 | pBeginInfo->pInheritanceInfo->occlusionQueryEnable); |
| 3909 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3910 | // TODO: This only needs to be validated when the inherited queries feature is enabled |
| 3911 | // skip_call |= validate_flags(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->queryFlags", |
| 3912 | // "VkQueryControlFlagBits", AllVkQueryControlFlagBits, pBeginInfo->pInheritanceInfo->queryFlags, false); |
| 3913 | |
| 3914 | // TODO: This must be 0 if the pipeline statistics queries feature is not enabled |
| 3915 | skip_call |= validate_flags(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->pipelineStatistics", |
| 3916 | "VkQueryPipelineStatisticFlagBits", AllVkQueryPipelineStatisticFlagBits, |
| 3917 | pBeginInfo->pInheritanceInfo->pipelineStatistics, false); |
| 3918 | } |
| 3919 | |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3920 | skip_call |= PreBeginCommandBuffer(device_data, commandBuffer, pBeginInfo); |
| 3921 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3922 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3923 | result = get_dispatch_table(pc_device_table_map, commandBuffer)->BeginCommandBuffer(commandBuffer, pBeginInfo); |
| 3924 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3925 | validate_result(report_data, "vkBeginCommandBuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3926 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3927 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3928 | return result; |
| 3929 | } |
| 3930 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3931 | VKAPI_ATTR VkResult VKAPI_CALL EndCommandBuffer(VkCommandBuffer commandBuffer) { |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3932 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3933 | assert(my_data != NULL); |
| 3934 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 3935 | VkResult result = get_dispatch_table(pc_device_table_map, commandBuffer)->EndCommandBuffer(commandBuffer); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3936 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3937 | validate_result(my_data->report_data, "vkEndCommandBuffer", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3938 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3939 | return result; |
| 3940 | } |
| 3941 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3942 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) { |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 3943 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3944 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3945 | assert(my_data != NULL); |
| 3946 | |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 3947 | bool skip_call = parameter_validation_vkResetCommandBuffer(my_data->report_data, flags); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3948 | |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 3949 | if (!skip_call) { |
| 3950 | result = get_dispatch_table(pc_device_table_map, commandBuffer)->ResetCommandBuffer(commandBuffer, flags); |
| 3951 | |
| 3952 | validate_result(my_data->report_data, "vkResetCommandBuffer", result); |
| 3953 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3954 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3955 | return result; |
| 3956 | } |
| 3957 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3958 | VKAPI_ATTR void VKAPI_CALL CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 3959 | VkPipeline pipeline) { |
| 3960 | bool skip_call = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3961 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3962 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3963 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3964 | skip_call |= parameter_validation_vkCmdBindPipeline(my_data->report_data, pipelineBindPoint, pipeline); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3965 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3966 | if (!skip_call) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3967 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline); |
| 3968 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3969 | } |
| 3970 | |
Mark Lobodzinski | 5a24296 | 2016-10-28 12:57:23 -0600 | [diff] [blame] | 3971 | bool preCmdSetViewport(debug_report_data *report_data, uint32_t viewport_count, const VkViewport *viewports) { |
| 3972 | bool skip = |
| 3973 | validate_array(report_data, "vkCmdSetViewport", "viewportCount", "pViewports", viewport_count, viewports, true, true); |
| 3974 | return skip; |
| 3975 | } |
| 3976 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3977 | VKAPI_ATTR void VKAPI_CALL CmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
| 3978 | const VkViewport *pViewports) { |
Mark Lobodzinski | b79b773 | 2016-10-28 12:59:47 -0600 | [diff] [blame] | 3979 | bool skip = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3980 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3981 | assert(my_data != NULL); |
| 3982 | |
Mark Lobodzinski | b79b773 | 2016-10-28 12:59:47 -0600 | [diff] [blame] | 3983 | skip |= preCmdSetViewport(my_data->report_data, viewportCount, pViewports); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3984 | |
Mark Lobodzinski | b79b773 | 2016-10-28 12:59:47 -0600 | [diff] [blame] | 3985 | if (!skip) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3986 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3987 | ->CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3988 | } |
Courtney Goeltzenleuchter | 078f817 | 2015-09-21 11:44:06 -0600 | [diff] [blame] | 3989 | } |
| 3990 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3991 | VKAPI_ATTR void VKAPI_CALL CmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, |
| 3992 | const VkRect2D *pScissors) { |
| 3993 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3994 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3995 | assert(my_data != NULL); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame^] | 3996 | debug_report_data *report_data = my_data->report_data; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3997 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3998 | skip_call |= parameter_validation_vkCmdSetScissor(my_data->report_data, firstScissor, scissorCount, pScissors); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3999 | |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame^] | 4000 | for (uint32_t scissorIndex = 0; scissorIndex < scissorCount; ++scissorIndex) { |
| 4001 | const VkRect2D &pScissor = pScissors[scissorIndex]; |
| 4002 | |
| 4003 | if (pScissor.offset.x < 0) { |
| 4004 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4005 | VALIDATION_ERROR_01489, LayerName, "vkCmdSetScissor %d: offset.x (%d) must not be negative. %s", |
| 4006 | scissorIndex, pScissor.offset.x, validation_error_map[VALIDATION_ERROR_01489]); |
| 4007 | } else if (static_cast<int32_t>(pScissor.extent.width) > (INT_MAX - pScissor.offset.x)) { |
| 4008 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4009 | VALIDATION_ERROR_01490, LayerName, |
| 4010 | "vkCmdSetScissor %d: adding offset.x (%d) and extent.width (%u) will overflow. %s", scissorIndex, |
| 4011 | pScissor.offset.x, pScissor.extent.width, validation_error_map[VALIDATION_ERROR_01490]); |
| 4012 | } |
| 4013 | |
| 4014 | if (pScissor.offset.y < 0) { |
| 4015 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4016 | VALIDATION_ERROR_01489, LayerName, "vkCmdSetScissor %d: offset.y (%d) must not be negative. %s", |
| 4017 | scissorIndex, pScissor.offset.y, validation_error_map[VALIDATION_ERROR_01489]); |
| 4018 | } else if (static_cast<int32_t>(pScissor.extent.height) > (INT_MAX - pScissor.offset.y)) { |
| 4019 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4020 | VALIDATION_ERROR_01491, LayerName, |
| 4021 | "vkCmdSetScissor %d: adding offset.y (%d) and extent.height (%u) will overflow. %s", scissorIndex, |
| 4022 | pScissor.offset.y, pScissor.extent.height, validation_error_map[VALIDATION_ERROR_01491]); |
| 4023 | } |
| 4024 | } |
| 4025 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4026 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4027 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors); |
| 4028 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4029 | } |
| 4030 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4031 | VKAPI_ATTR void VKAPI_CALL CmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4032 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetLineWidth(commandBuffer, lineWidth); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4033 | } |
| 4034 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4035 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, |
| 4036 | float depthBiasSlopeFactor) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4037 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4038 | ->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4039 | } |
| 4040 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4041 | VKAPI_ATTR void VKAPI_CALL CmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4042 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4043 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4044 | assert(my_data != NULL); |
| 4045 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4046 | skip_call |= parameter_validation_vkCmdSetBlendConstants(my_data->report_data, blendConstants); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4047 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4048 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4049 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetBlendConstants(commandBuffer, blendConstants); |
| 4050 | } |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 4051 | } |
| 4052 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4053 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4054 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds); |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 4055 | } |
| 4056 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4057 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, |
| 4058 | uint32_t compareMask) { |
| 4059 | bool skip_call = false; |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4060 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4061 | assert(my_data != NULL); |
| 4062 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4063 | skip_call |= parameter_validation_vkCmdSetStencilCompareMask(my_data->report_data, faceMask, compareMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4064 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4065 | if (!skip_call) { |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4066 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask); |
| 4067 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4068 | } |
| 4069 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4070 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) { |
| 4071 | bool skip_call = false; |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4072 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4073 | assert(my_data != NULL); |
| 4074 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4075 | skip_call |= parameter_validation_vkCmdSetStencilWriteMask(my_data->report_data, faceMask, writeMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4076 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4077 | if (!skip_call) { |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4078 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask); |
| 4079 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4080 | } |
| 4081 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4082 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) { |
| 4083 | bool skip_call = false; |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4084 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4085 | assert(my_data != NULL); |
| 4086 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4087 | skip_call |= parameter_validation_vkCmdSetStencilReference(my_data->report_data, faceMask, reference); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4088 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4089 | if (!skip_call) { |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4090 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetStencilReference(commandBuffer, faceMask, reference); |
| 4091 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4092 | } |
| 4093 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4094 | VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 4095 | VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, |
| 4096 | const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, |
| 4097 | const uint32_t *pDynamicOffsets) { |
| 4098 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4099 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4100 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4101 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4102 | skip_call |= |
| 4103 | parameter_validation_vkCmdBindDescriptorSets(my_data->report_data, pipelineBindPoint, layout, firstSet, descriptorSetCount, |
| 4104 | pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4105 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4106 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4107 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4108 | ->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, |
| 4109 | dynamicOffsetCount, pDynamicOffsets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4110 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4111 | } |
| 4112 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4113 | VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 4114 | VkIndexType indexType) { |
| 4115 | bool skip_call = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4116 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4117 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4118 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4119 | skip_call |= parameter_validation_vkCmdBindIndexBuffer(my_data->report_data, buffer, offset, indexType); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4120 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4121 | if (!skip_call) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4122 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType); |
| 4123 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4124 | } |
| 4125 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4126 | VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, |
| 4127 | const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) { |
| 4128 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4129 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4130 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4131 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4132 | skip_call |= parameter_validation_vkCmdBindVertexBuffers(my_data->report_data, firstBinding, bindingCount, pBuffers, pOffsets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4133 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4134 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4135 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4136 | ->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4137 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4138 | } |
| 4139 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4140 | bool PreCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, |
| 4141 | uint32_t firstInstance) { |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4142 | if (vertexCount == 0) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4143 | // 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] | 4144 | // this an error or leave as is. |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4145 | log_msg(mdd(commandBuffer), 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] | 4146 | REQUIRED_PARAMETER, LayerName, "vkCmdDraw parameter, uint32_t vertexCount, is 0"); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4147 | return false; |
| 4148 | } |
| 4149 | |
| 4150 | if (instanceCount == 0) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4151 | // 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] | 4152 | // this an error or leave as is. |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4153 | log_msg(mdd(commandBuffer), 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] | 4154 | REQUIRED_PARAMETER, LayerName, "vkCmdDraw parameter, uint32_t instanceCount, is 0"); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4155 | return false; |
| 4156 | } |
| 4157 | |
| 4158 | return true; |
| 4159 | } |
| 4160 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4161 | VKAPI_ATTR void VKAPI_CALL CmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, |
| 4162 | uint32_t firstVertex, uint32_t firstInstance) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4163 | PreCmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4164 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4165 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4166 | ->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4167 | } |
| 4168 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4169 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, |
| 4170 | uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4171 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4172 | ->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4173 | } |
| 4174 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4175 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, |
| 4176 | uint32_t stride) { |
| 4177 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4178 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4179 | assert(my_data != NULL); |
| 4180 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4181 | skip_call |= parameter_validation_vkCmdDrawIndirect(my_data->report_data, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4182 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4183 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4184 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDrawIndirect(commandBuffer, buffer, offset, count, stride); |
| 4185 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4186 | } |
| 4187 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4188 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 4189 | uint32_t count, uint32_t stride) { |
| 4190 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4191 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4192 | assert(my_data != NULL); |
| 4193 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4194 | skip_call |= parameter_validation_vkCmdDrawIndexedIndirect(my_data->report_data, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4195 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4196 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4197 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4198 | ->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, count, stride); |
| 4199 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4200 | } |
| 4201 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4202 | VKAPI_ATTR void VKAPI_CALL CmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4203 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDispatch(commandBuffer, x, y, z); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4204 | } |
| 4205 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4206 | VKAPI_ATTR void VKAPI_CALL CmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) { |
| 4207 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4208 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4209 | assert(my_data != NULL); |
| 4210 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4211 | skip_call |= parameter_validation_vkCmdDispatchIndirect(my_data->report_data, buffer, offset); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4212 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4213 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4214 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDispatchIndirect(commandBuffer, buffer, offset); |
| 4215 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4216 | } |
| 4217 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4218 | VKAPI_ATTR void VKAPI_CALL CmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, |
| 4219 | uint32_t regionCount, const VkBufferCopy *pRegions) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4220 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4221 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4222 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4223 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4224 | skip_call |= parameter_validation_vkCmdCopyBuffer(my_data->report_data, srcBuffer, dstBuffer, regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4225 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4226 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4227 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4228 | ->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4229 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4230 | } |
| 4231 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4232 | bool PreCmdCopyImage(VkCommandBuffer commandBuffer, const VkImageCopy *pRegions) { |
| 4233 | if (pRegions != nullptr) { |
| 4234 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4235 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4236 | log_msg(mdd(commandBuffer), 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] | 4237 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4238 | "vkCmdCopyImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 4239 | return false; |
| 4240 | } |
| 4241 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4242 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4243 | log_msg(mdd(commandBuffer), 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] | 4244 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4245 | "vkCmdCopyImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 4246 | return false; |
| 4247 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4248 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4249 | |
| 4250 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4251 | } |
| 4252 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4253 | VKAPI_ATTR void VKAPI_CALL CmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4254 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4255 | const VkImageCopy *pRegions) { |
| 4256 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4257 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4258 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4259 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4260 | skip_call |= parameter_validation_vkCmdCopyImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
| 4261 | regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4262 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4263 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4264 | PreCmdCopyImage(commandBuffer, pRegions); |
| 4265 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4266 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4267 | ->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4268 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4269 | } |
| 4270 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4271 | bool PreCmdBlitImage(VkCommandBuffer commandBuffer, const VkImageBlit *pRegions) { |
| 4272 | if (pRegions != nullptr) { |
| 4273 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4274 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4275 | log_msg(mdd(commandBuffer), 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] | 4276 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4277 | "vkCmdCopyImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 4278 | return false; |
| 4279 | } |
| 4280 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4281 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4282 | log_msg(mdd(commandBuffer), 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] | 4283 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4284 | "vkCmdCopyImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 4285 | return false; |
| 4286 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4287 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4288 | |
| 4289 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4290 | } |
| 4291 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4292 | VKAPI_ATTR void VKAPI_CALL CmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4293 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4294 | const VkImageBlit *pRegions, VkFilter filter) { |
| 4295 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4296 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4297 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4298 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4299 | skip_call |= parameter_validation_vkCmdBlitImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
| 4300 | regionCount, pRegions, filter); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4301 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4302 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4303 | PreCmdBlitImage(commandBuffer, pRegions); |
| 4304 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4305 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4306 | ->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4307 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4308 | } |
| 4309 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4310 | bool PreCmdCopyBufferToImage(VkCommandBuffer commandBuffer, const VkBufferImageCopy *pRegions) { |
| 4311 | if (pRegions != nullptr) { |
| 4312 | if ((pRegions->imageSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4313 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4314 | log_msg(mdd(commandBuffer), 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] | 4315 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4316 | "vkCmdCopyBufferToImage parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
| 4317 | "enumerator"); |
| 4318 | return false; |
| 4319 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4320 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4321 | |
| 4322 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4323 | } |
| 4324 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4325 | VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, |
| 4326 | VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4327 | const VkBufferImageCopy *pRegions) { |
| 4328 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4329 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4330 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4331 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4332 | skip_call |= parameter_validation_vkCmdCopyBufferToImage(my_data->report_data, srcBuffer, dstImage, dstImageLayout, regionCount, |
| 4333 | pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4334 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4335 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4336 | PreCmdCopyBufferToImage(commandBuffer, pRegions); |
| 4337 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4338 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4339 | ->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4340 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4341 | } |
| 4342 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4343 | bool PreCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, const VkBufferImageCopy *pRegions) { |
| 4344 | if (pRegions != nullptr) { |
| 4345 | if ((pRegions->imageSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4346 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4347 | log_msg(mdd(commandBuffer), 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] | 4348 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4349 | "vkCmdCopyImageToBuffer parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
| 4350 | "enumerator"); |
| 4351 | return false; |
| 4352 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4353 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4354 | |
| 4355 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4356 | } |
| 4357 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4358 | VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4359 | VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions) { |
| 4360 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4361 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4362 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4363 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4364 | skip_call |= parameter_validation_vkCmdCopyImageToBuffer(my_data->report_data, srcImage, srcImageLayout, dstBuffer, regionCount, |
| 4365 | pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4366 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4367 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4368 | PreCmdCopyImageToBuffer(commandBuffer, pRegions); |
| 4369 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4370 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4371 | ->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4372 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4373 | } |
| 4374 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4375 | VKAPI_ATTR void VKAPI_CALL CmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 4376 | VkDeviceSize dataSize, const uint32_t *pData) { |
| 4377 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4378 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4379 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4380 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4381 | skip_call |= parameter_validation_vkCmdUpdateBuffer(my_data->report_data, dstBuffer, dstOffset, dataSize, pData); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4382 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4383 | if (dstOffset & 3) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4384 | skip_call |= log_msg( |
| 4385 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, INVALID_USAGE, |
| 4386 | LayerName, "CmdUpdateBuffer parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4", dstOffset); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4387 | } |
| 4388 | |
| 4389 | if ((dataSize <= 0) || (dataSize > 65536)) { |
| 4390 | skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4391 | INVALID_USAGE, LayerName, "CmdUpdateBuffer parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 |
| 4392 | "), must be greater than zero and less than or equal to 65536", |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4393 | dataSize); |
| 4394 | } else if (dataSize & 3) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4395 | skip_call |= log_msg( |
| 4396 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, INVALID_USAGE, |
| 4397 | LayerName, "CmdUpdateBuffer parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 "), is not a multiple of 4", dataSize); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4398 | } |
| 4399 | |
| 4400 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4401 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4402 | ->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4403 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4404 | } |
| 4405 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4406 | VKAPI_ATTR void VKAPI_CALL CmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 4407 | VkDeviceSize size, uint32_t data) { |
| 4408 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4409 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4410 | assert(my_data != NULL); |
| 4411 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4412 | skip_call |= parameter_validation_vkCmdFillBuffer(my_data->report_data, dstBuffer, dstOffset, size, data); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4413 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4414 | if (dstOffset & 3) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4415 | skip_call |= log_msg( |
| 4416 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, INVALID_USAGE, |
| 4417 | LayerName, "vkCmdFillBuffer parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4", dstOffset); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4418 | } |
| 4419 | |
| 4420 | if (size != VK_WHOLE_SIZE) { |
| 4421 | if (size <= 0) { |
| 4422 | skip_call |= log_msg( |
| 4423 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, INVALID_USAGE, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4424 | LayerName, "vkCmdFillBuffer parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), must be greater than zero", size); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4425 | } else if (size & 3) { |
| 4426 | skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4427 | INVALID_USAGE, LayerName, |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4428 | "vkCmdFillBuffer parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), is not a multiple of 4", size); |
| 4429 | } |
| 4430 | } |
| 4431 | |
| 4432 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4433 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data); |
| 4434 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4435 | } |
| 4436 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4437 | VKAPI_ATTR void VKAPI_CALL CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 4438 | const VkClearColorValue *pColor, uint32_t rangeCount, |
| 4439 | const VkImageSubresourceRange *pRanges) { |
| 4440 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4441 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4442 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4443 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4444 | skip_call |= parameter_validation_vkCmdClearColorImage(my_data->report_data, image, imageLayout, pColor, rangeCount, pRanges); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4445 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4446 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4447 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4448 | ->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4449 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4450 | } |
| 4451 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4452 | VKAPI_ATTR void VKAPI_CALL CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 4453 | const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, |
| 4454 | const VkImageSubresourceRange *pRanges) { |
| 4455 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4456 | layer_data *my_data = get_my_data_ptr(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 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4459 | skip_call |= parameter_validation_vkCmdClearDepthStencilImage(my_data->report_data, image, imageLayout, pDepthStencil, |
| 4460 | rangeCount, pRanges); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4461 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4462 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4463 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4464 | ->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4465 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4466 | } |
| 4467 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4468 | VKAPI_ATTR void VKAPI_CALL CmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 4469 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
| 4470 | const VkClearRect *pRects) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4471 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4472 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4473 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4474 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4475 | skip_call |= parameter_validation_vkCmdClearAttachments(my_data->report_data, attachmentCount, pAttachments, rectCount, pRects); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4476 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4477 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4478 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4479 | ->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4480 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4481 | } |
| 4482 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4483 | bool PreCmdResolveImage(VkCommandBuffer commandBuffer, const VkImageResolve *pRegions) { |
| 4484 | if (pRegions != nullptr) { |
| 4485 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4486 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 4487 | log_msg( |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4488 | mdd(commandBuffer), 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] | 4489 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4490 | "vkCmdResolveImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 4491 | return false; |
| 4492 | } |
| 4493 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4494 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 4495 | log_msg( |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4496 | mdd(commandBuffer), 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] | 4497 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4498 | "vkCmdResolveImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 4499 | return false; |
| 4500 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4501 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4502 | |
| 4503 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4504 | } |
| 4505 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4506 | VKAPI_ATTR void VKAPI_CALL CmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4507 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4508 | const VkImageResolve *pRegions) { |
| 4509 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4510 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4511 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4512 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4513 | skip_call |= parameter_validation_vkCmdResolveImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
| 4514 | regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4515 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4516 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4517 | PreCmdResolveImage(commandBuffer, pRegions); |
| 4518 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4519 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4520 | ->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4521 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4522 | } |
| 4523 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4524 | VKAPI_ATTR void VKAPI_CALL CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
| 4525 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4526 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4527 | assert(my_data != NULL); |
| 4528 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4529 | skip_call |= parameter_validation_vkCmdSetEvent(my_data->report_data, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4530 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4531 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4532 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetEvent(commandBuffer, event, stageMask); |
| 4533 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4534 | } |
| 4535 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4536 | VKAPI_ATTR void VKAPI_CALL CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
| 4537 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4538 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4539 | assert(my_data != NULL); |
| 4540 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4541 | skip_call |= parameter_validation_vkCmdResetEvent(my_data->report_data, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4542 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4543 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4544 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdResetEvent(commandBuffer, event, stageMask); |
| 4545 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4546 | } |
| 4547 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4548 | VKAPI_ATTR void VKAPI_CALL CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, |
| 4549 | VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, |
| 4550 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 4551 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 4552 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
| 4553 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4554 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4555 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4556 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4557 | skip_call |= parameter_validation_vkCmdWaitEvents(my_data->report_data, eventCount, pEvents, srcStageMask, dstStageMask, |
| 4558 | memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, |
| 4559 | pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4560 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4561 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4562 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4563 | ->CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, |
| 4564 | bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
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 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4568 | VKAPI_ATTR void VKAPI_CALL CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, |
| 4569 | VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, |
| 4570 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 4571 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 4572 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
| 4573 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4574 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4575 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4576 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4577 | skip_call |= parameter_validation_vkCmdPipelineBarrier(my_data->report_data, srcStageMask, dstStageMask, dependencyFlags, |
| 4578 | memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, |
| 4579 | pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4580 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4581 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4582 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4583 | ->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, |
| 4584 | bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4585 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4586 | } |
| 4587 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4588 | VKAPI_ATTR void VKAPI_CALL CmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot, |
| 4589 | VkQueryControlFlags flags) { |
| 4590 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4591 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4592 | assert(my_data != NULL); |
| 4593 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4594 | skip_call |= parameter_validation_vkCmdBeginQuery(my_data->report_data, queryPool, slot, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4595 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4596 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4597 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBeginQuery(commandBuffer, queryPool, slot, flags); |
| 4598 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4599 | } |
| 4600 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4601 | VKAPI_ATTR void VKAPI_CALL CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4602 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4603 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4604 | assert(my_data != NULL); |
| 4605 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4606 | skip_call |= parameter_validation_vkCmdEndQuery(my_data->report_data, queryPool, slot); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4607 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4608 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4609 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdEndQuery(commandBuffer, queryPool, slot); |
| 4610 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4611 | } |
| 4612 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4613 | VKAPI_ATTR void VKAPI_CALL CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 4614 | uint32_t queryCount) { |
| 4615 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4616 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4617 | assert(my_data != NULL); |
| 4618 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4619 | skip_call |= parameter_validation_vkCmdResetQueryPool(my_data->report_data, queryPool, firstQuery, queryCount); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4620 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4621 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4622 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); |
| 4623 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4624 | } |
| 4625 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4626 | bool PostCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, |
| 4627 | uint32_t slot) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4628 | |
Chia-I Wu | 51ce5ea | 2015-10-26 19:40:27 +0800 | [diff] [blame] | 4629 | ValidateEnumerator(pipelineStage); |
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 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4634 | VKAPI_ATTR void VKAPI_CALL CmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, |
| 4635 | VkQueryPool queryPool, uint32_t query) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4636 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4637 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4638 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4639 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4640 | skip_call |= parameter_validation_vkCmdWriteTimestamp(my_data->report_data, pipelineStage, queryPool, query); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4641 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4642 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4643 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 4644 | |
| 4645 | PostCmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 4646 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4647 | } |
| 4648 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4649 | VKAPI_ATTR void VKAPI_CALL CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 4650 | uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 4651 | VkDeviceSize stride, VkQueryResultFlags flags) { |
| 4652 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4653 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4654 | assert(my_data != NULL); |
| 4655 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4656 | skip_call |= parameter_validation_vkCmdCopyQueryPoolResults(my_data->report_data, queryPool, firstQuery, queryCount, dstBuffer, |
| 4657 | dstOffset, stride, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4658 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4659 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4660 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4661 | ->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags); |
| 4662 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4663 | } |
| 4664 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4665 | VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, |
| 4666 | uint32_t offset, uint32_t size, const void *pValues) { |
| 4667 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4668 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4669 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4670 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4671 | skip_call |= parameter_validation_vkCmdPushConstants(my_data->report_data, layout, stageFlags, offset, size, pValues); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4672 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4673 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4674 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4675 | ->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4676 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4677 | } |
| 4678 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4679 | VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, |
| 4680 | VkSubpassContents contents) { |
| 4681 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4682 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4683 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4684 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4685 | skip_call |= parameter_validation_vkCmdBeginRenderPass(my_data->report_data, pRenderPassBegin, contents); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4686 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4687 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4688 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4689 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4690 | } |
| 4691 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4692 | VKAPI_ATTR void VKAPI_CALL CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4693 | bool skip_call = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4694 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4695 | assert(my_data != NULL); |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 4696 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4697 | skip_call |= parameter_validation_vkCmdNextSubpass(my_data->report_data, contents); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4698 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4699 | if (!skip_call) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4700 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdNextSubpass(commandBuffer, contents); |
| 4701 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4702 | } |
| 4703 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4704 | VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4705 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdEndRenderPass(commandBuffer); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4706 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4707 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4708 | VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, |
| 4709 | const VkCommandBuffer *pCommandBuffers) { |
| 4710 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4711 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4712 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4713 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4714 | skip_call |= parameter_validation_vkCmdExecuteCommands(my_data->report_data, commandBufferCount, pCommandBuffers); |
Chia-I Wu | 0b50a1c | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 4715 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4716 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4717 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4718 | ->CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4719 | } |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 4720 | } |
| 4721 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4722 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 4723 | return util_GetLayerProperties(1, &global_layer, pCount, pProperties); |
| 4724 | } |
| 4725 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4726 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 4727 | VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 4728 | return util_GetLayerProperties(1, &global_layer, pCount, pProperties); |
| 4729 | } |
| 4730 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4731 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 4732 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 4733 | if (pLayerName && !strcmp(pLayerName, global_layer.layerName)) |
| 4734 | return util_GetExtensionProperties(1, instance_extensions, pCount, pProperties); |
| 4735 | |
| 4736 | return VK_ERROR_LAYER_NOT_PRESENT; |
| 4737 | } |
| 4738 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4739 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, |
| 4740 | uint32_t *pCount, VkExtensionProperties *pProperties) { |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 4741 | /* parameter_validation does not have any physical device extensions */ |
Chia-I Wu | 76a3466 | 2016-05-16 07:34:09 +0800 | [diff] [blame] | 4742 | if (pLayerName && !strcmp(pLayerName, global_layer.layerName)) |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 4743 | return util_GetExtensionProperties(0, NULL, pCount, pProperties); |
Chia-I Wu | 76a3466 | 2016-05-16 07:34:09 +0800 | [diff] [blame] | 4744 | |
| 4745 | assert(physicalDevice); |
| 4746 | |
| 4747 | return get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4748 | ->EnumerateDeviceExtensionProperties(physicalDevice, NULL, pCount, pProperties); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 4749 | } |
| 4750 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4751 | // WSI Extension Functions |
| 4752 | |
| 4753 | VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4754 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4755 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4756 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4757 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 4758 | assert(my_data != NULL); |
| 4759 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4760 | skip_call |= parameter_validation_vkCreateSwapchainKHR(my_data->report_data, pCreateInfo, pAllocator, pSwapchain); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4761 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4762 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4763 | result = get_dispatch_table(pc_device_table_map, device)->CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); |
| 4764 | |
| 4765 | validate_result(my_data->report_data, "vkCreateSwapchainKHR", result); |
| 4766 | } |
| 4767 | |
| 4768 | return result; |
| 4769 | } |
| 4770 | |
| 4771 | 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] | 4772 | VkImage *pSwapchainImages) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4773 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4774 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4775 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 4776 | assert(my_data != NULL); |
| 4777 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4778 | skip_call |= |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4779 | parameter_validation_vkGetSwapchainImagesKHR(my_data->report_data, swapchain, pSwapchainImageCount, pSwapchainImages); |
| 4780 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4781 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4782 | result = get_dispatch_table(pc_device_table_map, device) |
| 4783 | ->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); |
| 4784 | |
| 4785 | validate_result(my_data->report_data, "vkGetSwapchainImagesKHR", result); |
| 4786 | } |
| 4787 | |
| 4788 | return result; |
| 4789 | } |
| 4790 | |
| 4791 | 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] | 4792 | VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4793 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4794 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4795 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 4796 | assert(my_data != NULL); |
| 4797 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4798 | skip_call |= |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4799 | parameter_validation_vkAcquireNextImageKHR(my_data->report_data, swapchain, timeout, semaphore, fence, pImageIndex); |
| 4800 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4801 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4802 | result = get_dispatch_table(pc_device_table_map, device) |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4803 | ->AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4804 | |
| 4805 | validate_result(my_data->report_data, "vkAcquireNextImageKHR", result); |
| 4806 | } |
| 4807 | |
| 4808 | return result; |
| 4809 | } |
| 4810 | |
| 4811 | VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { |
| 4812 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4813 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4814 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map); |
| 4815 | assert(my_data != NULL); |
| 4816 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4817 | skip_call |= parameter_validation_vkQueuePresentKHR(my_data->report_data, pPresentInfo); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4818 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4819 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4820 | result = get_dispatch_table(pc_device_table_map, queue)->QueuePresentKHR(queue, pPresentInfo); |
| 4821 | |
| 4822 | validate_result(my_data->report_data, "vkQueuePresentKHR", result); |
| 4823 | } |
| 4824 | |
| 4825 | return result; |
| 4826 | } |
| 4827 | |
| 4828 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, |
| 4829 | VkSurfaceKHR surface, VkBool32 *pSupported) { |
| 4830 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4831 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4832 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4833 | assert(my_data != NULL); |
| 4834 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4835 | skip_call |= |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4836 | parameter_validation_vkGetPhysicalDeviceSurfaceSupportKHR(my_data->report_data, queueFamilyIndex, surface, pSupported); |
| 4837 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4838 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4839 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4840 | ->GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported); |
| 4841 | |
| 4842 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceSupportKHR", result); |
| 4843 | } |
| 4844 | |
| 4845 | return result; |
| 4846 | } |
| 4847 | |
| 4848 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 4849 | VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { |
| 4850 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4851 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4852 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4853 | assert(my_data != NULL); |
| 4854 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4855 | skip_call |= |
| 4856 | parameter_validation_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(my_data->report_data, surface, pSurfaceCapabilities); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4857 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4858 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4859 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4860 | ->GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities); |
| 4861 | |
| 4862 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR", result); |
| 4863 | } |
| 4864 | |
| 4865 | return result; |
| 4866 | } |
| 4867 | |
| 4868 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 4869 | uint32_t *pSurfaceFormatCount, |
| 4870 | VkSurfaceFormatKHR *pSurfaceFormats) { |
| 4871 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4872 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4873 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4874 | assert(my_data != NULL); |
| 4875 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4876 | skip_call |= parameter_validation_vkGetPhysicalDeviceSurfaceFormatsKHR(my_data->report_data, surface, pSurfaceFormatCount, |
| 4877 | pSurfaceFormats); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4878 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4879 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4880 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4881 | ->GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats); |
| 4882 | |
| 4883 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceFormatsKHR", result); |
| 4884 | } |
| 4885 | |
| 4886 | return result; |
| 4887 | } |
| 4888 | |
| 4889 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 4890 | uint32_t *pPresentModeCount, |
| 4891 | VkPresentModeKHR *pPresentModes) { |
| 4892 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4893 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4894 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4895 | assert(my_data != NULL); |
| 4896 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4897 | skip_call |= parameter_validation_vkGetPhysicalDeviceSurfacePresentModesKHR(my_data->report_data, surface, pPresentModeCount, |
| 4898 | pPresentModes); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4899 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4900 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4901 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4902 | ->GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes); |
| 4903 | |
| 4904 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfacePresentModesKHR", result); |
| 4905 | } |
| 4906 | |
| 4907 | return result; |
| 4908 | } |
| 4909 | |
| 4910 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 4911 | VKAPI_ATTR VkResult VKAPI_CALL CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
| 4912 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 4913 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 4914 | |
| 4915 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 4916 | assert(my_data != NULL); |
| 4917 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4918 | bool skip_call = parameter_validation_vkCreateWin32SurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4919 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4920 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4921 | result = |
| 4922 | get_dispatch_table(pc_instance_table_map, instance)->CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 4923 | } |
| 4924 | |
| 4925 | validate_result(my_data->report_data, "vkCreateWin32SurfaceKHR", result); |
| 4926 | |
| 4927 | return result; |
| 4928 | } |
| 4929 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4930 | |
| 4931 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 4932 | VKAPI_ATTR VkResult VKAPI_CALL CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, |
| 4933 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 4934 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 4935 | |
| 4936 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 4937 | assert(my_data != NULL); |
| 4938 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4939 | bool skip_call = parameter_validation_vkCreateXcbSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4940 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4941 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4942 | result = |
| 4943 | get_dispatch_table(pc_instance_table_map, instance)->CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 4944 | } |
| 4945 | |
| 4946 | validate_result(my_data->report_data, "vkCreateXcbSurfaceKHR", result); |
| 4947 | |
| 4948 | return result; |
| 4949 | } |
| 4950 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4951 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 4952 | uint32_t queueFamilyIndex, xcb_connection_t *connection, |
| 4953 | xcb_visualid_t visual_id) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4954 | VkBool32 result = false; |
| 4955 | |
| 4956 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4957 | assert(my_data != NULL); |
| 4958 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4959 | bool skip_call = parameter_validation_vkGetPhysicalDeviceXcbPresentationSupportKHR(my_data->report_data, queueFamilyIndex, |
| 4960 | connection, visual_id); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4961 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4962 | if (!skip_call) { |
| 4963 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4964 | ->GetPhysicalDeviceXcbPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection, visual_id); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4965 | } |
| 4966 | |
| 4967 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4968 | } |
| 4969 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 4970 | |
| 4971 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 4972 | VKAPI_ATTR VkResult VKAPI_CALL CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4973 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4974 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 4975 | |
| 4976 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 4977 | assert(my_data != NULL); |
| 4978 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4979 | bool skip_call = parameter_validation_vkCreateXlibSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4980 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4981 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4982 | result = |
| 4983 | get_dispatch_table(pc_instance_table_map, instance)->CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 4984 | } |
| 4985 | |
| 4986 | validate_result(my_data->report_data, "vkCreateXlibSurfaceKHR", result); |
| 4987 | |
| 4988 | return result; |
| 4989 | } |
| 4990 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4991 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 4992 | uint32_t queueFamilyIndex, Display *dpy, |
| 4993 | VisualID visualID) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4994 | VkBool32 result = false; |
| 4995 | |
| 4996 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4997 | assert(my_data != NULL); |
| 4998 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4999 | bool skip_call = |
| 5000 | parameter_validation_vkGetPhysicalDeviceXlibPresentationSupportKHR(my_data->report_data, queueFamilyIndex, dpy, visualID); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5001 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5002 | if (!skip_call) { |
| 5003 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 5004 | ->GetPhysicalDeviceXlibPresentationSupportKHR(physicalDevice, queueFamilyIndex, dpy, visualID); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5005 | } |
Karl Schultz | 3a41cae | 2016-09-02 10:17:05 -0600 | [diff] [blame] | 5006 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5007 | } |
| 5008 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 5009 | |
| 5010 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 5011 | VKAPI_ATTR VkResult VKAPI_CALL CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5012 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5013 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5014 | |
| 5015 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 5016 | assert(my_data != NULL); |
| 5017 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5018 | bool skip_call = parameter_validation_vkCreateMirSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5019 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5020 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5021 | result = |
| 5022 | get_dispatch_table(pc_instance_table_map, instance)->CreateMirSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 5023 | } |
| 5024 | |
| 5025 | validate_result(my_data->report_data, "vkCreateMirSurfaceKHR", result); |
| 5026 | |
| 5027 | return result; |
| 5028 | } |
| 5029 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5030 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5031 | uint32_t queueFamilyIndex, MirConnection *connection) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5032 | VkBool32 result = false; |
| 5033 | |
| 5034 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5035 | assert(my_data != NULL); |
| 5036 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5037 | bool skip_call = |
| 5038 | parameter_validation_vkGetPhysicalDeviceMirPresentationSupportKHR(my_data->report_data, queueFamilyIndex, connection); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5039 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5040 | if (!skip_call) { |
| 5041 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 5042 | ->GetPhysicalDeviceMirPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5043 | } |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5044 | } |
| 5045 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 5046 | |
| 5047 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 5048 | VKAPI_ATTR VkResult VKAPI_CALL CreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5049 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5050 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5051 | |
| 5052 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 5053 | assert(my_data != NULL); |
| 5054 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5055 | bool skip_call = parameter_validation_vkCreateWaylandSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5056 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5057 | if (!skip_call) { |
| 5058 | result = get_dispatch_table(pc_instance_table_map, instance) |
| 5059 | ->CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5060 | } |
| 5061 | |
| 5062 | validate_result(my_data->report_data, "vkCreateWaylandSurfaceKHR", result); |
| 5063 | |
| 5064 | return result; |
| 5065 | } |
| 5066 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5067 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5068 | uint32_t queueFamilyIndex, |
| 5069 | struct wl_display *display) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5070 | VkBool32 result = false; |
| 5071 | |
| 5072 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5073 | assert(my_data != NULL); |
| 5074 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5075 | bool skip_call = |
| 5076 | parameter_validation_vkGetPhysicalDeviceWaylandPresentationSupportKHR(my_data->report_data, queueFamilyIndex, display); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5077 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5078 | if (!skip_call) { |
| 5079 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 5080 | ->GetPhysicalDeviceWaylandPresentationSupportKHR(physicalDevice, queueFamilyIndex, display); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5081 | } |
| 5082 | } |
| 5083 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 5084 | |
| 5085 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 5086 | VKAPI_ATTR VkResult VKAPI_CALL CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5087 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5088 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5089 | |
| 5090 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 5091 | assert(my_data != NULL); |
| 5092 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5093 | bool skip_call = parameter_validation_vkCreateAndroidSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5094 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5095 | if (!skip_call) { |
| 5096 | result = get_dispatch_table(pc_instance_table_map, instance) |
| 5097 | ->CreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5098 | } |
| 5099 | |
| 5100 | validate_result(my_data->report_data, "vkCreateAndroidSurfaceKHR", result); |
| 5101 | |
| 5102 | return result; |
| 5103 | } |
| 5104 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 5105 | |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5106 | VKAPI_ATTR VkResult VKAPI_CALL CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, |
| 5107 | const VkSwapchainCreateInfoKHR *pCreateInfos, |
| 5108 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) { |
| 5109 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5110 | bool skip_call = false; |
| 5111 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 5112 | assert(my_data != NULL); |
| 5113 | |
| 5114 | skip_call |= parameter_validation_vkCreateSharedSwapchainsKHR(my_data->report_data, swapchainCount, pCreateInfos, pAllocator, |
| 5115 | pSwapchains); |
| 5116 | |
| 5117 | if (!skip_call) { |
| 5118 | result = get_dispatch_table(pc_device_table_map, device) |
| 5119 | ->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); |
| 5120 | |
| 5121 | validate_result(my_data->report_data, "vkCreateSharedSwapchainsKHR", result); |
| 5122 | } |
| 5123 | |
| 5124 | return result; |
| 5125 | } |
| 5126 | |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 5127 | // VK_EXT_debug_marker Extension |
| 5128 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT(VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { |
| 5129 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5130 | bool skip_call = false; |
| 5131 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 5132 | assert(my_data != NULL); |
| 5133 | |
| 5134 | skip_call |= parameter_validation_vkDebugMarkerSetObjectTagEXT(my_data->report_data, pTagInfo); |
| 5135 | |
| 5136 | if (!skip_call) { |
| 5137 | result = get_dispatch_table(pc_device_table_map, device)->DebugMarkerSetObjectTagEXT(device, pTagInfo); |
| 5138 | |
| 5139 | validate_result(my_data->report_data, "vkDebugMarkerSetObjectTagEXT", result); |
| 5140 | } |
| 5141 | |
| 5142 | return result; |
| 5143 | } |
| 5144 | |
| 5145 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT(VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { |
| 5146 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5147 | bool skip_call = false; |
| 5148 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 5149 | assert(my_data != NULL); |
| 5150 | |
| 5151 | skip_call |= parameter_validation_vkDebugMarkerSetObjectNameEXT(my_data->report_data, pNameInfo); |
| 5152 | |
| 5153 | if (!skip_call) { |
| 5154 | VkResult result = get_dispatch_table(pc_device_table_map, device)->DebugMarkerSetObjectNameEXT(device, pNameInfo); |
| 5155 | |
| 5156 | validate_result(my_data->report_data, "vkDebugMarkerSetObjectNameEXT", result); |
| 5157 | } |
| 5158 | |
| 5159 | return result; |
| 5160 | } |
| 5161 | |
| 5162 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
| 5163 | bool skip_call = false; |
| 5164 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5165 | assert(my_data != NULL); |
| 5166 | |
| 5167 | skip_call |= parameter_validation_vkCmdDebugMarkerBeginEXT(my_data->report_data, pMarkerInfo); |
| 5168 | |
| 5169 | if (!skip_call) { |
| 5170 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo); |
| 5171 | } |
| 5172 | } |
| 5173 | |
| 5174 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
| 5175 | bool skip_call = false; |
| 5176 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5177 | assert(my_data != NULL); |
| 5178 | |
| 5179 | skip_call |= parameter_validation_vkCmdDebugMarkerInsertEXT(my_data->report_data, pMarkerInfo); |
| 5180 | |
| 5181 | if (!skip_call) { |
| 5182 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo); |
| 5183 | } |
| 5184 | } |
| 5185 | |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 5186 | // VK_NV_external_memory_capabilities Extension |
| 5187 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceExternalImageFormatPropertiesNV( |
| 5188 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, |
| 5189 | VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, |
| 5190 | VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) { |
| 5191 | |
| 5192 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5193 | bool skip_call = false; |
| 5194 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5195 | assert(my_data != NULL); |
| 5196 | |
| 5197 | skip_call |= parameter_validation_vkGetPhysicalDeviceExternalImageFormatPropertiesNV( |
| 5198 | my_data->report_data, format, type, tiling, usage, flags, externalHandleType, pExternalImageFormatProperties); |
| 5199 | |
| 5200 | if (!skip_call) { |
| 5201 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 5202 | ->GetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice, format, type, tiling, usage, flags, |
| 5203 | externalHandleType, pExternalImageFormatProperties); |
| 5204 | |
| 5205 | validate_result(my_data->report_data, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV", result); |
| 5206 | } |
| 5207 | |
| 5208 | return result; |
| 5209 | } |
| 5210 | |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 5211 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 5212 | // VK_NV_external_memory_win32 Extension |
| 5213 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleNV(VkDevice device, VkDeviceMemory memory, |
| 5214 | VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE *pHandle) { |
| 5215 | |
| 5216 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5217 | bool skip_call = false; |
| 5218 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 5219 | assert(my_data != NULL); |
| 5220 | |
| 5221 | skip_call |= parameter_validation_vkGetMemoryWin32HandleNV(my_data->report_data, memory, handleType, pHandle); |
| 5222 | |
| 5223 | if (!skip_call) { |
| 5224 | result = get_dispatch_table(pc_device_table_map, device)->GetMemoryWin32HandleNV(device, memory, handleType, pHandle); |
| 5225 | } |
| 5226 | |
| 5227 | return result; |
| 5228 | } |
| 5229 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 5230 | |
| 5231 | |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 5232 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5233 | static PFN_vkVoidFunction intercept_core_instance_command(const char *name); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5234 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5235 | static PFN_vkVoidFunction intercept_core_device_command(const char *name); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5236 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5237 | static PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkDevice device); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5238 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5239 | static PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkInstance instance); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5240 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5241 | 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] | 5242 | assert(device); |
| 5243 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 5244 | layer_data *data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 5245 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 5246 | if (validate_string(data->report_data, "vkGetDeviceProcAddr", "funcName", funcName)) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 5247 | return NULL; |
| 5248 | } |
| 5249 | |
Chia-I Wu | f9b0138 | 2016-05-16 07:37:41 +0800 | [diff] [blame] | 5250 | PFN_vkVoidFunction proc = intercept_core_device_command(funcName); |
| 5251 | if (proc) |
| 5252 | return proc; |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 5253 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5254 | proc = InterceptWsiEnabledCommand(funcName, device); |
| 5255 | if (proc) |
| 5256 | return proc; |
| 5257 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 5258 | if (get_dispatch_table(pc_device_table_map, device)->GetDeviceProcAddr == NULL) |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 5259 | return NULL; |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 5260 | return get_dispatch_table(pc_device_table_map, device)->GetDeviceProcAddr(device, funcName); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 5261 | } |
| 5262 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5263 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char *funcName) { |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5264 | PFN_vkVoidFunction proc = intercept_core_instance_command(funcName); |
Chia-I Wu | 02f01a3 | 2016-05-16 07:45:43 +0800 | [diff] [blame] | 5265 | if (!proc) |
| 5266 | proc = intercept_core_device_command(funcName); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5267 | |
| 5268 | if (!proc) |
| 5269 | proc = InterceptWsiEnabledCommand(funcName, VkDevice(VK_NULL_HANDLE)); |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5270 | |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5271 | if (proc) |
| 5272 | return proc; |
Courtney Goeltzenleuchter | 500b89b | 2015-06-01 14:45:27 -0600 | [diff] [blame] | 5273 | |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5274 | assert(instance); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 5275 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 5276 | layer_data *data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 5277 | |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5278 | proc = debug_report_get_instance_proc_addr(data->report_data, funcName); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5279 | if (!proc) |
| 5280 | proc = InterceptWsiEnabledCommand(funcName, instance); |
| 5281 | |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5282 | if (proc) |
| 5283 | return proc; |
Courtney Goeltzenleuchter | 500b89b | 2015-06-01 14:45:27 -0600 | [diff] [blame] | 5284 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 5285 | if (get_dispatch_table(pc_instance_table_map, instance)->GetInstanceProcAddr == NULL) |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 5286 | return NULL; |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 5287 | return get_dispatch_table(pc_instance_table_map, instance)->GetInstanceProcAddr(instance, funcName); |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 5288 | } |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5289 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5290 | static PFN_vkVoidFunction intercept_core_instance_command(const char *name) { |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5291 | static const struct { |
| 5292 | const char *name; |
| 5293 | PFN_vkVoidFunction proc; |
| 5294 | } core_instance_commands[] = { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5295 | {"vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetInstanceProcAddr)}, |
| 5296 | {"vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(CreateInstance)}, |
| 5297 | {"vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(DestroyInstance)}, |
| 5298 | {"vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(CreateDevice)}, |
| 5299 | {"vkEnumeratePhysicalDevices", reinterpret_cast<PFN_vkVoidFunction>(EnumeratePhysicalDevices)}, |
| 5300 | {"vkGetPhysicalDeviceProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceProperties)}, |
| 5301 | {"vkGetPhysicalDeviceFeatures", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceFeatures)}, |
| 5302 | {"vkGetPhysicalDeviceFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceFormatProperties)}, |
| 5303 | {"vkGetPhysicalDeviceImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceImageFormatProperties)}, |
| 5304 | {"vkGetPhysicalDeviceSparseImageFormatProperties", |
| 5305 | reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSparseImageFormatProperties)}, |
| 5306 | {"vkGetPhysicalDeviceQueueFamilyProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceQueueFamilyProperties)}, |
| 5307 | {"vkGetPhysicalDeviceMemoryProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceMemoryProperties)}, |
| 5308 | {"vkEnumerateInstanceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceLayerProperties)}, |
| 5309 | {"vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceLayerProperties)}, |
| 5310 | {"vkEnumerateInstanceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceExtensionProperties)}, |
| 5311 | {"vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceExtensionProperties)}, |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 5312 | {"vkGetPhysicalDeviceExternalImageFormatPropertiesNV", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceExternalImageFormatPropertiesNV) }, |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5313 | }; |
| 5314 | |
| 5315 | for (size_t i = 0; i < ARRAY_SIZE(core_instance_commands); i++) { |
| 5316 | if (!strcmp(core_instance_commands[i].name, name)) |
| 5317 | return core_instance_commands[i].proc; |
| 5318 | } |
| 5319 | |
| 5320 | return nullptr; |
| 5321 | } |
| 5322 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5323 | static PFN_vkVoidFunction intercept_core_device_command(const char *name) { |
Chia-I Wu | f9b0138 | 2016-05-16 07:37:41 +0800 | [diff] [blame] | 5324 | static const struct { |
| 5325 | const char *name; |
| 5326 | PFN_vkVoidFunction proc; |
| 5327 | } core_device_commands[] = { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5328 | {"vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr)}, |
| 5329 | {"vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice)}, |
| 5330 | {"vkGetDeviceQueue", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceQueue)}, |
| 5331 | {"vkQueueSubmit", reinterpret_cast<PFN_vkVoidFunction>(QueueSubmit)}, |
| 5332 | {"vkQueueWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(QueueWaitIdle)}, |
| 5333 | {"vkDeviceWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(DeviceWaitIdle)}, |
| 5334 | {"vkAllocateMemory", reinterpret_cast<PFN_vkVoidFunction>(AllocateMemory)}, |
| 5335 | {"vkFreeMemory", reinterpret_cast<PFN_vkVoidFunction>(FreeMemory)}, |
| 5336 | {"vkMapMemory", reinterpret_cast<PFN_vkVoidFunction>(MapMemory)}, |
| 5337 | {"vkUnmapMemory", reinterpret_cast<PFN_vkVoidFunction>(UnmapMemory)}, |
| 5338 | {"vkFlushMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(FlushMappedMemoryRanges)}, |
| 5339 | {"vkInvalidateMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(InvalidateMappedMemoryRanges)}, |
| 5340 | {"vkGetDeviceMemoryCommitment", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceMemoryCommitment)}, |
| 5341 | {"vkBindBufferMemory", reinterpret_cast<PFN_vkVoidFunction>(BindBufferMemory)}, |
| 5342 | {"vkBindImageMemory", reinterpret_cast<PFN_vkVoidFunction>(BindImageMemory)}, |
| 5343 | {"vkCreateFence", reinterpret_cast<PFN_vkVoidFunction>(CreateFence)}, |
| 5344 | {"vkDestroyFence", reinterpret_cast<PFN_vkVoidFunction>(DestroyFence)}, |
| 5345 | {"vkResetFences", reinterpret_cast<PFN_vkVoidFunction>(ResetFences)}, |
| 5346 | {"vkGetFenceStatus", reinterpret_cast<PFN_vkVoidFunction>(GetFenceStatus)}, |
| 5347 | {"vkWaitForFences", reinterpret_cast<PFN_vkVoidFunction>(WaitForFences)}, |
| 5348 | {"vkCreateSemaphore", reinterpret_cast<PFN_vkVoidFunction>(CreateSemaphore)}, |
| 5349 | {"vkDestroySemaphore", reinterpret_cast<PFN_vkVoidFunction>(DestroySemaphore)}, |
| 5350 | {"vkCreateEvent", reinterpret_cast<PFN_vkVoidFunction>(CreateEvent)}, |
| 5351 | {"vkDestroyEvent", reinterpret_cast<PFN_vkVoidFunction>(DestroyEvent)}, |
| 5352 | {"vkGetEventStatus", reinterpret_cast<PFN_vkVoidFunction>(GetEventStatus)}, |
| 5353 | {"vkSetEvent", reinterpret_cast<PFN_vkVoidFunction>(SetEvent)}, |
| 5354 | {"vkResetEvent", reinterpret_cast<PFN_vkVoidFunction>(ResetEvent)}, |
| 5355 | {"vkCreateQueryPool", reinterpret_cast<PFN_vkVoidFunction>(CreateQueryPool)}, |
| 5356 | {"vkDestroyQueryPool", reinterpret_cast<PFN_vkVoidFunction>(DestroyQueryPool)}, |
| 5357 | {"vkGetQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(GetQueryPoolResults)}, |
| 5358 | {"vkCreateBuffer", reinterpret_cast<PFN_vkVoidFunction>(CreateBuffer)}, |
| 5359 | {"vkDestroyBuffer", reinterpret_cast<PFN_vkVoidFunction>(DestroyBuffer)}, |
| 5360 | {"vkCreateBufferView", reinterpret_cast<PFN_vkVoidFunction>(CreateBufferView)}, |
| 5361 | {"vkDestroyBufferView", reinterpret_cast<PFN_vkVoidFunction>(DestroyBufferView)}, |
| 5362 | {"vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(CreateImage)}, |
| 5363 | {"vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(DestroyImage)}, |
| 5364 | {"vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(GetImageSubresourceLayout)}, |
| 5365 | {"vkCreateImageView", reinterpret_cast<PFN_vkVoidFunction>(CreateImageView)}, |
| 5366 | {"vkDestroyImageView", reinterpret_cast<PFN_vkVoidFunction>(DestroyImageView)}, |
| 5367 | {"vkCreateShaderModule", reinterpret_cast<PFN_vkVoidFunction>(CreateShaderModule)}, |
| 5368 | {"vkDestroyShaderModule", reinterpret_cast<PFN_vkVoidFunction>(DestroyShaderModule)}, |
| 5369 | {"vkCreatePipelineCache", reinterpret_cast<PFN_vkVoidFunction>(CreatePipelineCache)}, |
| 5370 | {"vkDestroyPipelineCache", reinterpret_cast<PFN_vkVoidFunction>(DestroyPipelineCache)}, |
| 5371 | {"vkGetPipelineCacheData", reinterpret_cast<PFN_vkVoidFunction>(GetPipelineCacheData)}, |
| 5372 | {"vkMergePipelineCaches", reinterpret_cast<PFN_vkVoidFunction>(MergePipelineCaches)}, |
| 5373 | {"vkCreateGraphicsPipelines", reinterpret_cast<PFN_vkVoidFunction>(CreateGraphicsPipelines)}, |
| 5374 | {"vkCreateComputePipelines", reinterpret_cast<PFN_vkVoidFunction>(CreateComputePipelines)}, |
| 5375 | {"vkDestroyPipeline", reinterpret_cast<PFN_vkVoidFunction>(DestroyPipeline)}, |
| 5376 | {"vkCreatePipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(CreatePipelineLayout)}, |
| 5377 | {"vkDestroyPipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(DestroyPipelineLayout)}, |
| 5378 | {"vkCreateSampler", reinterpret_cast<PFN_vkVoidFunction>(CreateSampler)}, |
| 5379 | {"vkDestroySampler", reinterpret_cast<PFN_vkVoidFunction>(DestroySampler)}, |
| 5380 | {"vkCreateDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(CreateDescriptorSetLayout)}, |
| 5381 | {"vkDestroyDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(DestroyDescriptorSetLayout)}, |
| 5382 | {"vkCreateDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(CreateDescriptorPool)}, |
| 5383 | {"vkDestroyDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(DestroyDescriptorPool)}, |
| 5384 | {"vkResetDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(ResetDescriptorPool)}, |
| 5385 | {"vkAllocateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(AllocateDescriptorSets)}, |
| 5386 | {"vkFreeDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(FreeDescriptorSets)}, |
| 5387 | {"vkUpdateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(UpdateDescriptorSets)}, |
| 5388 | {"vkCmdSetViewport", reinterpret_cast<PFN_vkVoidFunction>(CmdSetViewport)}, |
| 5389 | {"vkCmdSetScissor", reinterpret_cast<PFN_vkVoidFunction>(CmdSetScissor)}, |
| 5390 | {"vkCmdSetLineWidth", reinterpret_cast<PFN_vkVoidFunction>(CmdSetLineWidth)}, |
| 5391 | {"vkCmdSetDepthBias", reinterpret_cast<PFN_vkVoidFunction>(CmdSetDepthBias)}, |
| 5392 | {"vkCmdSetBlendConstants", reinterpret_cast<PFN_vkVoidFunction>(CmdSetBlendConstants)}, |
| 5393 | {"vkCmdSetDepthBounds", reinterpret_cast<PFN_vkVoidFunction>(CmdSetDepthBounds)}, |
| 5394 | {"vkCmdSetStencilCompareMask", reinterpret_cast<PFN_vkVoidFunction>(CmdSetStencilCompareMask)}, |
| 5395 | {"vkCmdSetStencilWriteMask", reinterpret_cast<PFN_vkVoidFunction>(CmdSetStencilWriteMask)}, |
| 5396 | {"vkCmdSetStencilReference", reinterpret_cast<PFN_vkVoidFunction>(CmdSetStencilReference)}, |
| 5397 | {"vkAllocateCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(AllocateCommandBuffers)}, |
| 5398 | {"vkFreeCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(FreeCommandBuffers)}, |
| 5399 | {"vkBeginCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(BeginCommandBuffer)}, |
| 5400 | {"vkEndCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(EndCommandBuffer)}, |
| 5401 | {"vkResetCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(ResetCommandBuffer)}, |
| 5402 | {"vkCmdBindPipeline", reinterpret_cast<PFN_vkVoidFunction>(CmdBindPipeline)}, |
| 5403 | {"vkCmdBindDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(CmdBindDescriptorSets)}, |
| 5404 | {"vkCmdBindVertexBuffers", reinterpret_cast<PFN_vkVoidFunction>(CmdBindVertexBuffers)}, |
| 5405 | {"vkCmdBindIndexBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdBindIndexBuffer)}, |
| 5406 | {"vkCmdDraw", reinterpret_cast<PFN_vkVoidFunction>(CmdDraw)}, |
| 5407 | {"vkCmdDrawIndexed", reinterpret_cast<PFN_vkVoidFunction>(CmdDrawIndexed)}, |
| 5408 | {"vkCmdDrawIndirect", reinterpret_cast<PFN_vkVoidFunction>(CmdDrawIndirect)}, |
| 5409 | {"vkCmdDrawIndexedIndirect", reinterpret_cast<PFN_vkVoidFunction>(CmdDrawIndexedIndirect)}, |
| 5410 | {"vkCmdDispatch", reinterpret_cast<PFN_vkVoidFunction>(CmdDispatch)}, |
| 5411 | {"vkCmdDispatchIndirect", reinterpret_cast<PFN_vkVoidFunction>(CmdDispatchIndirect)}, |
| 5412 | {"vkCmdCopyBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyBuffer)}, |
| 5413 | {"vkCmdCopyImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImage)}, |
| 5414 | {"vkCmdBlitImage", reinterpret_cast<PFN_vkVoidFunction>(CmdBlitImage)}, |
| 5415 | {"vkCmdCopyBufferToImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyBufferToImage)}, |
| 5416 | {"vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImageToBuffer)}, |
| 5417 | {"vkCmdUpdateBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdUpdateBuffer)}, |
| 5418 | {"vkCmdFillBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdFillBuffer)}, |
| 5419 | {"vkCmdClearColorImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearColorImage)}, |
| 5420 | {"vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearDepthStencilImage)}, |
| 5421 | {"vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(CmdClearAttachments)}, |
| 5422 | {"vkCmdResolveImage", reinterpret_cast<PFN_vkVoidFunction>(CmdResolveImage)}, |
| 5423 | {"vkCmdSetEvent", reinterpret_cast<PFN_vkVoidFunction>(CmdSetEvent)}, |
| 5424 | {"vkCmdResetEvent", reinterpret_cast<PFN_vkVoidFunction>(CmdResetEvent)}, |
| 5425 | {"vkCmdWaitEvents", reinterpret_cast<PFN_vkVoidFunction>(CmdWaitEvents)}, |
| 5426 | {"vkCmdPipelineBarrier", reinterpret_cast<PFN_vkVoidFunction>(CmdPipelineBarrier)}, |
| 5427 | {"vkCmdBeginQuery", reinterpret_cast<PFN_vkVoidFunction>(CmdBeginQuery)}, |
| 5428 | {"vkCmdEndQuery", reinterpret_cast<PFN_vkVoidFunction>(CmdEndQuery)}, |
| 5429 | {"vkCmdResetQueryPool", reinterpret_cast<PFN_vkVoidFunction>(CmdResetQueryPool)}, |
| 5430 | {"vkCmdWriteTimestamp", reinterpret_cast<PFN_vkVoidFunction>(CmdWriteTimestamp)}, |
| 5431 | {"vkCmdCopyQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyQueryPoolResults)}, |
| 5432 | {"vkCmdPushConstants", reinterpret_cast<PFN_vkVoidFunction>(CmdPushConstants)}, |
| 5433 | {"vkCreateFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(CreateFramebuffer)}, |
| 5434 | {"vkDestroyFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(DestroyFramebuffer)}, |
| 5435 | {"vkCreateRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CreateRenderPass)}, |
| 5436 | {"vkDestroyRenderPass", reinterpret_cast<PFN_vkVoidFunction>(DestroyRenderPass)}, |
| 5437 | {"vkGetRenderAreaGranularity", reinterpret_cast<PFN_vkVoidFunction>(GetRenderAreaGranularity)}, |
| 5438 | {"vkCreateCommandPool", reinterpret_cast<PFN_vkVoidFunction>(CreateCommandPool)}, |
| 5439 | {"vkDestroyCommandPool", reinterpret_cast<PFN_vkVoidFunction>(DestroyCommandPool)}, |
| 5440 | {"vkResetCommandPool", reinterpret_cast<PFN_vkVoidFunction>(ResetCommandPool)}, |
| 5441 | {"vkCmdBeginRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CmdBeginRenderPass)}, |
| 5442 | {"vkCmdNextSubpass", reinterpret_cast<PFN_vkVoidFunction>(CmdNextSubpass)}, |
| 5443 | {"vkCmdExecuteCommands", reinterpret_cast<PFN_vkVoidFunction>(CmdExecuteCommands)}, |
| 5444 | {"vkCmdEndRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CmdEndRenderPass)}, |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 5445 | {"vkDebugMarkerSetObjectTagEXT", reinterpret_cast<PFN_vkVoidFunction>(DebugMarkerSetObjectTagEXT) }, |
| 5446 | {"vkDebugMarkerSetObjectNameEXT", reinterpret_cast<PFN_vkVoidFunction>(DebugMarkerSetObjectNameEXT) }, |
| 5447 | {"vkCmdDebugMarkerBeginEXT", reinterpret_cast<PFN_vkVoidFunction>(CmdDebugMarkerBeginEXT) }, |
| 5448 | {"vkCmdDebugMarkerInsertEXT", reinterpret_cast<PFN_vkVoidFunction>(CmdDebugMarkerInsertEXT) }, |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 5449 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 5450 | {"vkGetMemoryWin32HandleNV", reinterpret_cast<PFN_vkVoidFunction>(GetMemoryWin32HandleNV) }, |
| 5451 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 5452 | }; |
| 5453 | |
Chia-I Wu | f9b0138 | 2016-05-16 07:37:41 +0800 | [diff] [blame] | 5454 | |
| 5455 | for (size_t i = 0; i < ARRAY_SIZE(core_device_commands); i++) { |
| 5456 | if (!strcmp(core_device_commands[i].name, name)) |
| 5457 | return core_device_commands[i].proc; |
| 5458 | } |
| 5459 | |
| 5460 | return nullptr; |
| 5461 | } |
| 5462 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5463 | static PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkDevice device) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5464 | static const struct { |
| 5465 | const char *name; |
| 5466 | PFN_vkVoidFunction proc; |
| 5467 | } wsi_device_commands[] = { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5468 | {"vkCreateSwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateSwapchainKHR)}, |
| 5469 | {"vkGetSwapchainImagesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetSwapchainImagesKHR)}, |
| 5470 | {"vkAcquireNextImageKHR", reinterpret_cast<PFN_vkVoidFunction>(AcquireNextImageKHR)}, |
| 5471 | {"vkQueuePresentKHR", reinterpret_cast<PFN_vkVoidFunction>(QueuePresentKHR)}, |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5472 | }; |
| 5473 | |
| 5474 | if (device) { |
| 5475 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5476 | |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5477 | if (device_data->wsi_enabled) { |
| 5478 | for (size_t i = 0; i < ARRAY_SIZE(wsi_device_commands); i++) { |
| 5479 | if (!strcmp(wsi_device_commands[i].name, name)) |
| 5480 | return wsi_device_commands[i].proc; |
| 5481 | } |
| 5482 | } |
| 5483 | |
| 5484 | if (device_data->wsi_display_swapchain_enabled) { |
| 5485 | if (!strcmp("vkCreateSharedSwapchainsKHR", name)) { |
| 5486 | return reinterpret_cast<PFN_vkVoidFunction>(CreateSharedSwapchainsKHR); |
| 5487 | } |
| 5488 | } |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5489 | } |
| 5490 | |
| 5491 | return nullptr; |
| 5492 | } |
| 5493 | |
| 5494 | static PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkInstance instance) { |
| 5495 | static const struct { |
| 5496 | const char *name; |
| 5497 | PFN_vkVoidFunction proc; |
| 5498 | } wsi_instance_commands[] = { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5499 | {"vkGetPhysicalDeviceSurfaceSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceSupportKHR)}, |
| 5500 | {"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", |
| 5501 | reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceCapabilitiesKHR)}, |
| 5502 | {"vkGetPhysicalDeviceSurfaceFormatsKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceFormatsKHR)}, |
| 5503 | {"vkGetPhysicalDeviceSurfacePresentModesKHR", |
| 5504 | reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfacePresentModesKHR)}, |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5505 | }; |
| 5506 | |
| 5507 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5508 | if (instance_extension_map.size() == 0 || !instance_extension_map[pTable].wsi_enabled) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5509 | return nullptr; |
| 5510 | |
| 5511 | for (size_t i = 0; i < ARRAY_SIZE(wsi_instance_commands); i++) { |
| 5512 | if (!strcmp(wsi_instance_commands[i].name, name)) |
| 5513 | return wsi_instance_commands[i].proc; |
| 5514 | } |
| 5515 | |
| 5516 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5517 | if ((instance_extension_map[pTable].win32_enabled == true) && !strcmp("vkCreateWin32SurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5518 | return reinterpret_cast<PFN_vkVoidFunction>(CreateWin32SurfaceKHR); |
| 5519 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 5520 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5521 | if ((instance_extension_map[pTable].xcb_enabled == true) && !strcmp("vkCreateXcbSurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5522 | return reinterpret_cast<PFN_vkVoidFunction>(CreateXcbSurfaceKHR); |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5523 | if ((instance_extension_map[pTable].xcb_enabled == true) && !strcmp("vkGetPhysicalDeviceXcbPresentationSupportKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5524 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXcbPresentationSupportKHR); |
| 5525 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 5526 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5527 | if ((instance_extension_map[pTable].xlib_enabled == true) && !strcmp("vkCreateXlibSurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5528 | return reinterpret_cast<PFN_vkVoidFunction>(CreateXlibSurfaceKHR); |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5529 | if ((instance_extension_map[pTable].xlib_enabled == true) && !strcmp("vkGetPhysicalDeviceXlibPresentationSupportKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5530 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXlibPresentationSupportKHR); |
| 5531 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 5532 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5533 | if ((instance_extension_map[pTable].mir_enabled == true) && !strcmp("vkCreateMirSurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5534 | return reinterpret_cast<PFN_vkVoidFunction>(CreateMirSurfaceKHR); |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5535 | if ((instance_extension_map[pTable].mir_enabled == true) && !strcmp("vkGetPhysicalDeviceMirPresentationSupportKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5536 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceMirPresentationSupportKHR); |
| 5537 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 5538 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5539 | if ((instance_extension_map[pTable].wayland_enabled == true) && !strcmp("vkCreateWaylandSurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5540 | return reinterpret_cast<PFN_vkVoidFunction>(CreateWaylandSurfaceKHR); |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5541 | if ((instance_extension_map[pTable].wayland_enabled == true) && |
| 5542 | !strcmp("vkGetPhysicalDeviceWaylandPresentationSupportKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5543 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceWaylandPresentationSupportKHR); |
| 5544 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 5545 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5546 | if ((instance_extension_map[pTable].android_enabled == true) && !strcmp("vkCreateAndroidSurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5547 | return reinterpret_cast<PFN_vkVoidFunction>(CreateAndroidSurfaceKHR); |
| 5548 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 5549 | |
| 5550 | return nullptr; |
| 5551 | } |
| 5552 | |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5553 | } // namespace parameter_validation |
| 5554 | |
| 5555 | // vk_layer_logging.h expects these to be defined |
| 5556 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5557 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(VkInstance instance, |
| 5558 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 5559 | const VkAllocationCallbacks *pAllocator, |
| 5560 | VkDebugReportCallbackEXT *pMsgCallback) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5561 | return parameter_validation::CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5562 | } |
| 5563 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5564 | VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, |
| 5565 | const VkAllocationCallbacks *pAllocator) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5566 | parameter_validation::DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5567 | } |
| 5568 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5569 | VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 5570 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 5571 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5572 | parameter_validation::DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5573 | } |
| 5574 | |
| 5575 | // loader-layer interface v0 |
| 5576 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5577 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 5578 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5579 | return parameter_validation::EnumerateInstanceExtensionProperties(pLayerName, pCount, pProperties); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5580 | } |
| 5581 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5582 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pCount, |
| 5583 | VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5584 | return parameter_validation::EnumerateInstanceLayerProperties(pCount, pProperties); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5585 | } |
| 5586 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5587 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 5588 | VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5589 | // the layer command handles VK_NULL_HANDLE just fine internally |
| 5590 | assert(physicalDevice == VK_NULL_HANDLE); |
| 5591 | return parameter_validation::EnumerateDeviceLayerProperties(VK_NULL_HANDLE, pCount, pProperties); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5592 | } |
| 5593 | |
| 5594 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, |
| 5595 | const char *pLayerName, uint32_t *pCount, |
| 5596 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5597 | // the layer command handles VK_NULL_HANDLE just fine internally |
| 5598 | assert(physicalDevice == VK_NULL_HANDLE); |
Chia-I Wu | 76a3466 | 2016-05-16 07:34:09 +0800 | [diff] [blame] | 5599 | return parameter_validation::EnumerateDeviceExtensionProperties(VK_NULL_HANDLE, pLayerName, pCount, pProperties); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5600 | } |
| 5601 | |
| 5602 | 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] | 5603 | return parameter_validation::GetDeviceProcAddr(dev, funcName); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5604 | } |
| 5605 | |
| 5606 | 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] | 5607 | return parameter_validation::GetInstanceProcAddr(instance, funcName); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5608 | } |