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 | |
| 26 | #include <math.h> |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 27 | #include <stdio.h> |
| 28 | #include <stdlib.h> |
| 29 | #include <string.h> |
| 30 | |
| 31 | #include <iostream> |
| 32 | #include <string> |
| 33 | #include <sstream> |
Mark Lobodzinski | 2eed1eb | 2015-05-26 10:58:40 -0500 | [diff] [blame] | 34 | #include <unordered_map> |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 35 | #include <unordered_set> |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 36 | #include <vector> |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 37 | |
Tobin Ehlis | b835d1b | 2015-07-03 10:34:49 -0600 | [diff] [blame] | 38 | #include "vk_loader_platform.h" |
David Pinedo | 9316d3b | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 39 | #include "vulkan/vk_layer.h" |
Tobin Ehlis | a0cb02e | 2015-07-03 10:15:26 -0600 | [diff] [blame] | 40 | #include "vk_layer_config.h" |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 41 | #include "vk_enum_validate_helper.h" |
| 42 | #include "vk_struct_validate_helper.h" |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 43 | |
Tobin Ehlis | a0cb02e | 2015-07-03 10:15:26 -0600 | [diff] [blame] | 44 | #include "vk_layer_table.h" |
| 45 | #include "vk_layer_data.h" |
| 46 | #include "vk_layer_logging.h" |
Courtney Goeltzenleuchter | f13293f | 2015-07-07 11:02:42 -0600 | [diff] [blame] | 47 | #include "vk_layer_extension_utils.h" |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 48 | #include "vk_layer_utils.h" |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 49 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 50 | #include "parameter_validation.h" |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 51 | |
Dustin Graves | b83fc2d | 2016-05-04 12:56:08 -0600 | [diff] [blame] | 52 | using namespace parameter_validation; |
| 53 | |
Cody Northrop | 55443ef | 2015-09-28 15:09:32 -0600 | [diff] [blame] | 54 | struct layer_data { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 55 | debug_report_data *report_data; |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 56 | std::vector<VkDebugReportCallbackEXT> logging_callback; |
Cody Northrop | 55443ef | 2015-09-28 15:09:32 -0600 | [diff] [blame] | 57 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 58 | // The following are for keeping track of the temporary callbacks that can |
| 59 | // be used in vkCreateInstance and vkDestroyInstance: |
| 60 | uint32_t num_tmp_callbacks; |
| 61 | VkDebugReportCallbackCreateInfoEXT *tmp_dbg_create_infos; |
| 62 | VkDebugReportCallbackEXT *tmp_callbacks; |
| 63 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 64 | // TODO: Split instance/device structs |
| 65 | // Device Data |
| 66 | // Map for queue family index to queue count |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 67 | std::unordered_map<uint32_t, uint32_t> queueFamilyIndexMap; |
| 68 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 69 | layer_data() : report_data(nullptr), num_tmp_callbacks(0), tmp_dbg_create_infos(nullptr), tmp_callbacks(nullptr){}; |
Cody Northrop | 55443ef | 2015-09-28 15:09:32 -0600 | [diff] [blame] | 70 | }; |
Mark Lobodzinski | 2eed1eb | 2015-05-26 10:58:40 -0500 | [diff] [blame] | 71 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 72 | static std::unordered_map<void *, layer_data *> layer_data_map; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 73 | static device_table_map pc_device_table_map; |
| 74 | static instance_table_map pc_instance_table_map; |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 75 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 76 | // "my instance data" |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 77 | debug_report_data *mid(VkInstance object) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 78 | dispatch_key key = get_dispatch_key(object); |
Tobin Ehlis | bfbac25 | 2015-09-01 11:46:36 -0600 | [diff] [blame] | 79 | layer_data *data = get_my_data_ptr(key, layer_data_map); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 80 | #if DISPATCH_MAP_DEBUG |
Mark Mueller | aab3650 | 2016-05-03 13:17:29 -0600 | [diff] [blame] | 81 | 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] | 82 | #endif |
Courtney Goeltzenleuchter | 876a4f5 | 2015-07-17 10:20:11 -0600 | [diff] [blame] | 83 | assert(data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 84 | |
| 85 | return data->report_data; |
| 86 | } |
| 87 | |
| 88 | // "my device data" |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 89 | debug_report_data *mdd(void *object) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 90 | dispatch_key key = get_dispatch_key(object); |
| 91 | layer_data *data = get_my_data_ptr(key, layer_data_map); |
| 92 | #if DISPATCH_MAP_DEBUG |
Mark Mueller | aab3650 | 2016-05-03 13:17:29 -0600 | [diff] [blame] | 93 | 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] | 94 | #endif |
Courtney Goeltzenleuchter | 876a4f5 | 2015-07-17 10:20:11 -0600 | [diff] [blame] | 95 | assert(data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 96 | return data->report_data; |
| 97 | } |
| 98 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 99 | static void init_parameter_validation(layer_data *my_data, const VkAllocationCallbacks *pAllocator) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 100 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 101 | 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] | 102 | } |
| 103 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 104 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 105 | vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 106 | const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pMsgCallback) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 107 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 108 | VkResult result = pTable->CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 109 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 110 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 111 | layer_data *data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 112 | result = layer_create_msg_callback(data->report_data, pCreateInfo, pAllocator, pMsgCallback); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | return result; |
| 116 | } |
| 117 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 118 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, |
| 119 | VkDebugReportCallbackEXT msgCallback, |
| 120 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 121 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 122 | pTable->DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 123 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 124 | 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] | 125 | layer_destroy_msg_callback(data->report_data, msgCallback, pAllocator); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 126 | } |
| 127 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 128 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 129 | vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t object, |
| 130 | size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 131 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
| 132 | pTable->DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
Courtney Goeltzenleuchter | f0de724 | 2015-12-01 14:10:55 -0700 | [diff] [blame] | 133 | } |
| 134 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 135 | 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] | 136 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 137 | static const VkLayerProperties pc_global_layers[] = {{ |
Jon Ashburn | dc9111c | 2016-03-22 12:57:13 -0600 | [diff] [blame] | 138 | "VK_LAYER_LUNARG_parameter_validation", VK_LAYER_API_VERSION, 1, "LunarG Validation Layer", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 139 | }}; |
Courtney Goeltzenleuchter | 5285766 | 2015-12-01 14:08:28 -0700 | [diff] [blame] | 140 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 141 | static bool ValidateEnumerator(VkFormatFeatureFlagBits const &enumerator) { |
Courtney Goeltzenleuchter | f1ece60 | 2015-09-10 16:25:49 -0600 | [diff] [blame] | 142 | VkFormatFeatureFlagBits allFlags = (VkFormatFeatureFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 143 | VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT | VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | |
| 144 | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT | |
| 145 | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT | VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | |
| 146 | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | |
| 147 | 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] | 148 | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 149 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 150 | return false; |
| 151 | } |
| 152 | |
| 153 | return true; |
| 154 | } |
| 155 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 156 | static std::string EnumeratorString(VkFormatFeatureFlagBits const &enumerator) { |
| 157 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 158 | return "unrecognized enumerator"; |
| 159 | } |
| 160 | |
| 161 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 162 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 163 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT"); |
| 164 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 165 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 166 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT"); |
| 167 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 168 | if (enumerator & VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 169 | strings.push_back("VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT"); |
| 170 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 171 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 172 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT"); |
| 173 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 174 | if (enumerator & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 175 | strings.push_back("VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT"); |
| 176 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 177 | if (enumerator & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 178 | strings.push_back("VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT"); |
| 179 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 180 | if (enumerator & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 181 | strings.push_back("VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT"); |
| 182 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 183 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 184 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT"); |
| 185 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 186 | if (enumerator & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 187 | strings.push_back("VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT"); |
| 188 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 189 | if (enumerator & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 190 | strings.push_back("VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
| 191 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 192 | if (enumerator & VK_FORMAT_FEATURE_BLIT_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 193 | strings.push_back("VK_FORMAT_FEATURE_BLIT_SRC_BIT"); |
Cody Northrop | 61d6dd6 | 2015-08-18 14:58:29 -0600 | [diff] [blame] | 194 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 195 | if (enumerator & VK_FORMAT_FEATURE_BLIT_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 196 | strings.push_back("VK_FORMAT_FEATURE_BLIT_DST_BIT"); |
Cody Northrop | 61d6dd6 | 2015-08-18 14:58:29 -0600 | [diff] [blame] | 197 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 198 | if (enumerator & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) { |
Jon Ashburn | 766866a | 2016-01-22 15:39:20 -0700 | [diff] [blame] | 199 | strings.push_back("VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT"); |
| 200 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 201 | |
| 202 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 203 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 204 | enumeratorString += string; |
| 205 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 206 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 207 | enumeratorString += '|'; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | return enumeratorString; |
| 212 | } |
| 213 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 214 | static bool ValidateEnumerator(VkImageUsageFlagBits const &enumerator) { |
| 215 | VkImageUsageFlagBits allFlags = (VkImageUsageFlagBits)( |
| 216 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | |
| 217 | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | |
| 218 | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT); |
| 219 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 220 | return false; |
| 221 | } |
| 222 | |
| 223 | return true; |
| 224 | } |
| 225 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 226 | static std::string EnumeratorString(VkImageUsageFlagBits const &enumerator) { |
| 227 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 228 | return "unrecognized enumerator"; |
| 229 | } |
| 230 | |
| 231 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 232 | if (enumerator & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 233 | strings.push_back("VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT"); |
| 234 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 235 | if (enumerator & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) { |
Courtney Goeltzenleuchter | 660f0ca | 2015-09-10 14:14:11 -0600 | [diff] [blame] | 236 | strings.push_back("VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 237 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 238 | if (enumerator & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 239 | strings.push_back("VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT"); |
| 240 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 241 | if (enumerator & VK_IMAGE_USAGE_STORAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 242 | strings.push_back("VK_IMAGE_USAGE_STORAGE_BIT"); |
| 243 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 244 | if (enumerator & VK_IMAGE_USAGE_SAMPLED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 245 | strings.push_back("VK_IMAGE_USAGE_SAMPLED_BIT"); |
| 246 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 247 | if (enumerator & VK_IMAGE_USAGE_TRANSFER_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 248 | strings.push_back("VK_IMAGE_USAGE_TRANSFER_DST_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 249 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 250 | if (enumerator & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 251 | strings.push_back("VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT"); |
| 252 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 253 | if (enumerator & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 254 | strings.push_back("VK_IMAGE_USAGE_TRANSFER_SRC_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 255 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 256 | |
| 257 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 258 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 259 | enumeratorString += string; |
| 260 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 261 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 262 | enumeratorString += '|'; |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | return enumeratorString; |
| 267 | } |
| 268 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 269 | static bool ValidateEnumerator(VkQueueFlagBits const &enumerator) { |
| 270 | VkQueueFlagBits allFlags = |
| 271 | (VkQueueFlagBits)(VK_QUEUE_TRANSFER_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_SPARSE_BINDING_BIT | VK_QUEUE_GRAPHICS_BIT); |
| 272 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 273 | return false; |
| 274 | } |
| 275 | |
| 276 | return true; |
| 277 | } |
| 278 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 279 | static std::string EnumeratorString(VkQueueFlagBits const &enumerator) { |
| 280 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 281 | return "unrecognized enumerator"; |
| 282 | } |
| 283 | |
| 284 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 285 | if (enumerator & VK_QUEUE_TRANSFER_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 286 | strings.push_back("VK_QUEUE_TRANSFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 287 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 288 | if (enumerator & VK_QUEUE_COMPUTE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 289 | strings.push_back("VK_QUEUE_COMPUTE_BIT"); |
| 290 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 291 | if (enumerator & VK_QUEUE_SPARSE_BINDING_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 292 | strings.push_back("VK_QUEUE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 293 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 294 | if (enumerator & VK_QUEUE_GRAPHICS_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 295 | strings.push_back("VK_QUEUE_GRAPHICS_BIT"); |
| 296 | } |
| 297 | |
| 298 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 299 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 300 | enumeratorString += string; |
| 301 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 302 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 303 | enumeratorString += '|'; |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | return enumeratorString; |
| 308 | } |
| 309 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 310 | static bool ValidateEnumerator(VkMemoryPropertyFlagBits const &enumerator) { |
| 311 | VkMemoryPropertyFlagBits allFlags = (VkMemoryPropertyFlagBits)( |
| 312 | VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | |
| 313 | VK_MEMORY_PROPERTY_HOST_CACHED_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); |
| 314 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 315 | return false; |
| 316 | } |
| 317 | |
| 318 | return true; |
| 319 | } |
| 320 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 321 | static std::string EnumeratorString(VkMemoryPropertyFlagBits const &enumerator) { |
| 322 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 323 | return "unrecognized enumerator"; |
| 324 | } |
| 325 | |
| 326 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 327 | if (enumerator & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 328 | strings.push_back("VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT"); |
| 329 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 330 | if (enumerator & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 331 | strings.push_back("VK_MEMORY_PROPERTY_HOST_COHERENT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 332 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 333 | if (enumerator & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 334 | strings.push_back("VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT"); |
| 335 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 336 | if (enumerator & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 337 | strings.push_back("VK_MEMORY_PROPERTY_HOST_CACHED_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 338 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 339 | if (enumerator & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 340 | strings.push_back("VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 341 | } |
| 342 | |
| 343 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 344 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 345 | enumeratorString += string; |
| 346 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 347 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 348 | enumeratorString += '|'; |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | return enumeratorString; |
| 353 | } |
| 354 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 355 | static bool ValidateEnumerator(VkMemoryHeapFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 356 | VkMemoryHeapFlagBits allFlags = (VkMemoryHeapFlagBits)(VK_MEMORY_HEAP_DEVICE_LOCAL_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 357 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 358 | return false; |
| 359 | } |
| 360 | |
| 361 | return true; |
| 362 | } |
| 363 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 364 | static std::string EnumeratorString(VkMemoryHeapFlagBits const &enumerator) { |
| 365 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 366 | return "unrecognized enumerator"; |
| 367 | } |
| 368 | |
| 369 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 370 | if (enumerator & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 371 | strings.push_back("VK_MEMORY_HEAP_DEVICE_LOCAL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 372 | } |
| 373 | |
| 374 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 375 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 376 | enumeratorString += string; |
| 377 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 378 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 379 | enumeratorString += '|'; |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | return enumeratorString; |
| 384 | } |
| 385 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 386 | static bool ValidateEnumerator(VkSparseImageFormatFlagBits const &enumerator) { |
| 387 | VkSparseImageFormatFlagBits allFlags = |
| 388 | (VkSparseImageFormatFlagBits)(VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT | |
| 389 | VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT | VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT); |
| 390 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 391 | return false; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 392 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 393 | |
| 394 | return true; |
| 395 | } |
| 396 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 397 | static std::string EnumeratorString(VkSparseImageFormatFlagBits const &enumerator) { |
| 398 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 399 | return "unrecognized enumerator"; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 400 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 401 | |
| 402 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 403 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 404 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 405 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 406 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 407 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 408 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 409 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 410 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 411 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 412 | |
| 413 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 414 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 415 | enumeratorString += string; |
| 416 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 417 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 418 | enumeratorString += '|'; |
| 419 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 420 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 421 | |
| 422 | return enumeratorString; |
| 423 | } |
| 424 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 425 | static bool ValidateEnumerator(VkFenceCreateFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 426 | VkFenceCreateFlagBits allFlags = (VkFenceCreateFlagBits)(VK_FENCE_CREATE_SIGNALED_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 427 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 428 | return false; |
| 429 | } |
| 430 | |
| 431 | return true; |
| 432 | } |
| 433 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 434 | static std::string EnumeratorString(VkFenceCreateFlagBits const &enumerator) { |
| 435 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 436 | return "unrecognized enumerator"; |
| 437 | } |
| 438 | |
| 439 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 440 | if (enumerator & VK_FENCE_CREATE_SIGNALED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 441 | strings.push_back("VK_FENCE_CREATE_SIGNALED_BIT"); |
| 442 | } |
| 443 | |
| 444 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 445 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 446 | enumeratorString += string; |
| 447 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 448 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 449 | enumeratorString += '|'; |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | return enumeratorString; |
| 454 | } |
| 455 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 456 | static bool ValidateEnumerator(VkQueryPipelineStatisticFlagBits const &enumerator) { |
| 457 | VkQueryPipelineStatisticFlagBits allFlags = (VkQueryPipelineStatisticFlagBits)( |
| 458 | VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT | VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT | |
| 459 | VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT | VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT | |
| 460 | VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT | VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT | |
| 461 | 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] | 462 | VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT | |
| 463 | VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT | |
| 464 | VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 465 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 466 | return false; |
| 467 | } |
| 468 | |
| 469 | return true; |
| 470 | } |
| 471 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 472 | static std::string EnumeratorString(VkQueryPipelineStatisticFlagBits const &enumerator) { |
| 473 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 474 | return "unrecognized enumerator"; |
| 475 | } |
| 476 | |
| 477 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 478 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 479 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 480 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 481 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 482 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 483 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 484 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 485 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 486 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 487 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 488 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 489 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 490 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 491 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 492 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 493 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 494 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 495 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 496 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 497 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 498 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 499 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 500 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 501 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 502 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 503 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 504 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 505 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 506 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 507 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 508 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 509 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 510 | } |
| 511 | |
| 512 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 513 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 514 | enumeratorString += string; |
| 515 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 516 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 517 | enumeratorString += '|'; |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | return enumeratorString; |
| 522 | } |
| 523 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 524 | static bool ValidateEnumerator(VkQueryResultFlagBits const &enumerator) { |
| 525 | VkQueryResultFlagBits allFlags = (VkQueryResultFlagBits)(VK_QUERY_RESULT_PARTIAL_BIT | VK_QUERY_RESULT_WITH_AVAILABILITY_BIT | |
| 526 | VK_QUERY_RESULT_WAIT_BIT | VK_QUERY_RESULT_64_BIT); |
| 527 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 528 | return false; |
| 529 | } |
| 530 | |
| 531 | return true; |
| 532 | } |
| 533 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 534 | static std::string EnumeratorString(VkQueryResultFlagBits const &enumerator) { |
| 535 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 536 | return "unrecognized enumerator"; |
| 537 | } |
| 538 | |
| 539 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 540 | if (enumerator & VK_QUERY_RESULT_PARTIAL_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 541 | strings.push_back("VK_QUERY_RESULT_PARTIAL_BIT"); |
| 542 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 543 | if (enumerator & VK_QUERY_RESULT_WITH_AVAILABILITY_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 544 | strings.push_back("VK_QUERY_RESULT_WITH_AVAILABILITY_BIT"); |
| 545 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 546 | if (enumerator & VK_QUERY_RESULT_WAIT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 547 | strings.push_back("VK_QUERY_RESULT_WAIT_BIT"); |
| 548 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 549 | if (enumerator & VK_QUERY_RESULT_64_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 550 | strings.push_back("VK_QUERY_RESULT_64_BIT"); |
| 551 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 552 | |
| 553 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 554 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 555 | enumeratorString += string; |
| 556 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 557 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 558 | enumeratorString += '|'; |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | return enumeratorString; |
| 563 | } |
| 564 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 565 | static bool ValidateEnumerator(VkBufferUsageFlagBits const &enumerator) { |
| 566 | VkBufferUsageFlagBits allFlags = (VkBufferUsageFlagBits)( |
| 567 | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT | |
| 568 | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | |
| 569 | VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT); |
| 570 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 571 | return false; |
| 572 | } |
| 573 | |
| 574 | return true; |
| 575 | } |
| 576 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 577 | static std::string EnumeratorString(VkBufferUsageFlagBits const &enumerator) { |
| 578 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 579 | return "unrecognized enumerator"; |
| 580 | } |
| 581 | |
| 582 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 583 | if (enumerator & VK_BUFFER_USAGE_VERTEX_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 584 | strings.push_back("VK_BUFFER_USAGE_VERTEX_BUFFER_BIT"); |
| 585 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 586 | if (enumerator & VK_BUFFER_USAGE_INDEX_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 587 | strings.push_back("VK_BUFFER_USAGE_INDEX_BUFFER_BIT"); |
| 588 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 589 | if (enumerator & VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 590 | strings.push_back("VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT"); |
| 591 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 592 | if (enumerator & VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 593 | strings.push_back("VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT"); |
| 594 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 595 | if (enumerator & VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 596 | strings.push_back("VK_BUFFER_USAGE_STORAGE_BUFFER_BIT"); |
| 597 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 598 | if (enumerator & VK_BUFFER_USAGE_TRANSFER_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 599 | strings.push_back("VK_BUFFER_USAGE_TRANSFER_DST_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 600 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 601 | if (enumerator & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 602 | strings.push_back("VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT"); |
| 603 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 604 | if (enumerator & VK_BUFFER_USAGE_TRANSFER_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 605 | strings.push_back("VK_BUFFER_USAGE_TRANSFER_SRC_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 606 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 607 | if (enumerator & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 608 | strings.push_back("VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT"); |
| 609 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 610 | |
| 611 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 612 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 613 | enumeratorString += string; |
| 614 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 615 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 616 | enumeratorString += '|'; |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | return enumeratorString; |
| 621 | } |
| 622 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 623 | static bool ValidateEnumerator(VkBufferCreateFlagBits const &enumerator) { |
| 624 | VkBufferCreateFlagBits allFlags = (VkBufferCreateFlagBits)( |
| 625 | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT | VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT | VK_BUFFER_CREATE_SPARSE_BINDING_BIT); |
| 626 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 627 | return false; |
| 628 | } |
| 629 | |
| 630 | return true; |
| 631 | } |
| 632 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 633 | static std::string EnumeratorString(VkBufferCreateFlagBits const &enumerator) { |
| 634 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 635 | return "unrecognized enumerator"; |
| 636 | } |
| 637 | |
| 638 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 639 | if (enumerator & VK_BUFFER_CREATE_SPARSE_ALIASED_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 640 | strings.push_back("VK_BUFFER_CREATE_SPARSE_ALIASED_BIT"); |
| 641 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 642 | if (enumerator & VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 643 | strings.push_back("VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT"); |
| 644 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 645 | if (enumerator & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) { |
Courtney Goeltzenleuchter | 8134da0 | 2015-09-10 17:00:22 -0600 | [diff] [blame] | 646 | strings.push_back("VK_BUFFER_CREATE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 647 | } |
| 648 | |
| 649 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 650 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 651 | enumeratorString += string; |
| 652 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 653 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 654 | enumeratorString += '|'; |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | return enumeratorString; |
| 659 | } |
| 660 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 661 | static bool ValidateEnumerator(VkImageCreateFlagBits const &enumerator) { |
| 662 | VkImageCreateFlagBits allFlags = (VkImageCreateFlagBits)( |
| 663 | VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | |
| 664 | VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_SPARSE_BINDING_BIT); |
| 665 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 666 | return false; |
| 667 | } |
| 668 | |
| 669 | return true; |
| 670 | } |
| 671 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 672 | static std::string EnumeratorString(VkImageCreateFlagBits const &enumerator) { |
| 673 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 674 | return "unrecognized enumerator"; |
| 675 | } |
| 676 | |
| 677 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 678 | if (enumerator & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 679 | strings.push_back("VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT"); |
| 680 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 681 | if (enumerator & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 682 | strings.push_back("VK_IMAGE_CREATE_SPARSE_ALIASED_BIT"); |
| 683 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 684 | if (enumerator & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 685 | strings.push_back("VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT"); |
| 686 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 687 | if (enumerator & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 688 | strings.push_back("VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT"); |
| 689 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 690 | if (enumerator & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) { |
Courtney Goeltzenleuchter | 8134da0 | 2015-09-10 17:00:22 -0600 | [diff] [blame] | 691 | strings.push_back("VK_IMAGE_CREATE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 692 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 693 | |
| 694 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 695 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 696 | enumeratorString += string; |
| 697 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 698 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 699 | enumeratorString += '|'; |
| 700 | } |
| 701 | } |
| 702 | |
| 703 | return enumeratorString; |
| 704 | } |
| 705 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 706 | static bool ValidateEnumerator(VkColorComponentFlagBits const &enumerator) { |
| 707 | VkColorComponentFlagBits allFlags = (VkColorComponentFlagBits)(VK_COLOR_COMPONENT_A_BIT | VK_COLOR_COMPONENT_B_BIT | |
| 708 | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_R_BIT); |
| 709 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 710 | return false; |
| 711 | } |
| 712 | |
| 713 | return true; |
| 714 | } |
| 715 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 716 | static std::string EnumeratorString(VkColorComponentFlagBits const &enumerator) { |
| 717 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 718 | return "unrecognized enumerator"; |
| 719 | } |
| 720 | |
| 721 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 722 | if (enumerator & VK_COLOR_COMPONENT_A_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 723 | strings.push_back("VK_COLOR_COMPONENT_A_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 724 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 725 | if (enumerator & VK_COLOR_COMPONENT_B_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 726 | strings.push_back("VK_COLOR_COMPONENT_B_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 727 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 728 | if (enumerator & VK_COLOR_COMPONENT_G_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 729 | strings.push_back("VK_COLOR_COMPONENT_G_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 730 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 731 | if (enumerator & VK_COLOR_COMPONENT_R_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 732 | strings.push_back("VK_COLOR_COMPONENT_R_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 733 | } |
| 734 | |
| 735 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 736 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 737 | enumeratorString += string; |
| 738 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 739 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 740 | enumeratorString += '|'; |
| 741 | } |
| 742 | } |
| 743 | |
| 744 | return enumeratorString; |
| 745 | } |
| 746 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 747 | static bool ValidateEnumerator(VkPipelineCreateFlagBits const &enumerator) { |
| 748 | VkPipelineCreateFlagBits allFlags = (VkPipelineCreateFlagBits)( |
| 749 | VK_PIPELINE_CREATE_DERIVATIVE_BIT | VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT | VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT); |
| 750 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 751 | return false; |
| 752 | } |
| 753 | |
| 754 | return true; |
| 755 | } |
| 756 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 757 | static std::string EnumeratorString(VkPipelineCreateFlagBits const &enumerator) { |
| 758 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 759 | return "unrecognized enumerator"; |
| 760 | } |
| 761 | |
| 762 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 763 | if (enumerator & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 764 | strings.push_back("VK_PIPELINE_CREATE_DERIVATIVE_BIT"); |
| 765 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 766 | if (enumerator & VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 767 | strings.push_back("VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT"); |
| 768 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 769 | if (enumerator & VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 770 | strings.push_back("VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 771 | } |
| 772 | |
| 773 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 774 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 775 | enumeratorString += string; |
| 776 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 777 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 778 | enumeratorString += '|'; |
| 779 | } |
| 780 | } |
| 781 | |
| 782 | return enumeratorString; |
| 783 | } |
| 784 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 785 | static bool ValidateEnumerator(VkShaderStageFlagBits const &enumerator) { |
| 786 | VkShaderStageFlagBits allFlags = (VkShaderStageFlagBits)( |
| 787 | VK_SHADER_STAGE_ALL | VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_GEOMETRY_BIT | VK_SHADER_STAGE_COMPUTE_BIT | |
| 788 | VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT | VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT | VK_SHADER_STAGE_VERTEX_BIT); |
| 789 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 790 | return false; |
| 791 | } |
| 792 | |
| 793 | return true; |
| 794 | } |
| 795 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 796 | static std::string EnumeratorString(VkShaderStageFlagBits const &enumerator) { |
| 797 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 798 | return "unrecognized enumerator"; |
| 799 | } |
| 800 | |
| 801 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 802 | if (enumerator & VK_SHADER_STAGE_ALL) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 803 | strings.push_back("VK_SHADER_STAGE_ALL"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 804 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 805 | if (enumerator & VK_SHADER_STAGE_FRAGMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 806 | strings.push_back("VK_SHADER_STAGE_FRAGMENT_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 807 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 808 | if (enumerator & VK_SHADER_STAGE_GEOMETRY_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 809 | strings.push_back("VK_SHADER_STAGE_GEOMETRY_BIT"); |
| 810 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 811 | if (enumerator & VK_SHADER_STAGE_COMPUTE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 812 | strings.push_back("VK_SHADER_STAGE_COMPUTE_BIT"); |
| 813 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 814 | if (enumerator & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 815 | strings.push_back("VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 816 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 817 | if (enumerator & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 818 | strings.push_back("VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 819 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 820 | if (enumerator & VK_SHADER_STAGE_VERTEX_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 821 | strings.push_back("VK_SHADER_STAGE_VERTEX_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 822 | } |
| 823 | |
| 824 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 825 | for (auto const &string : strings) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 826 | enumeratorString += string; |
| 827 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 828 | if (string != strings.back()) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 829 | enumeratorString += '|'; |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | return enumeratorString; |
| 834 | } |
| 835 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 836 | static bool ValidateEnumerator(VkPipelineStageFlagBits const &enumerator) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 837 | VkPipelineStageFlagBits allFlags = (VkPipelineStageFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 838 | VK_PIPELINE_STAGE_ALL_COMMANDS_BIT | VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | VK_PIPELINE_STAGE_HOST_BIT | |
| 839 | VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | |
| 840 | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | |
| 841 | VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | |
| 842 | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT | |
| 843 | 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] | 844 | VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 845 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 846 | return false; |
| 847 | } |
| 848 | |
| 849 | return true; |
| 850 | } |
| 851 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 852 | static std::string EnumeratorString(VkPipelineStageFlagBits const &enumerator) { |
| 853 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 854 | return "unrecognized enumerator"; |
| 855 | } |
| 856 | |
| 857 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 858 | if (enumerator & VK_PIPELINE_STAGE_ALL_COMMANDS_BIT) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 859 | strings.push_back("VK_PIPELINE_STAGE_ALL_COMMANDS_BIT"); |
| 860 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 861 | if (enumerator & VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 862 | strings.push_back("VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 863 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 864 | if (enumerator & VK_PIPELINE_STAGE_HOST_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 865 | strings.push_back("VK_PIPELINE_STAGE_HOST_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 866 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 867 | if (enumerator & VK_PIPELINE_STAGE_TRANSFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 868 | strings.push_back("VK_PIPELINE_STAGE_TRANSFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 869 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 870 | if (enumerator & VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 871 | strings.push_back("VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 872 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 873 | if (enumerator & VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT) { |
Jon Ashburn | 4bf8ba4 | 2015-12-31 12:14:37 -0700 | [diff] [blame] | 874 | strings.push_back("VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 875 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 876 | if (enumerator & VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 877 | strings.push_back("VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 878 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 879 | if (enumerator & VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 880 | strings.push_back("VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 881 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 882 | if (enumerator & VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 883 | strings.push_back("VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 884 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 885 | if (enumerator & VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 886 | strings.push_back("VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 887 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 888 | if (enumerator & VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 889 | strings.push_back("VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT"); |
| 890 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 891 | if (enumerator & VK_PIPELINE_STAGE_VERTEX_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 892 | strings.push_back("VK_PIPELINE_STAGE_VERTEX_SHADER_BIT"); |
| 893 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 894 | if (enumerator & VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 895 | strings.push_back("VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 896 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 897 | if (enumerator & VK_PIPELINE_STAGE_VERTEX_INPUT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 898 | strings.push_back("VK_PIPELINE_STAGE_VERTEX_INPUT_BIT"); |
| 899 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 900 | if (enumerator & VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 901 | strings.push_back("VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT"); |
| 902 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 903 | if (enumerator & VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 904 | strings.push_back("VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT"); |
| 905 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 906 | if (enumerator & VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 907 | strings.push_back("VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 908 | } |
| 909 | |
| 910 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 911 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 912 | enumeratorString += string; |
| 913 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 914 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 915 | enumeratorString += '|'; |
| 916 | } |
| 917 | } |
| 918 | |
| 919 | return enumeratorString; |
| 920 | } |
| 921 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 922 | static bool ValidateEnumerator(VkAccessFlagBits const &enumerator) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 923 | VkAccessFlagBits allFlags = (VkAccessFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 924 | VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_INDEX_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | |
| 925 | VK_ACCESS_UNIFORM_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT | VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT | |
| 926 | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | |
| 927 | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT | |
| 928 | 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] | 929 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 930 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 931 | return false; |
| 932 | } |
| 933 | |
| 934 | return true; |
| 935 | } |
| 936 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 937 | static std::string EnumeratorString(VkAccessFlagBits const &enumerator) { |
| 938 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 939 | return "unrecognized enumerator"; |
| 940 | } |
| 941 | |
| 942 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 943 | if (enumerator & VK_ACCESS_INDIRECT_COMMAND_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 944 | strings.push_back("VK_ACCESS_INDIRECT_COMMAND_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 945 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 946 | if (enumerator & VK_ACCESS_INDEX_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 947 | strings.push_back("VK_ACCESS_INDEX_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 948 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 949 | if (enumerator & VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 950 | strings.push_back("VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 951 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 952 | if (enumerator & VK_ACCESS_UNIFORM_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 953 | strings.push_back("VK_ACCESS_UNIFORM_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 954 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 955 | if (enumerator & VK_ACCESS_INPUT_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 956 | strings.push_back("VK_ACCESS_INPUT_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 957 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 958 | if (enumerator & VK_ACCESS_SHADER_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 959 | strings.push_back("VK_ACCESS_SHADER_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 960 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 961 | if (enumerator & VK_ACCESS_SHADER_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 962 | strings.push_back("VK_ACCESS_SHADER_WRITE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 963 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 964 | if (enumerator & VK_ACCESS_COLOR_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 965 | strings.push_back("VK_ACCESS_COLOR_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 966 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 967 | if (enumerator & VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 968 | strings.push_back("VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 969 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 970 | if (enumerator & VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 971 | strings.push_back("VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 972 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 973 | if (enumerator & VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 974 | strings.push_back("VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 975 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 976 | if (enumerator & VK_ACCESS_TRANSFER_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 977 | strings.push_back("VK_ACCESS_TRANSFER_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 978 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 979 | if (enumerator & VK_ACCESS_TRANSFER_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 980 | strings.push_back("VK_ACCESS_TRANSFER_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 981 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 982 | if (enumerator & VK_ACCESS_HOST_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 983 | strings.push_back("VK_ACCESS_HOST_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 984 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 985 | if (enumerator & VK_ACCESS_HOST_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 986 | strings.push_back("VK_ACCESS_HOST_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 987 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 988 | if (enumerator & VK_ACCESS_MEMORY_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 989 | strings.push_back("VK_ACCESS_MEMORY_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 990 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 991 | if (enumerator & VK_ACCESS_MEMORY_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 992 | strings.push_back("VK_ACCESS_MEMORY_WRITE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 993 | } |
| 994 | |
| 995 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 996 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 997 | enumeratorString += string; |
| 998 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 999 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1000 | enumeratorString += '|'; |
| 1001 | } |
| 1002 | } |
| 1003 | |
| 1004 | return enumeratorString; |
| 1005 | } |
| 1006 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1007 | static bool ValidateEnumerator(VkCommandPoolCreateFlagBits const &enumerator) { |
| 1008 | VkCommandPoolCreateFlagBits allFlags = |
| 1009 | (VkCommandPoolCreateFlagBits)(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT | VK_COMMAND_POOL_CREATE_TRANSIENT_BIT); |
| 1010 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1011 | return false; |
| 1012 | } |
| 1013 | |
| 1014 | return true; |
| 1015 | } |
| 1016 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1017 | static std::string EnumeratorString(VkCommandPoolCreateFlagBits const &enumerator) { |
| 1018 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1019 | return "unrecognized enumerator"; |
| 1020 | } |
| 1021 | |
| 1022 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1023 | if (enumerator & VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1024 | strings.push_back("VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1025 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1026 | if (enumerator & VK_COMMAND_POOL_CREATE_TRANSIENT_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1027 | strings.push_back("VK_COMMAND_POOL_CREATE_TRANSIENT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1028 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1029 | |
| 1030 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1031 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1032 | enumeratorString += string; |
| 1033 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1034 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1035 | enumeratorString += '|'; |
| 1036 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1037 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1038 | |
| 1039 | return enumeratorString; |
| 1040 | } |
| 1041 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1042 | static bool ValidateEnumerator(VkCommandPoolResetFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1043 | VkCommandPoolResetFlagBits allFlags = (VkCommandPoolResetFlagBits)(VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1044 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1045 | return false; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1046 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1047 | |
| 1048 | return true; |
| 1049 | } |
| 1050 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1051 | static std::string EnumeratorString(VkCommandPoolResetFlagBits const &enumerator) { |
| 1052 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1053 | return "unrecognized enumerator"; |
| 1054 | } |
| 1055 | |
| 1056 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1057 | if (enumerator & VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1058 | strings.push_back("VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1059 | } |
| 1060 | |
| 1061 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1062 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1063 | enumeratorString += string; |
| 1064 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1065 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1066 | enumeratorString += '|'; |
| 1067 | } |
| 1068 | } |
| 1069 | |
| 1070 | return enumeratorString; |
| 1071 | } |
| 1072 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1073 | static bool ValidateEnumerator(VkCommandBufferUsageFlags const &enumerator) { |
| 1074 | VkCommandBufferUsageFlags allFlags = |
| 1075 | (VkCommandBufferUsageFlags)(VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT | VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT | |
| 1076 | VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT); |
| 1077 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1078 | return false; |
| 1079 | } |
| 1080 | |
| 1081 | return true; |
| 1082 | } |
| 1083 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1084 | static std::string EnumeratorString(VkCommandBufferUsageFlags const &enumerator) { |
| 1085 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1086 | return "unrecognized enumerator"; |
| 1087 | } |
| 1088 | |
| 1089 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1090 | if (enumerator & VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1091 | strings.push_back("VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1092 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1093 | if (enumerator & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1094 | strings.push_back("VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1095 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1096 | if (enumerator & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1097 | strings.push_back("VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1098 | } |
| 1099 | |
| 1100 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1101 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1102 | enumeratorString += string; |
| 1103 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1104 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1105 | enumeratorString += '|'; |
| 1106 | } |
| 1107 | } |
| 1108 | |
| 1109 | return enumeratorString; |
| 1110 | } |
| 1111 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1112 | static bool ValidateEnumerator(VkCommandBufferResetFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1113 | VkCommandBufferResetFlagBits allFlags = (VkCommandBufferResetFlagBits)(VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1114 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1115 | return false; |
| 1116 | } |
| 1117 | |
| 1118 | return true; |
| 1119 | } |
| 1120 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1121 | static std::string EnumeratorString(VkCommandBufferResetFlagBits const &enumerator) { |
| 1122 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1123 | return "unrecognized enumerator"; |
| 1124 | } |
| 1125 | |
| 1126 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1127 | if (enumerator & VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1128 | strings.push_back("VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1129 | } |
| 1130 | |
| 1131 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1132 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1133 | enumeratorString += string; |
| 1134 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1135 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1136 | enumeratorString += '|'; |
| 1137 | } |
| 1138 | } |
| 1139 | |
| 1140 | return enumeratorString; |
| 1141 | } |
| 1142 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1143 | static bool ValidateEnumerator(VkImageAspectFlagBits const &enumerator) { |
| 1144 | VkImageAspectFlagBits allFlags = (VkImageAspectFlagBits)(VK_IMAGE_ASPECT_METADATA_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 1145 | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_COLOR_BIT); |
| 1146 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1147 | return false; |
| 1148 | } |
| 1149 | |
| 1150 | return true; |
| 1151 | } |
| 1152 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1153 | static std::string EnumeratorString(VkImageAspectFlagBits const &enumerator) { |
| 1154 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1155 | return "unrecognized enumerator"; |
| 1156 | } |
| 1157 | |
| 1158 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1159 | if (enumerator & VK_IMAGE_ASPECT_METADATA_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1160 | strings.push_back("VK_IMAGE_ASPECT_METADATA_BIT"); |
| 1161 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1162 | if (enumerator & VK_IMAGE_ASPECT_STENCIL_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1163 | strings.push_back("VK_IMAGE_ASPECT_STENCIL_BIT"); |
| 1164 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1165 | if (enumerator & VK_IMAGE_ASPECT_DEPTH_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1166 | strings.push_back("VK_IMAGE_ASPECT_DEPTH_BIT"); |
| 1167 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1168 | if (enumerator & VK_IMAGE_ASPECT_COLOR_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1169 | strings.push_back("VK_IMAGE_ASPECT_COLOR_BIT"); |
| 1170 | } |
| 1171 | |
| 1172 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1173 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1174 | enumeratorString += string; |
| 1175 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1176 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1177 | enumeratorString += '|'; |
| 1178 | } |
| 1179 | } |
| 1180 | |
| 1181 | return enumeratorString; |
| 1182 | } |
| 1183 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1184 | static bool ValidateEnumerator(VkQueryControlFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1185 | VkQueryControlFlagBits allFlags = (VkQueryControlFlagBits)(VK_QUERY_CONTROL_PRECISE_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1186 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1187 | return false; |
| 1188 | } |
| 1189 | |
| 1190 | return true; |
| 1191 | } |
| 1192 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1193 | static std::string EnumeratorString(VkQueryControlFlagBits const &enumerator) { |
| 1194 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1195 | return "unrecognized enumerator"; |
| 1196 | } |
| 1197 | |
| 1198 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1199 | if (enumerator & VK_QUERY_CONTROL_PRECISE_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 1200 | strings.push_back("VK_QUERY_CONTROL_PRECISE_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1201 | } |
| 1202 | |
| 1203 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1204 | for (auto const &string : strings) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1205 | enumeratorString += string; |
| 1206 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1207 | if (string != strings.back()) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1208 | enumeratorString += '|'; |
| 1209 | } |
| 1210 | } |
| 1211 | |
| 1212 | return enumeratorString; |
| 1213 | } |
| 1214 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1215 | static const int MaxParamCheckerStringLength = 256; |
| 1216 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1217 | static bool validate_string(debug_report_data *report_data, const char *apiName, const char *stringName, |
| 1218 | const char *validateString) { |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1219 | assert(apiName != nullptr); |
| 1220 | assert(stringName != nullptr); |
| 1221 | assert(validateString != nullptr); |
| 1222 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1223 | bool skipCall = false; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1224 | |
| 1225 | VkStringErrorFlags result = vk_string_validate(MaxParamCheckerStringLength, validateString); |
| 1226 | |
| 1227 | if (result == VK_STRING_ERROR_NONE) { |
| 1228 | return skipCall; |
| 1229 | } else if (result & VK_STRING_ERROR_LENGTH) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1230 | skipCall = |
| 1231 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, |
| 1232 | "PARAMCHECK", "%s: string %s exceeds max length %d", apiName, stringName, MaxParamCheckerStringLength); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1233 | } else if (result & VK_STRING_ERROR_BAD_DATA) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1234 | skipCall = |
| 1235 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, |
| 1236 | "PARAMCHECK", "%s: string %s contains invalid characters or is badly formed", apiName, stringName); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1237 | } |
| 1238 | return skipCall; |
| 1239 | } |
| 1240 | |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1241 | static bool validate_queue_family_index(layer_data *device_data, const char *function_name, const char *parameter_name, |
| 1242 | uint32_t index) { |
| 1243 | assert(device_data != nullptr); |
| 1244 | debug_report_data *report_data = device_data->report_data; |
| 1245 | bool skip_call = false; |
| 1246 | |
| 1247 | if (index == VK_QUEUE_FAMILY_IGNORED) { |
| 1248 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 1249 | "PARAMCHECK", "%s: %s cannot be VK_QUEUE_FAMILY_IGNORED.", function_name, parameter_name); |
| 1250 | } else { |
| 1251 | const auto &queue_data = device_data->queueFamilyIndexMap.find(index); |
| 1252 | if (queue_data == device_data->queueFamilyIndexMap.end()) { |
| 1253 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 1254 | "PARAMCHECK", "%s: %s (%d) must be one of the indices specified when the device was created, via " |
| 1255 | "the VkDeviceQueueCreateInfo structure.", |
| 1256 | function_name, parameter_name, index); |
| 1257 | return false; |
| 1258 | } |
| 1259 | } |
| 1260 | |
| 1261 | return skip_call; |
| 1262 | } |
| 1263 | |
| 1264 | static bool validate_queue_family_indices(layer_data *device_data, const char *function_name, const char *parameter_name, |
| 1265 | const uint32_t count, const uint32_t *indices) { |
| 1266 | assert(device_data != nullptr); |
| 1267 | debug_report_data *report_data = device_data->report_data; |
| 1268 | bool skip_call = false; |
| 1269 | |
| 1270 | if (indices != nullptr) { |
| 1271 | for (uint32_t i = 0; i < count; i++) { |
| 1272 | if (indices[i] == VK_QUEUE_FAMILY_IGNORED) { |
| 1273 | skip_call |= |
| 1274 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", |
| 1275 | "%s: %s[%d] cannot be VK_QUEUE_FAMILY_IGNORED.", function_name, parameter_name, i); |
| 1276 | } else { |
| 1277 | const auto &queue_data = device_data->queueFamilyIndexMap.find(indices[i]); |
| 1278 | if (queue_data == device_data->queueFamilyIndexMap.end()) { |
| 1279 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 1280 | "PARAMCHECK", "%s: %s[%d] (%d) must be one of the indices specified when the device was " |
| 1281 | "created, via the VkDeviceQueueCreateInfo structure.", |
| 1282 | function_name, parameter_name, i, indices[i]); |
| 1283 | return false; |
| 1284 | } |
| 1285 | } |
| 1286 | } |
| 1287 | } |
| 1288 | |
| 1289 | return skip_call; |
| 1290 | } |
| 1291 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1292 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 1293 | vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) { |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1294 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1295 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1296 | VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1297 | assert(chain_info != nullptr); |
| 1298 | assert(chain_info->u.pLayerInfo != nullptr); |
| 1299 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1300 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 1301 | PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)fpGetInstanceProcAddr(NULL, "vkCreateInstance"); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1302 | if (fpCreateInstance == NULL) { |
| 1303 | return VK_ERROR_INITIALIZATION_FAILED; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1304 | } |
| 1305 | |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1306 | // Advance the link info for the next element on the chain |
| 1307 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 1308 | |
| 1309 | result = fpCreateInstance(pCreateInfo, pAllocator, pInstance); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1310 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1311 | if (result == VK_SUCCESS) { |
| 1312 | layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map); |
| 1313 | assert(my_instance_data != nullptr); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1314 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1315 | VkLayerInstanceDispatchTable *pTable = initInstanceTable(*pInstance, fpGetInstanceProcAddr, pc_instance_table_map); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1316 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1317 | my_instance_data->report_data = debug_report_create_instance(pTable, *pInstance, pCreateInfo->enabledExtensionCount, |
| 1318 | pCreateInfo->ppEnabledExtensionNames); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1319 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1320 | // Look for one or more debug report create info structures |
| 1321 | // and setup a callback(s) for each one found. |
| 1322 | if (!layer_copy_tmp_callbacks(pCreateInfo->pNext, &my_instance_data->num_tmp_callbacks, |
| 1323 | &my_instance_data->tmp_dbg_create_infos, &my_instance_data->tmp_callbacks)) { |
| 1324 | if (my_instance_data->num_tmp_callbacks > 0) { |
| 1325 | // Setup the temporary callback(s) here to catch early issues: |
| 1326 | if (layer_enable_tmp_callbacks(my_instance_data->report_data, my_instance_data->num_tmp_callbacks, |
| 1327 | my_instance_data->tmp_dbg_create_infos, my_instance_data->tmp_callbacks)) { |
| 1328 | // Failure of setting up one or more of the callback. |
| 1329 | // Therefore, clean up and don't use those callbacks: |
| 1330 | layer_free_tmp_callbacks(my_instance_data->tmp_dbg_create_infos, my_instance_data->tmp_callbacks); |
| 1331 | my_instance_data->num_tmp_callbacks = 0; |
| 1332 | } |
| 1333 | } |
| 1334 | } |
| 1335 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1336 | init_parameter_validation(my_instance_data, pAllocator); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1337 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1338 | // Ordinarily we'd check these before calling down the chain, but none of the layer |
| 1339 | // support is in place until now, if we survive we can report the issue now. |
| 1340 | parameter_validation_vkCreateInstance(my_instance_data->report_data, pCreateInfo, pAllocator, pInstance); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1341 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1342 | if (pCreateInfo->pApplicationInfo) { |
| 1343 | if (pCreateInfo->pApplicationInfo->pApplicationName) { |
| 1344 | validate_string(my_instance_data->report_data, "vkCreateInstance", |
| 1345 | "pCreateInfo->VkApplicationInfo->pApplicationName", |
| 1346 | pCreateInfo->pApplicationInfo->pApplicationName); |
| 1347 | } |
Courtney Goeltzenleuchter | 842691b | 2016-02-10 14:00:52 -0700 | [diff] [blame] | 1348 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1349 | if (pCreateInfo->pApplicationInfo->pEngineName) { |
| 1350 | validate_string(my_instance_data->report_data, "vkCreateInstance", "pCreateInfo->VkApplicationInfo->pEngineName", |
| 1351 | pCreateInfo->pApplicationInfo->pEngineName); |
| 1352 | } |
Courtney Goeltzenleuchter | 41c5c4b | 2016-02-10 15:13:55 -0700 | [diff] [blame] | 1353 | } |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1354 | |
| 1355 | // Disable the tmp callbacks: |
| 1356 | if (my_instance_data->num_tmp_callbacks > 0) { |
| 1357 | layer_disable_tmp_callbacks(my_instance_data->report_data, my_instance_data->num_tmp_callbacks, |
| 1358 | my_instance_data->tmp_callbacks); |
| 1359 | } |
Courtney Goeltzenleuchter | 842691b | 2016-02-10 14:00:52 -0700 | [diff] [blame] | 1360 | } |
| 1361 | |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1362 | return result; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1363 | } |
| 1364 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1365 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1366 | // Grab the key before the instance is destroyed. |
| 1367 | dispatch_key key = get_dispatch_key(instance); |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1368 | bool skipCall = false; |
Courtney Goeltzenleuchter | d29f4f0 | 2015-10-05 15:59:45 -0600 | [diff] [blame] | 1369 | layer_data *my_data = get_my_data_ptr(key, layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1370 | assert(my_data != NULL); |
| 1371 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1372 | // Enable the temporary callback(s) here to catch vkDestroyInstance issues: |
| 1373 | bool callback_setup = false; |
| 1374 | if (my_data->num_tmp_callbacks > 0) { |
| 1375 | if (!layer_enable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_dbg_create_infos, |
| 1376 | my_data->tmp_callbacks)) { |
| 1377 | callback_setup = true; |
| 1378 | } |
| 1379 | } |
| 1380 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1381 | skipCall |= parameter_validation_vkDestroyInstance(my_data->report_data, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1382 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1383 | // Disable and cleanup the temporary callback(s): |
| 1384 | if (callback_setup) { |
| 1385 | layer_disable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_callbacks); |
| 1386 | } |
| 1387 | if (my_data->num_tmp_callbacks > 0) { |
| 1388 | layer_free_tmp_callbacks(my_data->tmp_dbg_create_infos, my_data->tmp_callbacks); |
| 1389 | my_data->num_tmp_callbacks = 0; |
| 1390 | } |
| 1391 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1392 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1393 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1394 | pTable->DestroyInstance(instance, pAllocator); |
| 1395 | |
| 1396 | // Clean up logging callback, if any |
| 1397 | while (my_data->logging_callback.size() > 0) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1398 | VkDebugReportCallbackEXT callback = my_data->logging_callback.back(); |
| 1399 | layer_destroy_msg_callback(my_data->report_data, callback, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1400 | my_data->logging_callback.pop_back(); |
| 1401 | } |
| 1402 | |
| 1403 | layer_debug_report_destroy_instance(mid(instance)); |
| 1404 | layer_data_map.erase(pTable); |
| 1405 | |
| 1406 | pc_instance_table_map.erase(key); |
Tony Barbour | 24edb7c | 2016-03-22 13:23:24 -0600 | [diff] [blame] | 1407 | layer_data_map.erase(key); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1408 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1409 | } |
| 1410 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1411 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 1412 | vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices) { |
| 1413 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1414 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1415 | 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] | 1416 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1417 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1418 | skipCall |= parameter_validation_vkEnumeratePhysicalDevices(my_data->report_data, pPhysicalDeviceCount, pPhysicalDevices); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1419 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1420 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1421 | result = get_dispatch_table(pc_instance_table_map, instance) |
| 1422 | ->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1423 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1424 | validate_result(my_data->report_data, "vkEnumeratePhysicalDevices", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1425 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1426 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1427 | return result; |
| 1428 | } |
| 1429 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1430 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 1431 | vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1432 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1433 | 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] | 1434 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1435 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1436 | skipCall |= parameter_validation_vkGetPhysicalDeviceFeatures(my_data->report_data, pFeatures); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1437 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1438 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1439 | get_dispatch_table(pc_instance_table_map, physicalDevice)->GetPhysicalDeviceFeatures(physicalDevice, pFeatures); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1440 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1441 | } |
| 1442 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1443 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 1444 | vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1445 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1446 | 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] | 1447 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1448 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1449 | skipCall |= parameter_validation_vkGetPhysicalDeviceFormatProperties(my_data->report_data, format, pFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1450 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1451 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1452 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1453 | ->GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1454 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1455 | } |
| 1456 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1457 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 1458 | vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, |
| 1459 | VkImageUsageFlags usage, VkImageCreateFlags flags, |
| 1460 | VkImageFormatProperties *pImageFormatProperties) { |
| 1461 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1462 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1463 | 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] | 1464 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1465 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1466 | skipCall |= parameter_validation_vkGetPhysicalDeviceImageFormatProperties(my_data->report_data, format, type, tiling, usage, flags, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1467 | pImageFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1468 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1469 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1470 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1471 | ->GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, |
| 1472 | pImageFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1473 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1474 | validate_result(my_data->report_data, "vkGetPhysicalDeviceImageFormatProperties", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1475 | } |
Chia-I Wu | 1724104 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 1476 | |
| 1477 | return result; |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1478 | } |
| 1479 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1480 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 1481 | vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1482 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1483 | 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] | 1484 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1485 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1486 | skipCall |= parameter_validation_vkGetPhysicalDeviceProperties(my_data->report_data, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1487 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1488 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1489 | get_dispatch_table(pc_instance_table_map, physicalDevice)->GetPhysicalDeviceProperties(physicalDevice, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1490 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1491 | } |
| 1492 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1493 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 1494 | vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, |
| 1495 | VkQueueFamilyProperties *pQueueFamilyProperties) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1496 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1497 | 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] | 1498 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1499 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1500 | skipCall |= parameter_validation_vkGetPhysicalDeviceQueueFamilyProperties(my_data->report_data, pQueueFamilyPropertyCount, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1501 | pQueueFamilyProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1502 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1503 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1504 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1505 | ->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1506 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1507 | } |
| 1508 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1509 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 1510 | vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties *pMemoryProperties) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1511 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1512 | 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] | 1513 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1514 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1515 | skipCall |= parameter_validation_vkGetPhysicalDeviceMemoryProperties(my_data->report_data, pMemoryProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1516 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1517 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1518 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1519 | ->GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1520 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1521 | } |
| 1522 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1523 | void validateDeviceCreateInfo(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
| 1524 | const std::vector<VkQueueFamilyProperties> properties) { |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 1525 | std::unordered_set<uint32_t> set; |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1526 | |
| 1527 | if ((pCreateInfo != nullptr) && (pCreateInfo->pQueueCreateInfos != nullptr)) { |
| 1528 | for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { |
| 1529 | if (set.count(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex)) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1530 | log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 1531 | INVALID_USAGE, "PARAMCHECK", |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1532 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueFamilyIndex, is not unique within this " |
| 1533 | "structure.", |
| 1534 | i); |
| 1535 | } else { |
| 1536 | set.insert(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex); |
Michael Lentine | fa71bd5 | 2016-01-27 12:50:30 -0600 | [diff] [blame] | 1537 | } |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1538 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1539 | if (pCreateInfo->pQueueCreateInfos[i].pQueuePriorities != nullptr) { |
| 1540 | for (uint32_t j = 0; j < pCreateInfo->pQueueCreateInfos[i].queueCount; ++j) { |
| 1541 | if ((pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j] < 0.f) || |
| 1542 | (pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j] > 1.f)) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1543 | log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1544 | __LINE__, INVALID_USAGE, "PARAMCHECK", |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1545 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->pQueuePriorities[%d], must be " |
| 1546 | "between 0 and 1. Actual value is %f", |
| 1547 | i, j, pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j]); |
| 1548 | } |
| 1549 | } |
| 1550 | } |
| 1551 | |
| 1552 | if (pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex >= properties.size()) { |
| 1553 | log_msg( |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1554 | mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 1555 | INVALID_USAGE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1556 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueFamilyIndex cannot be more than the number " |
| 1557 | "of queue families.", |
| 1558 | i); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1559 | } else if (pCreateInfo->pQueueCreateInfos[i].queueCount > |
| 1560 | properties[pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex].queueCount) { |
| 1561 | log_msg( |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1562 | mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 1563 | INVALID_USAGE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1564 | "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueCount cannot be more than the number of " |
| 1565 | "queues for the given family index.", |
| 1566 | i); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1567 | } |
Michael Lentine | 774704f | 2016-01-27 13:36:46 -0600 | [diff] [blame] | 1568 | } |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 1569 | } |
| 1570 | } |
| 1571 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1572 | void storeCreateDeviceData(VkDevice device, const VkDeviceCreateInfo *pCreateInfo) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1573 | 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] | 1574 | |
| 1575 | if ((pCreateInfo != nullptr) && (pCreateInfo->pQueueCreateInfos != nullptr)) { |
| 1576 | for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { |
| 1577 | my_device_data->queueFamilyIndexMap.insert( |
| 1578 | std::make_pair(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex, pCreateInfo->pQueueCreateInfos[i].queueCount)); |
| 1579 | } |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1580 | } |
| 1581 | } |
| 1582 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1583 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, |
| 1584 | const VkDeviceCreateInfo *pCreateInfo, |
| 1585 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { |
Courtney Goeltzenleuchter | bafcdf3 | 2015-09-08 17:42:57 -0600 | [diff] [blame] | 1586 | /* |
Courtney Goeltzenleuchter | bafcdf3 | 2015-09-08 17:42:57 -0600 | [diff] [blame] | 1587 | * NOTE: We do not validate physicalDevice or any dispatchable |
| 1588 | * object as the first parameter. We couldn't get here if it was wrong! |
| 1589 | */ |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1590 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1591 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1592 | bool skipCall = false; |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1593 | 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] | 1594 | assert(my_instance_data != nullptr); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1595 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1596 | skipCall |= parameter_validation_vkCreateDevice(my_instance_data->report_data, pCreateInfo, pAllocator, pDevice); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1597 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1598 | if (pCreateInfo != NULL) { |
| 1599 | if ((pCreateInfo->enabledLayerCount > 0) && (pCreateInfo->ppEnabledLayerNames != NULL)) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 1600 | for (size_t i = 0; i < pCreateInfo->enabledLayerCount; i++) { |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1601 | skipCall |= validate_string(my_instance_data->report_data, "vkCreateDevice", "pCreateInfo->ppEnabledLayerNames", |
| 1602 | pCreateInfo->ppEnabledLayerNames[i]); |
| 1603 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1604 | } |
Michael Lentine | 774704f | 2016-01-27 13:36:46 -0600 | [diff] [blame] | 1605 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1606 | if ((pCreateInfo->enabledExtensionCount > 0) && (pCreateInfo->ppEnabledExtensionNames != NULL)) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 1607 | for (size_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1608 | skipCall |= validate_string(my_instance_data->report_data, "vkCreateDevice", "pCreateInfo->ppEnabledExtensionNames", |
| 1609 | pCreateInfo->ppEnabledExtensionNames[i]); |
| 1610 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1611 | } |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1612 | } |
| 1613 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1614 | if (!skipCall) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1615 | VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1616 | assert(chain_info != nullptr); |
| 1617 | assert(chain_info->u.pLayerInfo != nullptr); |
| 1618 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1619 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 1620 | PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1621 | PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(NULL, "vkCreateDevice"); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1622 | if (fpCreateDevice == NULL) { |
| 1623 | return VK_ERROR_INITIALIZATION_FAILED; |
| 1624 | } |
| 1625 | |
| 1626 | // Advance the link info for the next element on the chain |
| 1627 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 1628 | |
| 1629 | result = fpCreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1630 | |
| 1631 | validate_result(my_instance_data->report_data, "vkCreateDevice", result); |
| 1632 | |
| 1633 | if (result == VK_SUCCESS) { |
| 1634 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map); |
| 1635 | assert(my_device_data != nullptr); |
| 1636 | |
| 1637 | my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice); |
| 1638 | initDeviceTable(*pDevice, fpGetDeviceProcAddr, pc_device_table_map); |
| 1639 | |
| 1640 | uint32_t count; |
| 1641 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1642 | ->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, nullptr); |
| 1643 | std::vector<VkQueueFamilyProperties> properties(count); |
| 1644 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1645 | ->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, &properties[0]); |
| 1646 | |
| 1647 | validateDeviceCreateInfo(physicalDevice, pCreateInfo, properties); |
| 1648 | storeCreateDeviceData(*pDevice, pCreateInfo); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1649 | } |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1650 | } |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 1651 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1652 | return result; |
| 1653 | } |
| 1654 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1655 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1656 | dispatch_key key = get_dispatch_key(device); |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1657 | bool skipCall = false; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1658 | layer_data *my_data = get_my_data_ptr(key, layer_data_map); |
| 1659 | assert(my_data != NULL); |
| 1660 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1661 | skipCall |= parameter_validation_vkDestroyDevice(my_data->report_data, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1662 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1663 | if (!skipCall) { |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1664 | layer_debug_report_destroy_device(device); |
| 1665 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1666 | #if DISPATCH_MAP_DEBUG |
Mark Mueller | aab3650 | 2016-05-03 13:17:29 -0600 | [diff] [blame] | 1667 | fprintf(stderr, "Device: 0x%p, key: 0x%p\n", device, key); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1668 | #endif |
| 1669 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1670 | get_dispatch_table(pc_device_table_map, device)->DestroyDevice(device, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1671 | pc_device_table_map.erase(key); |
Tony Barbour | d4eb06d | 2016-03-29 15:14:59 -0600 | [diff] [blame] | 1672 | layer_data_map.erase(key); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1673 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1674 | } |
| 1675 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1676 | bool PreGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1677 | 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] | 1678 | assert(my_device_data != nullptr); |
| 1679 | |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1680 | validate_queue_family_index(my_device_data, "vkGetDeviceQueue", "queueFamilyIndex", queueFamilyIndex); |
Mark Lobodzinski | f20f094 | 2016-03-22 10:07:26 -0600 | [diff] [blame] | 1681 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1682 | const auto &queue_data = my_device_data->queueFamilyIndexMap.find(queueFamilyIndex); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1683 | if (queue_data->second <= queueIndex) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1684 | log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, |
| 1685 | "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1686 | "VkGetDeviceQueue parameter, uint32_t queueIndex %d, must be less than the number of queues given when the device " |
| 1687 | "was created.", |
| 1688 | queueIndex); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1689 | return false; |
| 1690 | } |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1691 | |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1692 | return true; |
| 1693 | } |
| 1694 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1695 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 1696 | vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1697 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1698 | 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] | 1699 | assert(my_data != NULL); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1700 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1701 | skipCall |= parameter_validation_vkGetDeviceQueue(my_data->report_data, queueFamilyIndex, queueIndex, pQueue); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1702 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1703 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1704 | PreGetDeviceQueue(device, queueFamilyIndex, queueIndex); |
| 1705 | |
| 1706 | 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] | 1707 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1708 | } |
| 1709 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1710 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 1711 | vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence) { |
| 1712 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1713 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1714 | 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] | 1715 | assert(my_data != NULL); |
| 1716 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1717 | skipCall |= parameter_validation_vkQueueSubmit(my_data->report_data, submitCount, pSubmits, fence); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1718 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1719 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1720 | result = get_dispatch_table(pc_device_table_map, queue)->QueueSubmit(queue, submitCount, pSubmits, fence); |
| 1721 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1722 | validate_result(my_data->report_data, "vkQueueSubmit", result); |
Courtney Goeltzenleuchter | 646b907 | 2015-10-20 18:04:07 -0600 | [diff] [blame] | 1723 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1724 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1725 | return result; |
| 1726 | } |
| 1727 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1728 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) { |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1729 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map); |
| 1730 | assert(my_data != NULL); |
| 1731 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1732 | VkResult result = get_dispatch_table(pc_device_table_map, queue)->QueueWaitIdle(queue); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1733 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1734 | validate_result(my_data->report_data, "vkQueueWaitIdle", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1735 | |
| 1736 | return result; |
| 1737 | } |
| 1738 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1739 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) { |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1740 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1741 | assert(my_data != NULL); |
| 1742 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1743 | VkResult result = get_dispatch_table(pc_device_table_map, device)->DeviceWaitIdle(device); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1744 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1745 | validate_result(my_data->report_data, "vkDeviceWaitIdle", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1746 | |
| 1747 | return result; |
| 1748 | } |
| 1749 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1750 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, |
| 1751 | const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) { |
| 1752 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1753 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1754 | 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] | 1755 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1756 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1757 | skipCall |= parameter_validation_vkAllocateMemory(my_data->report_data, pAllocateInfo, pAllocator, pMemory); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1758 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1759 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1760 | result = get_dispatch_table(pc_device_table_map, device)->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory); |
| 1761 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1762 | validate_result(my_data->report_data, "vkAllocateMemory", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1763 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1764 | |
| 1765 | return result; |
| 1766 | } |
| 1767 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1768 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1769 | vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1770 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1771 | 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] | 1772 | assert(my_data != NULL); |
| 1773 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1774 | skipCall |= parameter_validation_vkFreeMemory(my_data->report_data, memory, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1775 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1776 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1777 | get_dispatch_table(pc_device_table_map, device)->FreeMemory(device, memory, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1778 | } |
| 1779 | } |
| 1780 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1781 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 1782 | vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData) { |
| 1783 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1784 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1785 | 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] | 1786 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1787 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1788 | skipCall |= parameter_validation_vkMapMemory(my_data->report_data, memory, offset, size, flags, ppData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1789 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1790 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1791 | result = get_dispatch_table(pc_device_table_map, device)->MapMemory(device, memory, offset, size, flags, ppData); |
| 1792 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1793 | validate_result(my_data->report_data, "vkMapMemory", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1794 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1795 | |
| 1796 | return result; |
| 1797 | } |
| 1798 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1799 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory memory) { |
| 1800 | bool skipCall = false; |
| 1801 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1802 | assert(my_data != NULL); |
| 1803 | |
| 1804 | skipCall |= parameter_validation_vkUnmapMemory(my_data->report_data, memory); |
| 1805 | |
| 1806 | if (!skipCall) { |
| 1807 | get_dispatch_table(pc_device_table_map, device)->UnmapMemory(device, memory); |
| 1808 | } |
| 1809 | } |
| 1810 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1811 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 1812 | vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges) { |
| 1813 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1814 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1815 | 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] | 1816 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1817 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1818 | skipCall |= parameter_validation_vkFlushMappedMemoryRanges(my_data->report_data, memoryRangeCount, pMemoryRanges); |
Tony Barbour | b125054 | 2015-04-16 19:23:13 -0600 | [diff] [blame] | 1819 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1820 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1821 | result = get_dispatch_table(pc_device_table_map, device)->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
| 1822 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1823 | validate_result(my_data->report_data, "vkFlushMappedMemoryRanges", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1824 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1825 | |
Courtney Goeltzenleuchter | f69f8a2 | 2015-04-29 17:16:21 -0600 | [diff] [blame] | 1826 | return result; |
| 1827 | } |
| 1828 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1829 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 1830 | vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges) { |
| 1831 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1832 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1833 | 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] | 1834 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1835 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1836 | skipCall |= parameter_validation_vkInvalidateMappedMemoryRanges(my_data->report_data, memoryRangeCount, pMemoryRanges); |
Courtney Goeltzenleuchter | f69f8a2 | 2015-04-29 17:16:21 -0600 | [diff] [blame] | 1837 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1838 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1839 | result = |
| 1840 | get_dispatch_table(pc_device_table_map, device)->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1841 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1842 | validate_result(my_data->report_data, "vkInvalidateMappedMemoryRanges", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1843 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1844 | |
Tony Barbour | b125054 | 2015-04-16 19:23:13 -0600 | [diff] [blame] | 1845 | return result; |
| 1846 | } |
| 1847 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1848 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 1849 | vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize *pCommittedMemoryInBytes) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1850 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1851 | 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] | 1852 | assert(my_data != NULL); |
Courtney Goeltzenleuchter | fb71f22 | 2015-07-09 21:57:28 -0600 | [diff] [blame] | 1853 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1854 | skipCall |= parameter_validation_vkGetDeviceMemoryCommitment(my_data->report_data, memory, pCommittedMemoryInBytes); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1855 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1856 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1857 | get_dispatch_table(pc_device_table_map, device)->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1858 | } |
Courtney Goeltzenleuchter | fb71f22 | 2015-07-09 21:57:28 -0600 | [diff] [blame] | 1859 | } |
| 1860 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1861 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, |
| 1862 | VkDeviceSize memoryOffset) { |
| 1863 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 1864 | bool skipCall = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1865 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1866 | assert(my_data != NULL); |
| 1867 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1868 | skipCall |= parameter_validation_vkBindBufferMemory(my_data->report_data, buffer, memory, memoryOffset); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1869 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1870 | if (!skipCall) { |
| 1871 | result = get_dispatch_table(pc_device_table_map, device)->BindBufferMemory(device, buffer, memory, memoryOffset); |
| 1872 | |
| 1873 | validate_result(my_data->report_data, "vkBindBufferMemory", result); |
| 1874 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1875 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1876 | return result; |
| 1877 | } |
| 1878 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1879 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, |
| 1880 | VkDeviceSize memoryOffset) { |
| 1881 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 1882 | bool skipCall = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1883 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1884 | assert(my_data != NULL); |
| 1885 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1886 | skipCall |= parameter_validation_vkBindImageMemory(my_data->report_data, image, memory, memoryOffset); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1887 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1888 | if (!skipCall) { |
| 1889 | result = get_dispatch_table(pc_device_table_map, device)->BindImageMemory(device, image, memory, memoryOffset); |
| 1890 | |
| 1891 | validate_result(my_data->report_data, "vkBindImageMemory", result); |
| 1892 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1893 | |
| 1894 | return result; |
| 1895 | } |
| 1896 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1897 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 1898 | vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements *pMemoryRequirements) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1899 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1900 | 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] | 1901 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1902 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1903 | skipCall |= parameter_validation_vkGetBufferMemoryRequirements(my_data->report_data, buffer, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1904 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1905 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1906 | get_dispatch_table(pc_device_table_map, device)->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1907 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1908 | } |
| 1909 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1910 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 1911 | vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1912 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1913 | 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] | 1914 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1915 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1916 | skipCall |= parameter_validation_vkGetImageMemoryRequirements(my_data->report_data, image, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1917 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1918 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1919 | get_dispatch_table(pc_device_table_map, device)->GetImageMemoryRequirements(device, image, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1920 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1921 | } |
| 1922 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1923 | bool PostGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pNumRequirements, |
| 1924 | VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { |
| 1925 | if (pSparseMemoryRequirements != nullptr) { |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 1926 | if ((pSparseMemoryRequirements->formatProperties.aspectMask & |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1927 | (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 1928 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1929 | log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 1930 | UNRECOGNIZED_VALUE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1931 | "vkGetImageSparseMemoryRequirements parameter, VkImageAspect " |
| 1932 | "pSparseMemoryRequirements->formatProperties.aspectMask, is an unrecognized enumerator"); |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 1933 | return false; |
| 1934 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1935 | } |
| 1936 | |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1937 | return true; |
| 1938 | } |
| 1939 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1940 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 1941 | vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, |
| 1942 | VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1943 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1944 | 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] | 1945 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1946 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1947 | skipCall |= parameter_validation_vkGetImageSparseMemoryRequirements(my_data->report_data, image, pSparseMemoryRequirementCount, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1948 | pSparseMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1949 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1950 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1951 | get_dispatch_table(pc_device_table_map, device) |
| 1952 | ->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1953 | |
| 1954 | PostGetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 1955 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1956 | } |
| 1957 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1958 | bool PostGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, |
| 1959 | VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, |
| 1960 | uint32_t *pNumProperties, VkSparseImageFormatProperties *pProperties) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1961 | if (pProperties != nullptr) { |
| 1962 | if ((pProperties->aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 1963 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 1964 | log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, 1, |
| 1965 | "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1966 | "vkGetPhysicalDeviceSparseImageFormatProperties parameter, VkImageAspect pProperties->aspectMask, is an " |
| 1967 | "unrecognized enumerator"); |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 1968 | return false; |
| 1969 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1970 | } |
| 1971 | |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1972 | return true; |
| 1973 | } |
| 1974 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1975 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 1976 | vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, |
| 1977 | VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, |
| 1978 | uint32_t *pPropertyCount, VkSparseImageFormatProperties *pProperties) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1979 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1980 | 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] | 1981 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1982 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 1983 | skipCall |= parameter_validation_vkGetPhysicalDeviceSparseImageFormatProperties(my_data->report_data, format, type, samples, usage, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1984 | tiling, pPropertyCount, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1985 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1986 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1987 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1988 | ->GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, |
| 1989 | pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1990 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1991 | PostGetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, |
| 1992 | pProperties); |
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 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1996 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 1997 | vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, VkFence fence) { |
| 1998 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1999 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2000 | 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] | 2001 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2002 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2003 | skipCall |= parameter_validation_vkQueueBindSparse(my_data->report_data, bindInfoCount, pBindInfo, fence); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2004 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2005 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2006 | result = get_dispatch_table(pc_device_table_map, queue)->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); |
| 2007 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2008 | validate_result(my_data->report_data, "vkQueueBindSparse", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2009 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2010 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 2011 | return result; |
| 2012 | } |
| 2013 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2014 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 2015 | vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
| 2016 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2017 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2018 | 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] | 2019 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2020 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2021 | skipCall |= parameter_validation_vkCreateFence(my_data->report_data, pCreateInfo, pAllocator, pFence); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2022 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2023 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2024 | result = get_dispatch_table(pc_device_table_map, device)->CreateFence(device, pCreateInfo, pAllocator, pFence); |
| 2025 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2026 | validate_result(my_data->report_data, "vkCreateFence", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2027 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2028 | |
| 2029 | return result; |
| 2030 | } |
| 2031 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2032 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2033 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2034 | 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] | 2035 | assert(my_data != NULL); |
| 2036 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2037 | skipCall |= parameter_validation_vkDestroyFence(my_data->report_data, fence, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2038 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2039 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2040 | get_dispatch_table(pc_device_table_map, device)->DestroyFence(device, fence, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2041 | } |
| 2042 | } |
| 2043 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2044 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) { |
| 2045 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2046 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2047 | 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] | 2048 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2049 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2050 | skipCall |= parameter_validation_vkResetFences(my_data->report_data, fenceCount, pFences); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2051 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2052 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2053 | result = get_dispatch_table(pc_device_table_map, device)->ResetFences(device, fenceCount, pFences); |
| 2054 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2055 | validate_result(my_data->report_data, "vkResetFences", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2056 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2057 | |
| 2058 | return result; |
| 2059 | } |
| 2060 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2061 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2062 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 2063 | bool skipCall = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2064 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2065 | assert(my_data != NULL); |
| 2066 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2067 | skipCall |= parameter_validation_vkGetFenceStatus(my_data->report_data, fence); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2068 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2069 | if (!skipCall) { |
| 2070 | result = get_dispatch_table(pc_device_table_map, device)->GetFenceStatus(device, fence); |
| 2071 | |
| 2072 | validate_result(my_data->report_data, "vkGetFenceStatus", result); |
| 2073 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2074 | |
| 2075 | return result; |
| 2076 | } |
| 2077 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2078 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 2079 | vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, uint64_t timeout) { |
| 2080 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2081 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2082 | 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] | 2083 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2084 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2085 | skipCall |= parameter_validation_vkWaitForFences(my_data->report_data, fenceCount, pFences, waitAll, timeout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2086 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2087 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2088 | result = get_dispatch_table(pc_device_table_map, device)->WaitForFences(device, fenceCount, pFences, waitAll, timeout); |
| 2089 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2090 | validate_result(my_data->report_data, "vkWaitForFences", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2091 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2092 | |
| 2093 | return result; |
| 2094 | } |
| 2095 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2096 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, |
| 2097 | const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) { |
| 2098 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2099 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2100 | 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] | 2101 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2102 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2103 | skipCall |= parameter_validation_vkCreateSemaphore(my_data->report_data, pCreateInfo, pAllocator, pSemaphore); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2104 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2105 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2106 | result = get_dispatch_table(pc_device_table_map, device)->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore); |
| 2107 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2108 | validate_result(my_data->report_data, "vkCreateSemaphore", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2109 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2110 | |
| 2111 | return result; |
| 2112 | } |
| 2113 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2114 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2115 | vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2116 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2117 | 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] | 2118 | assert(my_data != NULL); |
| 2119 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2120 | skipCall |= parameter_validation_vkDestroySemaphore(my_data->report_data, semaphore, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2121 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2122 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2123 | get_dispatch_table(pc_device_table_map, device)->DestroySemaphore(device, semaphore, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2124 | } |
| 2125 | } |
| 2126 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2127 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 2128 | vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) { |
| 2129 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2130 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2131 | 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] | 2132 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2133 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2134 | skipCall |= parameter_validation_vkCreateEvent(my_data->report_data, pCreateInfo, pAllocator, pEvent); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2135 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2136 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2137 | result = get_dispatch_table(pc_device_table_map, device)->CreateEvent(device, pCreateInfo, pAllocator, pEvent); |
| 2138 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2139 | validate_result(my_data->report_data, "vkCreateEvent", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2140 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2141 | |
| 2142 | return result; |
| 2143 | } |
| 2144 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2145 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2146 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2147 | 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] | 2148 | assert(my_data != NULL); |
| 2149 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2150 | skipCall |= parameter_validation_vkDestroyEvent(my_data->report_data, event, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2151 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2152 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2153 | get_dispatch_table(pc_device_table_map, device)->DestroyEvent(device, event, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2154 | } |
| 2155 | } |
| 2156 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2157 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2158 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 2159 | bool skipCall = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2160 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2161 | assert(my_data != NULL); |
| 2162 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2163 | skipCall |= parameter_validation_vkGetEventStatus(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2164 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2165 | if (!skipCall) { |
| 2166 | result = get_dispatch_table(pc_device_table_map, device)->GetEventStatus(device, event); |
| 2167 | |
| 2168 | validate_result(my_data->report_data, "vkGetEventStatus", result); |
| 2169 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2170 | |
| 2171 | return result; |
| 2172 | } |
| 2173 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2174 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2175 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 2176 | bool skipCall = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2177 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2178 | assert(my_data != NULL); |
| 2179 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2180 | skipCall |= parameter_validation_vkSetEvent(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2181 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2182 | if (!skipCall) { |
| 2183 | result = get_dispatch_table(pc_device_table_map, device)->SetEvent(device, event); |
| 2184 | |
| 2185 | validate_result(my_data->report_data, "vkSetEvent", result); |
| 2186 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2187 | |
| 2188 | return result; |
| 2189 | } |
| 2190 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2191 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2192 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 2193 | bool skipCall = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2194 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2195 | assert(my_data != NULL); |
| 2196 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2197 | skipCall |= parameter_validation_vkResetEvent(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2198 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2199 | if (!skipCall) { |
| 2200 | result = get_dispatch_table(pc_device_table_map, device)->ResetEvent(device, event); |
| 2201 | |
| 2202 | validate_result(my_data->report_data, "vkResetEvent", result); |
| 2203 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2204 | |
| 2205 | return result; |
| 2206 | } |
| 2207 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2208 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, |
| 2209 | const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) { |
| 2210 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2211 | bool skip_call = false; |
| 2212 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2213 | assert(device_data != nullptr); |
| 2214 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2215 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2216 | skip_call |= parameter_validation_vkCreateQueryPool(device_data->report_data, pCreateInfo, pAllocator, pQueryPool); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2217 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2218 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2219 | if (pCreateInfo != nullptr) { |
| 2220 | // If queryType is VK_QUERY_TYPE_PIPELINE_STATISTICS, pipelineStatistics must be a valid combination of |
| 2221 | // VkQueryPipelineStatisticFlagBits values |
| 2222 | if ((pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS) && (pCreateInfo->pipelineStatistics != 0) && |
| 2223 | ((pCreateInfo->pipelineStatistics & (~AllVkQueryPipelineStatisticFlagBits)) != 0)) { |
| 2224 | skip_call |= |
| 2225 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2226 | UNRECOGNIZED_VALUE, LayerName, "vkCreateQueryPool: if pCreateInfo->queryType is " |
| 2227 | "VK_QUERY_TYPE_PIPELINE_STATISTICS, pCreateInfo->pipelineStatistics must be " |
| 2228 | "a valid combination of VkQueryPipelineStatisticFlagBits values"); |
| 2229 | } |
| 2230 | } |
| 2231 | |
| 2232 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2233 | result = get_dispatch_table(pc_device_table_map, device)->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); |
| 2234 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2235 | validate_result(report_data, "vkCreateQueryPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2236 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2237 | |
| 2238 | return result; |
| 2239 | } |
| 2240 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2241 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2242 | vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2243 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2244 | 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] | 2245 | assert(my_data != NULL); |
| 2246 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2247 | skipCall |= parameter_validation_vkDestroyQueryPool(my_data->report_data, queryPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2248 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2249 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2250 | get_dispatch_table(pc_device_table_map, device)->DestroyQueryPool(device, queryPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2251 | } |
| 2252 | } |
| 2253 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2254 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, |
| 2255 | uint32_t queryCount, size_t dataSize, void *pData, |
| 2256 | VkDeviceSize stride, VkQueryResultFlags flags) { |
| 2257 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2258 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2259 | 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] | 2260 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2261 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2262 | skipCall |= |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2263 | parameter_validation_vkGetQueryPoolResults(my_data->report_data, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2264 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2265 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2266 | result = get_dispatch_table(pc_device_table_map, device) |
| 2267 | ->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2268 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2269 | validate_result(my_data->report_data, "vkGetQueryPoolResults", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2270 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2271 | |
| 2272 | return result; |
| 2273 | } |
| 2274 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2275 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 2276 | vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { |
| 2277 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2278 | bool skip_call = false; |
| 2279 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2280 | assert(device_data != nullptr); |
| 2281 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2282 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2283 | skip_call |= parameter_validation_vkCreateBuffer(report_data, pCreateInfo, pAllocator, pBuffer); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2284 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2285 | if (pCreateInfo != nullptr) { |
| 2286 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2287 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 2288 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 2289 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
| 2290 | skip_call |= |
| 2291 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2292 | INVALID_USAGE, LayerName, "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2293 | "pCreateInfo->queueFamilyIndexCount must be greater than 1"); |
| 2294 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2295 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2296 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 2297 | // queueFamilyIndexCount uint32_t values |
| 2298 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
| 2299 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2300 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 2301 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2302 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
| 2303 | "pCreateInfo->queueFamilyIndexCount uint32_t values"); |
| 2304 | } |
| 2305 | |
| 2306 | // Ensure that the queue family indices were specified at device creation |
| 2307 | skip_call |= validate_queue_family_indices(device_data, "vkCreateBuffer", "pCreateInfo->pQueueFamilyIndices", |
| 2308 | pCreateInfo->queueFamilyIndexCount, pCreateInfo->pQueueFamilyIndices); |
| 2309 | } |
| 2310 | } |
| 2311 | |
| 2312 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2313 | result = get_dispatch_table(pc_device_table_map, device)->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); |
| 2314 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2315 | validate_result(report_data, "vkCreateBuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2316 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2317 | |
| 2318 | return result; |
| 2319 | } |
| 2320 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2321 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2322 | vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2323 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2324 | 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] | 2325 | assert(my_data != NULL); |
| 2326 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2327 | skipCall |= parameter_validation_vkDestroyBuffer(my_data->report_data, buffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2328 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2329 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2330 | get_dispatch_table(pc_device_table_map, device)->DestroyBuffer(device, buffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2331 | } |
| 2332 | } |
| 2333 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2334 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, |
| 2335 | const VkAllocationCallbacks *pAllocator, VkBufferView *pView) { |
| 2336 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2337 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2338 | 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] | 2339 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2340 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2341 | skipCall |= parameter_validation_vkCreateBufferView(my_data->report_data, pCreateInfo, pAllocator, pView); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2342 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2343 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2344 | result = get_dispatch_table(pc_device_table_map, device)->CreateBufferView(device, pCreateInfo, pAllocator, pView); |
| 2345 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2346 | validate_result(my_data->report_data, "vkCreateBufferView", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2347 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2348 | |
| 2349 | return result; |
| 2350 | } |
| 2351 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2352 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2353 | vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2354 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2355 | 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] | 2356 | assert(my_data != NULL); |
| 2357 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2358 | skipCall |= parameter_validation_vkDestroyBufferView(my_data->report_data, bufferView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2359 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2360 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2361 | get_dispatch_table(pc_device_table_map, device)->DestroyBufferView(device, bufferView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2362 | } |
| 2363 | } |
| 2364 | |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2365 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, |
| 2366 | const VkAllocationCallbacks *pAllocator, VkImage *pImage) { |
| 2367 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 2368 | bool skip_call = false; |
| 2369 | 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] | 2370 | assert(device_data != nullptr); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2371 | debug_report_data *report_data = device_data->report_data; |
| 2372 | |
| 2373 | skip_call |= parameter_validation_vkCreateImage(report_data, pCreateInfo, pAllocator, pImage); |
| 2374 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2375 | if (pCreateInfo != nullptr) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2376 | // 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] | 2377 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2378 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 2379 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
| 2380 | skip_call |= |
| 2381 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2382 | INVALID_USAGE, LayerName, "vkCreateImage: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2383 | "pCreateInfo->queueFamilyIndexCount must be greater than 1"); |
| 2384 | } |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2385 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2386 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 2387 | // queueFamilyIndexCount uint32_t values |
| 2388 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
| 2389 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2390 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 2391 | "vkCreateImage: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2392 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
| 2393 | "pCreateInfo->queueFamilyIndexCount uint32_t values"); |
| 2394 | } |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2395 | |
| 2396 | skip_call |= validate_queue_family_indices(device_data, "vkCreateImage", "pCreateInfo->pQueueFamilyIndices", |
| 2397 | pCreateInfo->queueFamilyIndexCount, pCreateInfo->pQueueFamilyIndices); |
| 2398 | } |
| 2399 | |
| 2400 | // width, height, and depth members of extent must be greater than 0 |
| 2401 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.width", pCreateInfo->extent.width, |
| 2402 | 0u); |
| 2403 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.height", pCreateInfo->extent.height, |
| 2404 | 0u); |
| 2405 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.depth", pCreateInfo->extent.depth, |
| 2406 | 0u); |
| 2407 | |
| 2408 | // mipLevels must be greater than 0 |
| 2409 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->mipLevels", pCreateInfo->mipLevels, |
| 2410 | 0u); |
| 2411 | |
| 2412 | // arrayLayers must be greater than 0 |
| 2413 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->arrayLayers", pCreateInfo->arrayLayers, |
| 2414 | 0u); |
| 2415 | |
| 2416 | // If imageType is VK_IMAGE_TYPE_1D, both extent.height and extent.depth must be 1 |
| 2417 | if ((pCreateInfo->imageType == VK_IMAGE_TYPE_1D) && (pCreateInfo->extent.height != 1) && (pCreateInfo->extent.depth != 1)) { |
| 2418 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2419 | LayerName, "vkCreateImage: if pCreateInfo->imageType is VK_IMAGE_TYPE_1D, both " |
| 2420 | "pCreateInfo->extent.height and pCreateInfo->extent.depth must be 1"); |
| 2421 | } |
| 2422 | |
| 2423 | if (pCreateInfo->imageType == VK_IMAGE_TYPE_2D) { |
| 2424 | // If imageType is VK_IMAGE_TYPE_2D and flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, extent.width and |
| 2425 | // extent.height must be equal |
| 2426 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) && |
| 2427 | (pCreateInfo->extent.width != pCreateInfo->extent.height)) { |
| 2428 | skip_call |= |
| 2429 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2430 | LayerName, "vkCreateImage: if pCreateInfo->imageType is VK_IMAGE_TYPE_2D and " |
| 2431 | "pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, " |
| 2432 | "pCreateInfo->extent.width and pCreateInfo->extent.height must be equal"); |
| 2433 | } |
| 2434 | |
| 2435 | if (pCreateInfo->extent.depth != 1) { |
| 2436 | skip_call |= |
| 2437 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2438 | LayerName, |
| 2439 | "vkCreateImage: if pCreateInfo->imageType is VK_IMAGE_TYPE_2D, pCreateInfo->extent.depth must be 1"); |
| 2440 | } |
| 2441 | } |
| 2442 | |
| 2443 | // mipLevels must be less than or equal to floor(log2(max(extent.width,extent.height,extent.depth)))+1 |
| 2444 | uint32_t maxDim = std::max(std::max(pCreateInfo->extent.width, pCreateInfo->extent.height), pCreateInfo->extent.depth); |
| 2445 | if (pCreateInfo->mipLevels > (floor(log2(maxDim)) + 1)) { |
| 2446 | skip_call |= log_msg( |
| 2447 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 2448 | "vkCreateImage: pCreateInfo->mipLevels must be less than or equal to " |
| 2449 | "floor(log2(max(pCreateInfo->extent.width, pCreateInfo->extent.height, pCreateInfo->extent.depth)))+1"); |
| 2450 | } |
| 2451 | |
| 2452 | // If flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, it must also contain |
| 2453 | // VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
| 2454 | if (((pCreateInfo->flags & (VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT)) != 0) && |
| 2455 | ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) != VK_IMAGE_CREATE_SPARSE_BINDING_BIT)) { |
| 2456 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2457 | LayerName, |
| 2458 | "vkCreateImage: pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or " |
| 2459 | "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] | 2460 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2461 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2462 | |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2463 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2464 | result = get_dispatch_table(pc_device_table_map, device)->CreateImage(device, pCreateInfo, pAllocator, pImage); |
| 2465 | |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2466 | validate_result(report_data, "vkCreateImage", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2467 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2468 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 2469 | return result; |
| 2470 | } |
| 2471 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2472 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2473 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2474 | 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] | 2475 | assert(my_data != NULL); |
| 2476 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2477 | skipCall |= parameter_validation_vkDestroyImage(my_data->report_data, image, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2478 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2479 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2480 | get_dispatch_table(pc_device_table_map, device)->DestroyImage(device, image, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2481 | } |
| 2482 | } |
| 2483 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2484 | bool PreGetImageSubresourceLayout(VkDevice device, const VkImageSubresource *pSubresource) { |
| 2485 | if (pSubresource != nullptr) { |
| 2486 | if ((pSubresource->aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 2487 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 2488 | log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2489 | UNRECOGNIZED_VALUE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2490 | "vkGetImageSubresourceLayout parameter, VkImageAspect pSubresource->aspectMask, is an unrecognized enumerator"); |
| 2491 | return false; |
| 2492 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2493 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2494 | |
| 2495 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2496 | } |
| 2497 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2498 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 2499 | vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, VkSubresourceLayout *pLayout) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2500 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2501 | 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] | 2502 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2503 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2504 | skipCall |= parameter_validation_vkGetImageSubresourceLayout(my_data->report_data, image, pSubresource, pLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2505 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2506 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2507 | PreGetImageSubresourceLayout(device, pSubresource); |
| 2508 | |
| 2509 | 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] | 2510 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2511 | } |
| 2512 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2513 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, |
| 2514 | const VkAllocationCallbacks *pAllocator, VkImageView *pView) { |
| 2515 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2516 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2517 | 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] | 2518 | assert(my_data != NULL); |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2519 | debug_report_data *report_data = my_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2520 | |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2521 | skip_call |= parameter_validation_vkCreateImageView(report_data, pCreateInfo, pAllocator, pView); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2522 | |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2523 | if (pCreateInfo != nullptr) { |
| 2524 | if ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D) || (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_2D)) { |
| 2525 | if (pCreateInfo->subresourceRange.layerCount != 1) { |
| 2526 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2527 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_%dD, " |
| 2528 | "pCreateInfo->subresourceRange.layerCount must be 1", |
| 2529 | ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D) ? 1 : 2)); |
| 2530 | } |
| 2531 | } else if ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY) || |
| 2532 | (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY)) { |
| 2533 | if (pCreateInfo->subresourceRange.layerCount < 1) { |
| 2534 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2535 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_%dD_ARRAY, " |
| 2536 | "pCreateInfo->subresourceRange.layerCount must be >= 1", |
| 2537 | ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY) ? 1 : 2)); |
| 2538 | } |
| 2539 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE) { |
| 2540 | if (pCreateInfo->subresourceRange.layerCount != 6) { |
| 2541 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2542 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_CUBE, " |
| 2543 | "pCreateInfo->subresourceRange.layerCount must be 6"); |
| 2544 | } |
| 2545 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY) { |
| 2546 | if ((pCreateInfo->subresourceRange.layerCount == 0) || ((pCreateInfo->subresourceRange.layerCount % 6) != 0)) { |
| 2547 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2548 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_CUBE_ARRAY, " |
| 2549 | "pCreateInfo->subresourceRange.layerCount must be a multiple of 6"); |
| 2550 | } |
| 2551 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_3D) { |
| 2552 | if (pCreateInfo->subresourceRange.baseArrayLayer != 0) { |
| 2553 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2554 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_3D, " |
| 2555 | "pCreateInfo->subresourceRange.baseArrayLayer must be 0"); |
| 2556 | } |
| 2557 | |
| 2558 | if (pCreateInfo->subresourceRange.layerCount != 1) { |
| 2559 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2560 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_3D, " |
| 2561 | "pCreateInfo->subresourceRange.layerCount must be 1"); |
| 2562 | } |
| 2563 | } |
| 2564 | } |
| 2565 | |
| 2566 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2567 | result = get_dispatch_table(pc_device_table_map, device)->CreateImageView(device, pCreateInfo, pAllocator, pView); |
| 2568 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2569 | validate_result(my_data->report_data, "vkCreateImageView", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2570 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2571 | |
| 2572 | return result; |
| 2573 | } |
| 2574 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2575 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2576 | vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2577 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2578 | 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] | 2579 | assert(my_data != NULL); |
| 2580 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2581 | skipCall |= parameter_validation_vkDestroyImageView(my_data->report_data, imageView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2582 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2583 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2584 | get_dispatch_table(pc_device_table_map, device)->DestroyImageView(device, imageView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2585 | } |
| 2586 | } |
| 2587 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2588 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, |
| 2589 | const VkAllocationCallbacks *pAllocator, |
| 2590 | VkShaderModule *pShaderModule) { |
| 2591 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2592 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2593 | 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] | 2594 | assert(my_data != NULL); |
| 2595 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2596 | skipCall |= parameter_validation_vkCreateShaderModule(my_data->report_data, pCreateInfo, pAllocator, pShaderModule); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2597 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2598 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2599 | result = |
| 2600 | 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] | 2601 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2602 | validate_result(my_data->report_data, "vkCreateShaderModule", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2603 | } |
| 2604 | |
Michael Lentine | 03d8e57 | 2015-09-15 14:59:14 -0500 | [diff] [blame] | 2605 | return result; |
| 2606 | } |
| 2607 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2608 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2609 | vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2610 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2611 | 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] | 2612 | assert(my_data != NULL); |
| 2613 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2614 | skipCall |= parameter_validation_vkDestroyShaderModule(my_data->report_data, shaderModule, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2615 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2616 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2617 | get_dispatch_table(pc_device_table_map, device)->DestroyShaderModule(device, shaderModule, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2618 | } |
| 2619 | } |
| 2620 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2621 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, |
| 2622 | const VkAllocationCallbacks *pAllocator, |
| 2623 | VkPipelineCache *pPipelineCache) { |
| 2624 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2625 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2626 | 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] | 2627 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2628 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2629 | skipCall |= parameter_validation_vkCreatePipelineCache(my_data->report_data, pCreateInfo, pAllocator, pPipelineCache); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2630 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2631 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2632 | result = |
| 2633 | 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] | 2634 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2635 | validate_result(my_data->report_data, "vkCreatePipelineCache", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2636 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2637 | |
| 2638 | return result; |
| 2639 | } |
| 2640 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2641 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2642 | vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2643 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2644 | 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] | 2645 | assert(my_data != NULL); |
| 2646 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2647 | skipCall |= parameter_validation_vkDestroyPipelineCache(my_data->report_data, pipelineCache, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2648 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2649 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2650 | get_dispatch_table(pc_device_table_map, device)->DestroyPipelineCache(device, pipelineCache, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2651 | } |
| 2652 | } |
| 2653 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2654 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 2655 | vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, void *pData) { |
| 2656 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2657 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2658 | 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] | 2659 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2660 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2661 | skipCall |= parameter_validation_vkGetPipelineCacheData(my_data->report_data, pipelineCache, pDataSize, pData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2662 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2663 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2664 | result = get_dispatch_table(pc_device_table_map, device)->GetPipelineCacheData(device, pipelineCache, pDataSize, pData); |
| 2665 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2666 | validate_result(my_data->report_data, "vkGetPipelineCacheData", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2667 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2668 | |
| 2669 | return result; |
| 2670 | } |
| 2671 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2672 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 2673 | vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache *pSrcCaches) { |
| 2674 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2675 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2676 | 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] | 2677 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2678 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2679 | skipCall |= parameter_validation_vkMergePipelineCaches(my_data->report_data, dstCache, srcCacheCount, pSrcCaches); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2680 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2681 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2682 | result = get_dispatch_table(pc_device_table_map, device)->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches); |
| 2683 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2684 | validate_result(my_data->report_data, "vkMergePipelineCaches", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2685 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2686 | |
| 2687 | return result; |
| 2688 | } |
| 2689 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2690 | bool PreCreateGraphicsPipelines(VkDevice device, const VkGraphicsPipelineCreateInfo *pCreateInfos) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 2691 | layer_data *data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2692 | |
| 2693 | // TODO: Handle count |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2694 | if (pCreateInfos != nullptr) { |
| 2695 | if (pCreateInfos->flags | VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
| 2696 | if (pCreateInfos->basePipelineIndex != -1) { |
| 2697 | if (pCreateInfos->basePipelineHandle != VK_NULL_HANDLE) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 2698 | log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2699 | INVALID_USAGE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2700 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineHandle, must be VK_NULL_HANDLE if " |
| 2701 | "pCreateInfos->flags " |
| 2702 | "contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and pCreateInfos->basePipelineIndex is not -1"); |
| 2703 | return false; |
| 2704 | } |
| 2705 | } |
| 2706 | |
| 2707 | if (pCreateInfos->basePipelineHandle != VK_NULL_HANDLE) { |
| 2708 | if (pCreateInfos->basePipelineIndex != -1) { |
| 2709 | log_msg( |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 2710 | mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2711 | INVALID_USAGE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2712 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineIndex, must be -1 if pCreateInfos->flags " |
| 2713 | "contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and pCreateInfos->basePipelineHandle is not " |
| 2714 | "VK_NULL_HANDLE"); |
| 2715 | return false; |
| 2716 | } |
Jeremy Hayes | 2fdaaf2 | 2016-03-01 17:51:54 -0700 | [diff] [blame] | 2717 | } |
| 2718 | } |
| 2719 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2720 | if (pCreateInfos->pRasterizationState != nullptr) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2721 | if (pCreateInfos->pRasterizationState->cullMode & ~VK_CULL_MODE_FRONT_AND_BACK) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 2722 | log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2723 | UNRECOGNIZED_VALUE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2724 | "vkCreateGraphicsPipelines parameter, VkCullMode pCreateInfos->pRasterizationState->cullMode, is an " |
| 2725 | "unrecognized enumerator"); |
| 2726 | return false; |
| 2727 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2728 | } |
Jeremy Hayes | 2fdaaf2 | 2016-03-01 17:51:54 -0700 | [diff] [blame] | 2729 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2730 | int i = 0; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 2731 | for (size_t j = 0; j < pCreateInfos[i].stageCount; j++) { |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 2732 | validate_string(data->report_data, "vkCreateGraphicsPipelines", "pCreateInfos[i].pStages[j].pName", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2733 | pCreateInfos[i].pStages[j].pName); |
| 2734 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2735 | } |
| 2736 | |
| 2737 | return true; |
| 2738 | } |
| 2739 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2740 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 2741 | vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 2742 | const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, |
| 2743 | VkPipeline *pPipelines) { |
| 2744 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2745 | bool skip_call = false; |
| 2746 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2747 | assert(device_data != nullptr); |
| 2748 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2749 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2750 | skip_call |= parameter_validation_vkCreateGraphicsPipelines(report_data, pipelineCache, createInfoCount, pCreateInfos, |
| 2751 | pAllocator, pPipelines); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2752 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2753 | if (pCreateInfos != nullptr) { |
| 2754 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
| 2755 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2756 | if (pCreateInfos[i].pTessellationState == nullptr) { |
| 2757 | if (pCreateInfos[i].pStages != nullptr) { |
| 2758 | // If pStages includes a tessellation control shader stage and a tessellation evaluation shader stage, |
| 2759 | // pTessellationState must not be NULL |
| 2760 | bool has_control = false; |
| 2761 | bool has_eval = false; |
| 2762 | |
| 2763 | for (uint32_t stage_index = 0; stage_index < pCreateInfos[i].stageCount; ++stage_index) { |
| 2764 | if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { |
| 2765 | has_control = true; |
| 2766 | } else if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { |
| 2767 | has_eval = true; |
| 2768 | } |
| 2769 | } |
| 2770 | |
| 2771 | if (has_control && has_eval) { |
| 2772 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2773 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 2774 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pStages includes a tessellation " |
| 2775 | "control shader stage and a tessellation evaluation shader stage, " |
| 2776 | "pCreateInfos[%d].pTessellationState must not be NULL", |
| 2777 | i, i); |
| 2778 | } |
| 2779 | } |
| 2780 | } else if (pCreateInfos[i].pTessellationState->sType != VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO) { |
| 2781 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2782 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 2783 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pTessellationState->sType must be " |
| 2784 | "VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO", |
| 2785 | i); |
| 2786 | } |
| 2787 | |
| 2788 | if (pCreateInfos[i].pViewportState == nullptr) { |
| 2789 | // If the rasterizerDiscardEnable member of pRasterizationState is VK_FALSE, pViewportState must be a pointer to a |
| 2790 | // valid VkPipelineViewportStateCreateInfo structure |
| 2791 | if ((pCreateInfos[i].pRasterizationState != nullptr) && |
| 2792 | (pCreateInfos[i].pRasterizationState->rasterizerDiscardEnable == VK_FALSE)) { |
| 2793 | skip_call |= log_msg( |
| 2794 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2795 | REQUIRED_PARAMETER, LayerName, |
| 2796 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pRasterizationState->rasterizerDiscardEnable is VK_FALSE, " |
| 2797 | "pCreateInfos[%d].pViewportState must be a pointer to a valid VkPipelineViewportStateCreateInfo structure", |
| 2798 | i, i); |
| 2799 | } |
| 2800 | } else { |
| 2801 | if (pCreateInfos[i].pViewportState->sType != VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO) { |
| 2802 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2803 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 2804 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pViewportState->sType must be " |
| 2805 | "VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO", |
| 2806 | i); |
| 2807 | } |
| 2808 | |
| 2809 | if (pCreateInfos[i].pDynamicState != nullptr) { |
| 2810 | bool has_dynamic_viewport = false; |
| 2811 | bool has_dynamic_scissor = false; |
| 2812 | |
| 2813 | for (uint32_t state_index = 0; state_index < pCreateInfos[i].pDynamicState->dynamicStateCount; ++state_index) { |
| 2814 | if (pCreateInfos[i].pDynamicState->pDynamicStates[state_index] == VK_DYNAMIC_STATE_VIEWPORT) { |
| 2815 | has_dynamic_viewport = true; |
| 2816 | } else if (pCreateInfos[i].pDynamicState->pDynamicStates[state_index] == VK_DYNAMIC_STATE_SCISSOR) { |
| 2817 | has_dynamic_scissor = true; |
| 2818 | } |
| 2819 | } |
| 2820 | |
| 2821 | // viewportCount must be greater than 0 |
| 2822 | // TODO: viewportCount must be 1 when multiple_viewport feature is not enabled |
| 2823 | if (pCreateInfos[i].pViewportState->viewportCount == 0) { |
| 2824 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2825 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 2826 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates " |
| 2827 | "contains VK_DYNAMIC_STATE_VIEWPORT, pCreateInfos[%d].pViewportState->viewportCount " |
| 2828 | "must be greater than 0", |
| 2829 | i, i); |
| 2830 | } |
| 2831 | |
| 2832 | // If no element of the pDynamicStates member of pDynamicState is VK_DYNAMIC_STATE_VIEWPORT, the pViewports |
| 2833 | // member of pViewportState must be a pointer to an array of pViewportState->viewportCount VkViewport structures |
| 2834 | if (!has_dynamic_viewport && (pCreateInfos[i].pViewportState->pViewports == nullptr)) { |
| 2835 | skip_call |= |
| 2836 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2837 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 2838 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates contains " |
| 2839 | "VK_DYNAMIC_STATE_VIEWPORT, pCreateInfos[%d].pViewportState->pViewports must not be NULL", |
| 2840 | i, i); |
| 2841 | } |
| 2842 | |
| 2843 | // scissorCount must be greater than 0 |
| 2844 | // TODO: scissorCount must be 1 when multiple_viewport feature is not enabled |
| 2845 | if (pCreateInfos[i].pViewportState->scissorCount == 0) { |
| 2846 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2847 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 2848 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates " |
| 2849 | "contains VK_DYNAMIC_STATE_SCISSOR, pCreateInfos[%d].pViewportState->scissorCount " |
| 2850 | "must be greater than 0", |
| 2851 | i, i); |
| 2852 | } |
| 2853 | |
| 2854 | // If no element of the pDynamicStates member of pDynamicState is VK_DYNAMIC_STATE_SCISSOR, the pScissors member |
| 2855 | // of pViewportState must be a pointer to an array of pViewportState->scissorCount VkRect2D structures |
| 2856 | if (!has_dynamic_scissor && (pCreateInfos[i].pViewportState->pScissors == nullptr)) { |
| 2857 | skip_call |= |
| 2858 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2859 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 2860 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates contains " |
| 2861 | "VK_DYNAMIC_STATE_SCISSOR, pCreateInfos[%d].pViewportState->pScissors must not be NULL", |
| 2862 | i, i); |
| 2863 | } |
| 2864 | } |
| 2865 | } |
| 2866 | |
| 2867 | if (pCreateInfos[i].pMultisampleState == nullptr) { |
| 2868 | // If the rasterizerDiscardEnable member of pRasterizationState is VK_FALSE, pMultisampleState must be a pointer to |
| 2869 | // a valid VkPipelineMultisampleStateCreateInfo structure |
| 2870 | if ((pCreateInfos[i].pRasterizationState != nullptr) && |
| 2871 | pCreateInfos[i].pRasterizationState->rasterizerDiscardEnable == VK_FALSE) { |
| 2872 | skip_call |= |
| 2873 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2874 | REQUIRED_PARAMETER, LayerName, "vkCreateGraphicsPipelines: if " |
| 2875 | "pCreateInfos[%d].pRasterizationState->rasterizerDiscardEnable is " |
| 2876 | "VK_FALSE, pCreateInfos[%d].pMultisampleState must not be NULL", |
| 2877 | i, i); |
| 2878 | } |
| 2879 | } else if (pCreateInfos[i].pMultisampleState->sType != VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO) { |
| 2880 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2881 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 2882 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pMultisampleState->sType must be " |
| 2883 | "VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO", |
| 2884 | i); |
| 2885 | } |
| 2886 | |
| 2887 | // TODO: Conditional NULL check based on rasterizerDiscardEnable and subpass |
| 2888 | if ((pCreateInfos[i].pDepthStencilState != nullptr) && |
| 2889 | (pCreateInfos[i].pDepthStencilState->sType != VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO)) { |
| 2890 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2891 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 2892 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pDepthStencilState->sType must be " |
| 2893 | "VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO", |
| 2894 | i); |
| 2895 | } |
| 2896 | |
| 2897 | // TODO: Conditional NULL check based on rasterizerDiscardEnable and subpass |
| 2898 | if (pCreateInfos[i].pColorBlendState != nullptr) { |
| 2899 | if (pCreateInfos[i].pColorBlendState->sType != VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO) { |
| 2900 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2901 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 2902 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pColorBlendState->sType must be " |
| 2903 | "VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO", |
| 2904 | i); |
| 2905 | } |
| 2906 | |
| 2907 | // If logicOpEnable is VK_TRUE, logicOp must be a valid VkLogicOp value |
| 2908 | if (pCreateInfos[i].pColorBlendState->logicOpEnable == VK_TRUE) { |
| 2909 | skip_call |= validate_ranged_enum( |
| 2910 | report_data, "vkCreateGraphicsPipelines", "pCreateInfos[i].pColorBlendState->logicOp", "VkLogicOp", |
| 2911 | VK_LOGIC_OP_BEGIN_RANGE, VK_LOGIC_OP_END_RANGE, pCreateInfos[i].pColorBlendState->logicOp); |
| 2912 | } |
| 2913 | } |
| 2914 | } |
| 2915 | } |
| 2916 | |
| 2917 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2918 | PreCreateGraphicsPipelines(device, pCreateInfos); |
| 2919 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2920 | result = get_dispatch_table(pc_device_table_map, device) |
| 2921 | ->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2922 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2923 | validate_result(report_data, "vkCreateGraphicsPipelines", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2924 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2925 | |
| 2926 | return result; |
| 2927 | } |
| 2928 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2929 | bool PreCreateComputePipelines(VkDevice device, const VkComputePipelineCreateInfo *pCreateInfos) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 2930 | layer_data *data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2931 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2932 | if (pCreateInfos != nullptr) { |
| 2933 | // TODO: Handle count! |
| 2934 | int i = 0; |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 2935 | validate_string(data->report_data, "vkCreateComputePipelines", "pCreateInfos[i].stage.pName", pCreateInfos[i].stage.pName); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2936 | } |
| 2937 | |
| 2938 | return true; |
| 2939 | } |
| 2940 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2941 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 2942 | vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 2943 | const VkComputePipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, |
| 2944 | VkPipeline *pPipelines) { |
| 2945 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2946 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2947 | 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] | 2948 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2949 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2950 | skipCall |= parameter_validation_vkCreateComputePipelines(my_data->report_data, pipelineCache, createInfoCount, pCreateInfos, pAllocator, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2951 | pPipelines); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2952 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2953 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2954 | PreCreateComputePipelines(device, pCreateInfos); |
| 2955 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2956 | result = get_dispatch_table(pc_device_table_map, device) |
| 2957 | ->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2958 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2959 | validate_result(my_data->report_data, "vkCreateComputePipelines", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2960 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2961 | |
| 2962 | return result; |
| 2963 | } |
| 2964 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2965 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2966 | vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2967 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2968 | 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] | 2969 | assert(my_data != NULL); |
| 2970 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2971 | skipCall |= parameter_validation_vkDestroyPipeline(my_data->report_data, pipeline, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2972 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2973 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2974 | get_dispatch_table(pc_device_table_map, device)->DestroyPipeline(device, pipeline, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2975 | } |
| 2976 | } |
| 2977 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2978 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 2979 | vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 2980 | VkPipelineLayout *pPipelineLayout) { |
| 2981 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2982 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2983 | 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] | 2984 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2985 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 2986 | skipCall |= parameter_validation_vkCreatePipelineLayout(my_data->report_data, pCreateInfo, pAllocator, pPipelineLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2987 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 2988 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2989 | result = |
| 2990 | 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] | 2991 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2992 | validate_result(my_data->report_data, "vkCreatePipelineLayout", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2993 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2994 | |
| 2995 | return result; |
| 2996 | } |
| 2997 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2998 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2999 | vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3000 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3001 | 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] | 3002 | assert(my_data != NULL); |
| 3003 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3004 | skipCall |= parameter_validation_vkDestroyPipelineLayout(my_data->report_data, pipelineLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3005 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3006 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3007 | get_dispatch_table(pc_device_table_map, device)->DestroyPipelineLayout(device, pipelineLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3008 | } |
| 3009 | } |
| 3010 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3011 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, |
| 3012 | const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) { |
| 3013 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3014 | bool skip_call = false; |
| 3015 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3016 | assert(device_data != NULL); |
| 3017 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3018 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3019 | skip_call |= parameter_validation_vkCreateSampler(report_data, pCreateInfo, pAllocator, pSampler); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3020 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3021 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3022 | if (pCreateInfo != nullptr) { |
| 3023 | // If compareEnable is VK_TRUE, compareOp must be a valid VkCompareOp value |
| 3024 | if (pCreateInfo->compareEnable == VK_TRUE) { |
| 3025 | skip_call |= validate_ranged_enum(report_data, "vkCreateSampler", "pCreateInfo->compareOp", "VkCompareOp", |
| 3026 | VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, pCreateInfo->compareOp); |
| 3027 | } |
| 3028 | |
| 3029 | // If any of addressModeU, addressModeV or addressModeW are VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, borderColor must be a |
| 3030 | // valid VkBorderColor value |
| 3031 | if ((pCreateInfo->addressModeU == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 3032 | (pCreateInfo->addressModeV == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 3033 | (pCreateInfo->addressModeW == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)) { |
| 3034 | skip_call |= validate_ranged_enum(report_data, "vkCreateSampler", "pCreateInfo->borderColor", "VkBorderColor", |
| 3035 | VK_BORDER_COLOR_BEGIN_RANGE, VK_BORDER_COLOR_END_RANGE, pCreateInfo->borderColor); |
| 3036 | } |
| 3037 | } |
| 3038 | |
| 3039 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3040 | result = get_dispatch_table(pc_device_table_map, device)->CreateSampler(device, pCreateInfo, pAllocator, pSampler); |
| 3041 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3042 | validate_result(report_data, "vkCreateSampler", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3043 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3044 | |
| 3045 | return result; |
| 3046 | } |
| 3047 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3048 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3049 | vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3050 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3051 | 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] | 3052 | assert(my_data != NULL); |
| 3053 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3054 | skipCall |= parameter_validation_vkDestroySampler(my_data->report_data, sampler, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3055 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3056 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3057 | get_dispatch_table(pc_device_table_map, device)->DestroySampler(device, sampler, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3058 | } |
| 3059 | } |
| 3060 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3061 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 3062 | vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
| 3063 | const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout) { |
| 3064 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3065 | bool skip_call = false; |
| 3066 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3067 | assert(device_data != nullptr); |
| 3068 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3069 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3070 | skip_call |= parameter_validation_vkCreateDescriptorSetLayout(report_data, pCreateInfo, pAllocator, pSetLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3071 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3072 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3073 | if ((pCreateInfo != nullptr) && (pCreateInfo->pBindings != nullptr)) { |
| 3074 | for (uint32_t i = 0; i < pCreateInfo->bindingCount; ++i) { |
| 3075 | if (pCreateInfo->pBindings[i].descriptorCount != 0) { |
| 3076 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER or VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, and descriptorCount |
| 3077 | // is not 0 and pImmutableSamplers is not NULL, pImmutableSamplers must be a pointer to an array of descriptorCount |
| 3078 | // valid VkSampler handles |
| 3079 | if (((pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 3080 | (pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)) && |
| 3081 | (pCreateInfo->pBindings[i].pImmutableSamplers != nullptr)) { |
| 3082 | for (uint32_t descriptor_index = 0; descriptor_index < pCreateInfo->pBindings[i].descriptorCount; |
| 3083 | ++descriptor_index) { |
| 3084 | if (pCreateInfo->pBindings[i].pImmutableSamplers[descriptor_index] == VK_NULL_HANDLE) { |
| 3085 | skip_call |= |
| 3086 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3087 | __LINE__, REQUIRED_PARAMETER, LayerName, "vkCreateDescriptorSetLayout: required parameter " |
| 3088 | "pCreateInfo->pBindings[%d].pImmutableSamplers[%d]" |
| 3089 | " specified as VK_NULL_HANDLE", |
| 3090 | i, descriptor_index); |
| 3091 | } |
| 3092 | } |
| 3093 | } |
| 3094 | |
| 3095 | // If descriptorCount is not 0, stageFlags must be a valid combination of VkShaderStageFlagBits values |
| 3096 | if ((pCreateInfo->pBindings[i].stageFlags != 0) && |
| 3097 | ((pCreateInfo->pBindings[i].stageFlags & (~AllVkShaderStageFlagBits)) != 0)) { |
| 3098 | skip_call |= |
| 3099 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3100 | UNRECOGNIZED_VALUE, LayerName, |
| 3101 | "vkCreateDescriptorSetLayout: if pCreateInfo->pBindings[%d].descriptorCount is not 0, " |
| 3102 | "pCreateInfo->pBindings[%d].stageFlags must be a valid combination of VkShaderStageFlagBits values", |
| 3103 | i, i); |
| 3104 | } |
| 3105 | } |
| 3106 | } |
| 3107 | } |
| 3108 | |
| 3109 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3110 | result = |
| 3111 | 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] | 3112 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3113 | validate_result(report_data, "vkCreateDescriptorSetLayout", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3114 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3115 | |
| 3116 | return result; |
| 3117 | } |
| 3118 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3119 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3120 | vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3121 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3122 | 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] | 3123 | assert(my_data != NULL); |
| 3124 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3125 | skipCall |= parameter_validation_vkDestroyDescriptorSetLayout(my_data->report_data, descriptorSetLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3126 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3127 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3128 | get_dispatch_table(pc_device_table_map, device)->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3129 | } |
| 3130 | } |
| 3131 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3132 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 3133 | vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 3134 | VkDescriptorPool *pDescriptorPool) { |
| 3135 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3136 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3137 | 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] | 3138 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3139 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3140 | skipCall |= parameter_validation_vkCreateDescriptorPool(my_data->report_data, pCreateInfo, pAllocator, pDescriptorPool); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3141 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3142 | /* TODOVV: How do we validate maxSets? Probably belongs in the limits layer? */ |
| 3143 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3144 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3145 | result = |
| 3146 | 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] | 3147 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3148 | validate_result(my_data->report_data, "vkCreateDescriptorPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3149 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3150 | |
| 3151 | return result; |
| 3152 | } |
| 3153 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3154 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3155 | vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3156 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3157 | 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] | 3158 | assert(my_data != NULL); |
| 3159 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3160 | skipCall |= parameter_validation_vkDestroyDescriptorPool(my_data->report_data, descriptorPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3161 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3162 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3163 | get_dispatch_table(pc_device_table_map, device)->DestroyDescriptorPool(device, descriptorPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3164 | } |
| 3165 | } |
| 3166 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3167 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 3168 | vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3169 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 3170 | bool skipCall = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3171 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3172 | assert(my_data != NULL); |
| 3173 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3174 | skipCall |= parameter_validation_vkResetDescriptorPool(my_data->report_data, descriptorPool, flags); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3175 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3176 | if (!skipCall) { |
| 3177 | result = get_dispatch_table(pc_device_table_map, device)->ResetDescriptorPool(device, descriptorPool, flags); |
| 3178 | |
| 3179 | validate_result(my_data->report_data, "vkResetDescriptorPool", result); |
| 3180 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3181 | |
| 3182 | return result; |
| 3183 | } |
| 3184 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3185 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 3186 | vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets) { |
| 3187 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3188 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3189 | 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] | 3190 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3191 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3192 | skipCall |= parameter_validation_vkAllocateDescriptorSets(my_data->report_data, pAllocateInfo, pDescriptorSets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3193 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3194 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3195 | result = get_dispatch_table(pc_device_table_map, device)->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets); |
| 3196 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3197 | validate_result(my_data->report_data, "vkAllocateDescriptorSets", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3198 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3199 | |
| 3200 | return result; |
| 3201 | } |
| 3202 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3203 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, |
| 3204 | uint32_t descriptorSetCount, |
| 3205 | const VkDescriptorSet *pDescriptorSets) { |
| 3206 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3207 | bool skip_call = false; |
| 3208 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3209 | assert(device_data != nullptr); |
| 3210 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3211 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3212 | skip_call |= parameter_validation_vkFreeDescriptorSets(report_data, descriptorPool, descriptorSetCount, pDescriptorSets); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3213 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3214 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3215 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 3216 | // validate_array() |
| 3217 | skip_call |= validate_array(report_data, "vkFreeDescriptorSets", "descriptorSetCount", "pDescriptorSets", descriptorSetCount, |
| 3218 | pDescriptorSets, true, true); |
| 3219 | |
| 3220 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3221 | result = get_dispatch_table(pc_device_table_map, device) |
| 3222 | ->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3223 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3224 | validate_result(report_data, "vkFreeDescriptorSets", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3225 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3226 | |
| 3227 | return result; |
| 3228 | } |
| 3229 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3230 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3231 | vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites, |
| 3232 | uint32_t descriptorCopyCount, const VkCopyDescriptorSet *pDescriptorCopies) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3233 | bool skip_call = false; |
| 3234 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3235 | assert(device_data != NULL); |
| 3236 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3237 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3238 | skip_call |= parameter_validation_vkUpdateDescriptorSets(report_data, descriptorWriteCount, pDescriptorWrites, |
| 3239 | descriptorCopyCount, pDescriptorCopies); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3240 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3241 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3242 | if (pDescriptorWrites != NULL) { |
| 3243 | for (uint32_t i = 0; i < descriptorWriteCount; ++i) { |
| 3244 | // descriptorCount must be greater than 0 |
| 3245 | if (pDescriptorWrites[i].descriptorCount == 0) { |
| 3246 | skip_call |= |
| 3247 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3248 | REQUIRED_PARAMETER, LayerName, |
| 3249 | "vkUpdateDescriptorSets: parameter pDescriptorWrites[%d].descriptorCount must be greater than 0", i); |
| 3250 | } |
| 3251 | |
| 3252 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 3253 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || |
| 3254 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || |
| 3255 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || |
| 3256 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)) { |
| 3257 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, |
| 3258 | // VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, |
| 3259 | // pImageInfo must be a pointer to an array of descriptorCount valid VkDescriptorImageInfo structures |
| 3260 | if (pDescriptorWrites[i].pImageInfo == nullptr) { |
| 3261 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3262 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 3263 | "vkUpdateDescriptorSets: if pDescriptorWrites[%d].descriptorType is " |
| 3264 | "VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, " |
| 3265 | "VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or " |
| 3266 | "VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, pDescriptorWrites[%d].pImageInfo must not be NULL", |
| 3267 | i, i); |
| 3268 | } else if (pDescriptorWrites[i].descriptorType != VK_DESCRIPTOR_TYPE_SAMPLER) { |
| 3269 | // If descriptorType is VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, |
| 3270 | // VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, the imageView and imageLayout |
| 3271 | // members of any given element of pImageInfo must be a valid VkImageView and VkImageLayout, respectively |
| 3272 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3273 | ++descriptor_index) { |
| 3274 | skip_call |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
| 3275 | "pDescriptorWrites[i].pImageInfo[i].imageView", |
| 3276 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageView); |
| 3277 | skip_call |= validate_ranged_enum(report_data, "vkUpdateDescriptorSets", |
| 3278 | "pDescriptorWrites[i].pImageInfo[i].imageLayout", "VkImageLayout", |
| 3279 | VK_IMAGE_LAYOUT_BEGIN_RANGE, VK_IMAGE_LAYOUT_END_RANGE, |
| 3280 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageLayout); |
| 3281 | } |
| 3282 | } |
| 3283 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 3284 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 3285 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || |
| 3286 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 3287 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 3288 | // VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, pBufferInfo must be a |
| 3289 | // pointer to an array of descriptorCount valid VkDescriptorBufferInfo structures |
| 3290 | if (pDescriptorWrites[i].pBufferInfo == nullptr) { |
| 3291 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3292 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 3293 | "vkUpdateDescriptorSets: if pDescriptorWrites[%d].descriptorType is " |
| 3294 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, " |
| 3295 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, " |
| 3296 | "pDescriptorWrites[%d].pBufferInfo must not be NULL", |
| 3297 | i, i); |
| 3298 | } |
| 3299 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || |
| 3300 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { |
| 3301 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, |
| 3302 | // pTexelBufferView must be a pointer to an array of descriptorCount valid VkBufferView handles |
| 3303 | if (pDescriptorWrites[i].pTexelBufferView == nullptr) { |
| 3304 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3305 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 3306 | "vkUpdateDescriptorSets: if pDescriptorWrites[%d].descriptorType is " |
| 3307 | "VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, " |
| 3308 | "pDescriptorWrites[%d].pTexelBufferView must not be NULL", |
| 3309 | i, i); |
| 3310 | } else { |
| 3311 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3312 | ++descriptor_index) { |
| 3313 | skip_call |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
| 3314 | "pDescriptorWrites[i].pTexelBufferView[i]", |
| 3315 | pDescriptorWrites[i].pTexelBufferView[descriptor_index]); |
| 3316 | } |
| 3317 | } |
| 3318 | } |
| 3319 | } |
| 3320 | } |
| 3321 | |
| 3322 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3323 | get_dispatch_table(pc_device_table_map, device) |
| 3324 | ->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3325 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3326 | } |
| 3327 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3328 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
| 3329 | const VkAllocationCallbacks *pAllocator, |
| 3330 | VkFramebuffer *pFramebuffer) { |
| 3331 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3332 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3333 | 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] | 3334 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3335 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3336 | skipCall |= parameter_validation_vkCreateFramebuffer(my_data->report_data, pCreateInfo, pAllocator, pFramebuffer); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3337 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3338 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3339 | result = get_dispatch_table(pc_device_table_map, device)->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer); |
| 3340 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3341 | validate_result(my_data->report_data, "vkCreateFramebuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3342 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3343 | |
| 3344 | return result; |
| 3345 | } |
| 3346 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3347 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3348 | vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3349 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3350 | 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] | 3351 | assert(my_data != NULL); |
| 3352 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3353 | skipCall |= parameter_validation_vkDestroyFramebuffer(my_data->report_data, framebuffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3354 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3355 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3356 | get_dispatch_table(pc_device_table_map, device)->DestroyFramebuffer(device, framebuffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3357 | } |
| 3358 | } |
| 3359 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3360 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
| 3361 | const VkAllocationCallbacks *pAllocator, |
| 3362 | VkRenderPass *pRenderPass) { |
| 3363 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3364 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3365 | 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] | 3366 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3367 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3368 | skipCall |= parameter_validation_vkCreateRenderPass(my_data->report_data, pCreateInfo, pAllocator, pRenderPass); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3369 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3370 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3371 | result = get_dispatch_table(pc_device_table_map, device)->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass); |
| 3372 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3373 | validate_result(my_data->report_data, "vkCreateRenderPass", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3374 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3375 | |
| 3376 | return result; |
| 3377 | } |
| 3378 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3379 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3380 | vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3381 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3382 | 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] | 3383 | assert(my_data != NULL); |
| 3384 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3385 | skipCall |= parameter_validation_vkDestroyRenderPass(my_data->report_data, renderPass, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3386 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3387 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3388 | get_dispatch_table(pc_device_table_map, device)->DestroyRenderPass(device, renderPass, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3389 | } |
| 3390 | } |
| 3391 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3392 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3393 | vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3394 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3395 | 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] | 3396 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3397 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3398 | skipCall |= parameter_validation_vkGetRenderAreaGranularity(my_data->report_data, renderPass, pGranularity); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3399 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3400 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3401 | get_dispatch_table(pc_device_table_map, device)->GetRenderAreaGranularity(device, renderPass, pGranularity); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3402 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3403 | } |
| 3404 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3405 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, |
| 3406 | const VkAllocationCallbacks *pAllocator, |
| 3407 | VkCommandPool *pCommandPool) { |
| 3408 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | f20f094 | 2016-03-22 10:07:26 -0600 | [diff] [blame] | 3409 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3410 | 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] | 3411 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3412 | |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 3413 | skipCall |= |
| 3414 | validate_queue_family_index(my_data, "vkCreateCommandPool", "pCreateInfo->queueFamilyIndex", pCreateInfo->queueFamilyIndex); |
Mark Lobodzinski | f20f094 | 2016-03-22 10:07:26 -0600 | [diff] [blame] | 3415 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3416 | skipCall |= parameter_validation_vkCreateCommandPool(my_data->report_data, pCreateInfo, pAllocator, pCommandPool); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3417 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3418 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3419 | result = get_dispatch_table(pc_device_table_map, device)->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); |
| 3420 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3421 | validate_result(my_data->report_data, "vkCreateCommandPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3422 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3423 | |
| 3424 | return result; |
| 3425 | } |
| 3426 | |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3427 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3428 | vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3429 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3430 | 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] | 3431 | assert(my_data != NULL); |
| 3432 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3433 | skipCall |= parameter_validation_vkDestroyCommandPool(my_data->report_data, commandPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3434 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3435 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3436 | get_dispatch_table(pc_device_table_map, device)->DestroyCommandPool(device, commandPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3437 | } |
| 3438 | } |
| 3439 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3440 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 3441 | vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3442 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 3443 | bool skipCall = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3444 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3445 | assert(my_data != NULL); |
| 3446 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3447 | skipCall |= parameter_validation_vkResetCommandPool(my_data->report_data, commandPool, flags); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3448 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3449 | if (!skipCall) { |
| 3450 | result = get_dispatch_table(pc_device_table_map, device)->ResetCommandPool(device, commandPool, flags); |
| 3451 | |
| 3452 | validate_result(my_data->report_data, "vkResetCommandPool", result); |
| 3453 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3454 | |
| 3455 | return result; |
| 3456 | } |
| 3457 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3458 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 3459 | vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers) { |
| 3460 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3461 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3462 | 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] | 3463 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3464 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3465 | skipCall |= parameter_validation_vkAllocateCommandBuffers(my_data->report_data, pAllocateInfo, pCommandBuffers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3466 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3467 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3468 | result = get_dispatch_table(pc_device_table_map, device)->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers); |
| 3469 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3470 | validate_result(my_data->report_data, "vkAllocateCommandBuffers", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3471 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3472 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3473 | return result; |
| 3474 | } |
| 3475 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3476 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, |
| 3477 | uint32_t commandBufferCount, |
| 3478 | const VkCommandBuffer *pCommandBuffers) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3479 | bool skip_call = false; |
| 3480 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3481 | assert(device_data != nullptr); |
| 3482 | debug_report_data *report_data = device_data->report_data; |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3483 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3484 | skip_call |= parameter_validation_vkFreeCommandBuffers(report_data, commandPool, commandBufferCount, pCommandBuffers); |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3485 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3486 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3487 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 3488 | // validate_array() |
| 3489 | skip_call |= validate_array(report_data, "vkFreeCommandBuffers", "commandBufferCount", "pCommandBuffers", commandBufferCount, |
| 3490 | pCommandBuffers, true, true); |
| 3491 | |
| 3492 | if (!skip_call) { |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3493 | get_dispatch_table(pc_device_table_map, device) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3494 | ->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers); |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3495 | } |
| 3496 | } |
| 3497 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3498 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 3499 | vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) { |
| 3500 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3501 | bool skip_call = false; |
| 3502 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3503 | assert(device_data != nullptr); |
| 3504 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3505 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3506 | skip_call |= parameter_validation_vkBeginCommandBuffer(report_data, pBeginInfo); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3507 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3508 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3509 | // TODO: pBeginInfo->pInheritanceInfo must not be NULL if commandBuffer is a secondary command buffer |
| 3510 | skip_call |= validate_struct_type(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo", |
| 3511 | "VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO", pBeginInfo->pInheritanceInfo, |
| 3512 | VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, false); |
| 3513 | |
| 3514 | if (pBeginInfo->pInheritanceInfo != NULL) { |
| 3515 | // TODO: This only needs to be validated when the inherited queries feature is enabled |
| 3516 | // skip_call |= validate_flags(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->queryFlags", |
| 3517 | // "VkQueryControlFlagBits", AllVkQueryControlFlagBits, pBeginInfo->pInheritanceInfo->queryFlags, false); |
| 3518 | |
| 3519 | // TODO: This must be 0 if the pipeline statistics queries feature is not enabled |
| 3520 | skip_call |= validate_flags(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->pipelineStatistics", |
| 3521 | "VkQueryPipelineStatisticFlagBits", AllVkQueryPipelineStatisticFlagBits, |
| 3522 | pBeginInfo->pInheritanceInfo->pipelineStatistics, false); |
| 3523 | } |
| 3524 | |
| 3525 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3526 | result = get_dispatch_table(pc_device_table_map, commandBuffer)->BeginCommandBuffer(commandBuffer, pBeginInfo); |
| 3527 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3528 | validate_result(report_data, "vkBeginCommandBuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3529 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3530 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3531 | return result; |
| 3532 | } |
| 3533 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3534 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer) { |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3535 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3536 | assert(my_data != NULL); |
| 3537 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 3538 | VkResult result = get_dispatch_table(pc_device_table_map, commandBuffer)->EndCommandBuffer(commandBuffer); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3539 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3540 | validate_result(my_data->report_data, "vkEndCommandBuffer", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3541 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3542 | return result; |
| 3543 | } |
| 3544 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3545 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 3546 | vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) { |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 3547 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3548 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3549 | assert(my_data != NULL); |
| 3550 | |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 3551 | bool skip_call = parameter_validation_vkResetCommandBuffer(my_data->report_data, flags); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3552 | |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 3553 | if (!skip_call) { |
| 3554 | result = get_dispatch_table(pc_device_table_map, commandBuffer)->ResetCommandBuffer(commandBuffer, flags); |
| 3555 | |
| 3556 | validate_result(my_data->report_data, "vkResetCommandBuffer", result); |
| 3557 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3558 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3559 | return result; |
| 3560 | } |
| 3561 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3562 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3563 | vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3564 | bool skipCall = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3565 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3566 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3567 | |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3568 | skipCall |= parameter_validation_vkCmdBindPipeline(my_data->report_data, pipelineBindPoint, pipeline); |
| 3569 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3570 | if (!skipCall) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3571 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline); |
| 3572 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3573 | } |
| 3574 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3575 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3576 | vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport *pViewports) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3577 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3578 | 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] | 3579 | assert(my_data != NULL); |
| 3580 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3581 | skipCall |= parameter_validation_vkCmdSetViewport(my_data->report_data, firstViewport, viewportCount, pViewports); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3582 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3583 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3584 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3585 | ->CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3586 | } |
Courtney Goeltzenleuchter | 078f817 | 2015-09-21 11:44:06 -0600 | [diff] [blame] | 3587 | } |
| 3588 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3589 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3590 | vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *pScissors) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3591 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3592 | 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] | 3593 | assert(my_data != NULL); |
| 3594 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3595 | skipCall |= parameter_validation_vkCmdSetScissor(my_data->report_data, firstScissor, scissorCount, pScissors); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3596 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3597 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3598 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors); |
| 3599 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3600 | } |
| 3601 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3602 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 3603 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetLineWidth(commandBuffer, lineWidth); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3604 | } |
| 3605 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3606 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3607 | vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) { |
| 3608 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3609 | ->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3610 | } |
| 3611 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3612 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3613 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3614 | 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] | 3615 | assert(my_data != NULL); |
| 3616 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3617 | skipCall |= parameter_validation_vkCmdSetBlendConstants(my_data->report_data, blendConstants); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3618 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3619 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3620 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetBlendConstants(commandBuffer, blendConstants); |
| 3621 | } |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 3622 | } |
| 3623 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3624 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3625 | vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 3626 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds); |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 3627 | } |
| 3628 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3629 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3630 | vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask) { |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 3631 | bool skipCall = false; |
| 3632 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3633 | assert(my_data != NULL); |
| 3634 | |
| 3635 | skipCall |= parameter_validation_vkCmdSetStencilCompareMask(my_data->report_data, faceMask, compareMask); |
| 3636 | |
| 3637 | if (!skipCall) { |
| 3638 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask); |
| 3639 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3640 | } |
| 3641 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3642 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3643 | vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) { |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 3644 | bool skipCall = false; |
| 3645 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3646 | assert(my_data != NULL); |
| 3647 | |
| 3648 | skipCall |= parameter_validation_vkCmdSetStencilWriteMask(my_data->report_data, faceMask, writeMask); |
| 3649 | |
| 3650 | if (!skipCall) { |
| 3651 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask); |
| 3652 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3653 | } |
| 3654 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3655 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3656 | vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) { |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 3657 | bool skipCall = false; |
| 3658 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3659 | assert(my_data != NULL); |
| 3660 | |
| 3661 | skipCall |= parameter_validation_vkCmdSetStencilReference(my_data->report_data, faceMask, reference); |
| 3662 | |
| 3663 | if (!skipCall) { |
| 3664 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetStencilReference(commandBuffer, faceMask, reference); |
| 3665 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3666 | } |
| 3667 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3668 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3669 | vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, |
| 3670 | uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets, |
| 3671 | uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3672 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3673 | 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] | 3674 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3675 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3676 | skipCall |= parameter_validation_vkCmdBindDescriptorSets(my_data->report_data, pipelineBindPoint, layout, firstSet, descriptorSetCount, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3677 | pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3678 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3679 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3680 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3681 | ->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, |
| 3682 | dynamicOffsetCount, pDynamicOffsets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3683 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3684 | } |
| 3685 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3686 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3687 | vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3688 | bool skipCall = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3689 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3690 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3691 | |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3692 | skipCall |= parameter_validation_vkCmdBindIndexBuffer(my_data->report_data, buffer, offset, indexType); |
| 3693 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3694 | if (!skipCall) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3695 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType); |
| 3696 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3697 | } |
| 3698 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3699 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, |
| 3700 | uint32_t bindingCount, const VkBuffer *pBuffers, |
| 3701 | const VkDeviceSize *pOffsets) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3702 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3703 | 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] | 3704 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3705 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3706 | skipCall |= parameter_validation_vkCmdBindVertexBuffers(my_data->report_data, firstBinding, bindingCount, pBuffers, pOffsets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3707 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3708 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3709 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3710 | ->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3711 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3712 | } |
| 3713 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3714 | bool PreCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, |
| 3715 | uint32_t firstInstance) { |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 3716 | if (vertexCount == 0) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 3717 | // 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] | 3718 | // this an error or leave as is. |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 3719 | log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3720 | REQUIRED_PARAMETER, "PARAMCHECK", "vkCmdDraw parameter, uint32_t vertexCount, is 0"); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 3721 | return false; |
| 3722 | } |
| 3723 | |
| 3724 | if (instanceCount == 0) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 3725 | // 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] | 3726 | // this an error or leave as is. |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 3727 | log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3728 | REQUIRED_PARAMETER, "PARAMCHECK", "vkCmdDraw parameter, uint32_t instanceCount, is 0"); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 3729 | return false; |
| 3730 | } |
| 3731 | |
| 3732 | return true; |
| 3733 | } |
| 3734 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3735 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, |
| 3736 | uint32_t firstVertex, uint32_t firstInstance) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 3737 | PreCmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 3738 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3739 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3740 | ->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3741 | } |
| 3742 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3743 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, |
| 3744 | uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, |
| 3745 | uint32_t firstInstance) { |
| 3746 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3747 | ->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3748 | } |
| 3749 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3750 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3751 | vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3752 | bool skipCall = false; |
| 3753 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3754 | assert(my_data != NULL); |
| 3755 | |
| 3756 | skipCall |= parameter_validation_vkCmdDrawIndirect(my_data->report_data, buffer, offset, count, stride); |
| 3757 | |
| 3758 | if (!skipCall) { |
| 3759 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDrawIndirect(commandBuffer, buffer, offset, count, stride); |
| 3760 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3761 | } |
| 3762 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3763 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3764 | vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3765 | bool skipCall = false; |
| 3766 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3767 | assert(my_data != NULL); |
| 3768 | |
| 3769 | skipCall |= parameter_validation_vkCmdDrawIndexedIndirect(my_data->report_data, buffer, offset, count, stride); |
| 3770 | |
| 3771 | if (!skipCall) { |
| 3772 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3773 | ->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, count, stride); |
| 3774 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3775 | } |
| 3776 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3777 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 3778 | 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] | 3779 | } |
| 3780 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3781 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3782 | vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3783 | bool skipCall = false; |
| 3784 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3785 | assert(my_data != NULL); |
| 3786 | |
| 3787 | skipCall |= parameter_validation_vkCmdDispatchIndirect(my_data->report_data, buffer, offset); |
| 3788 | |
| 3789 | if (!skipCall) { |
| 3790 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDispatchIndirect(commandBuffer, buffer, offset); |
| 3791 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3792 | } |
| 3793 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3794 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, |
| 3795 | uint32_t regionCount, const VkBufferCopy *pRegions) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3796 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3797 | 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] | 3798 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3799 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3800 | skipCall |= parameter_validation_vkCmdCopyBuffer(my_data->report_data, srcBuffer, dstBuffer, regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3801 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3802 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3803 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3804 | ->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3805 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3806 | } |
| 3807 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3808 | bool PreCmdCopyImage(VkCommandBuffer commandBuffer, const VkImageCopy *pRegions) { |
| 3809 | if (pRegions != nullptr) { |
| 3810 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 3811 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 3812 | log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3813 | UNRECOGNIZED_VALUE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3814 | "vkCmdCopyImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 3815 | return false; |
| 3816 | } |
| 3817 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 3818 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 3819 | log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3820 | UNRECOGNIZED_VALUE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3821 | "vkCmdCopyImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 3822 | return false; |
| 3823 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3824 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3825 | |
| 3826 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3827 | } |
| 3828 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3829 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3830 | vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, |
| 3831 | VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy *pRegions) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3832 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3833 | 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] | 3834 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3835 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3836 | skipCall |= |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3837 | parameter_validation_vkCmdCopyImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3838 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3839 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3840 | PreCmdCopyImage(commandBuffer, pRegions); |
| 3841 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3842 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3843 | ->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3844 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3845 | } |
| 3846 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3847 | bool PreCmdBlitImage(VkCommandBuffer commandBuffer, const VkImageBlit *pRegions) { |
| 3848 | if (pRegions != nullptr) { |
| 3849 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 3850 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 3851 | log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3852 | UNRECOGNIZED_VALUE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3853 | "vkCmdCopyImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 3854 | return false; |
| 3855 | } |
| 3856 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 3857 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 3858 | log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3859 | UNRECOGNIZED_VALUE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3860 | "vkCmdCopyImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 3861 | return false; |
| 3862 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3863 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3864 | |
| 3865 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3866 | } |
| 3867 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3868 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3869 | vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, |
| 3870 | VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3871 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3872 | 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] | 3873 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3874 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3875 | skipCall |= parameter_validation_vkCmdBlitImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3876 | pRegions, filter); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3877 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3878 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3879 | PreCmdBlitImage(commandBuffer, pRegions); |
| 3880 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3881 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3882 | ->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3883 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3884 | } |
| 3885 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3886 | bool PreCmdCopyBufferToImage(VkCommandBuffer commandBuffer, const VkBufferImageCopy *pRegions) { |
| 3887 | if (pRegions != nullptr) { |
| 3888 | if ((pRegions->imageSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 3889 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 3890 | log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3891 | UNRECOGNIZED_VALUE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3892 | "vkCmdCopyBufferToImage parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
| 3893 | "enumerator"); |
| 3894 | return false; |
| 3895 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3896 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3897 | |
| 3898 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3899 | } |
| 3900 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3901 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, |
| 3902 | VkImage dstImage, VkImageLayout dstImageLayout, |
| 3903 | uint32_t regionCount, const VkBufferImageCopy *pRegions) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3904 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3905 | 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] | 3906 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3907 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3908 | skipCall |= |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3909 | parameter_validation_vkCmdCopyBufferToImage(my_data->report_data, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3910 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3911 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3912 | PreCmdCopyBufferToImage(commandBuffer, pRegions); |
| 3913 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3914 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3915 | ->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3916 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3917 | } |
| 3918 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3919 | bool PreCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, const VkBufferImageCopy *pRegions) { |
| 3920 | if (pRegions != nullptr) { |
| 3921 | if ((pRegions->imageSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 3922 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 3923 | log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3924 | UNRECOGNIZED_VALUE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3925 | "vkCmdCopyImageToBuffer parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
| 3926 | "enumerator"); |
| 3927 | return false; |
| 3928 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3929 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3930 | |
| 3931 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3932 | } |
| 3933 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3934 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, |
| 3935 | VkImageLayout srcImageLayout, VkBuffer dstBuffer, |
| 3936 | uint32_t regionCount, const VkBufferImageCopy *pRegions) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3937 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3938 | 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] | 3939 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3940 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3941 | skipCall |= |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3942 | parameter_validation_vkCmdCopyImageToBuffer(my_data->report_data, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3943 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3944 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3945 | PreCmdCopyImageToBuffer(commandBuffer, pRegions); |
| 3946 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3947 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3948 | ->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3949 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3950 | } |
| 3951 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3952 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, |
| 3953 | VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t *pData) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3954 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3955 | 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] | 3956 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3957 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3958 | skipCall |= parameter_validation_vkCmdUpdateBuffer(my_data->report_data, dstBuffer, dstOffset, dataSize, pData); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3959 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3960 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3961 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3962 | ->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3963 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3964 | } |
| 3965 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3966 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3967 | vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3968 | bool skipCall = false; |
| 3969 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3970 | assert(my_data != NULL); |
| 3971 | |
| 3972 | skipCall |= parameter_validation_vkCmdFillBuffer(my_data->report_data, dstBuffer, dstOffset, size, data); |
| 3973 | |
| 3974 | if (!skipCall) { |
| 3975 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data); |
| 3976 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3977 | } |
| 3978 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3979 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, |
| 3980 | VkImageLayout imageLayout, const VkClearColorValue *pColor, |
| 3981 | uint32_t rangeCount, const VkImageSubresourceRange *pRanges) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3982 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3983 | 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] | 3984 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3985 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 3986 | skipCall |= parameter_validation_vkCmdClearColorImage(my_data->report_data, image, imageLayout, pColor, rangeCount, pRanges); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3987 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3988 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3989 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3990 | ->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3991 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3992 | } |
| 3993 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3994 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 3995 | vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 3996 | const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, |
| 3997 | const VkImageSubresourceRange *pRanges) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 3998 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3999 | 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] | 4000 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4001 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4002 | skipCall |= |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 4003 | parameter_validation_vkCmdClearDepthStencilImage(my_data->report_data, image, imageLayout, pDepthStencil, rangeCount, pRanges); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4004 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4005 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4006 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4007 | ->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4008 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4009 | } |
| 4010 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4011 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 4012 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
| 4013 | const VkClearRect *pRects) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4014 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4015 | 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] | 4016 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4017 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 4018 | skipCall |= parameter_validation_vkCmdClearAttachments(my_data->report_data, attachmentCount, pAttachments, rectCount, pRects); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4019 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4020 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4021 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4022 | ->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4023 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4024 | } |
| 4025 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4026 | bool PreCmdResolveImage(VkCommandBuffer commandBuffer, const VkImageResolve *pRegions) { |
| 4027 | if (pRegions != nullptr) { |
| 4028 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4029 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 4030 | log_msg( |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4031 | mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4032 | UNRECOGNIZED_VALUE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4033 | "vkCmdResolveImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 4034 | return false; |
| 4035 | } |
| 4036 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4037 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 4038 | log_msg( |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 4039 | mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4040 | UNRECOGNIZED_VALUE, "PARAMCHECK", |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4041 | "vkCmdResolveImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 4042 | return false; |
| 4043 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4044 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4045 | |
| 4046 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4047 | } |
| 4048 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4049 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 4050 | vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, |
| 4051 | VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve *pRegions) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4052 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4053 | 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] | 4054 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4055 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 4056 | skipCall |= parameter_validation_vkCmdResolveImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4057 | pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4058 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4059 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4060 | PreCmdResolveImage(commandBuffer, pRegions); |
| 4061 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4062 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4063 | ->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4064 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4065 | } |
| 4066 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4067 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 4068 | vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4069 | bool skipCall = false; |
| 4070 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4071 | assert(my_data != NULL); |
| 4072 | |
| 4073 | skipCall |= parameter_validation_vkCmdSetEvent(my_data->report_data, event, stageMask); |
| 4074 | |
| 4075 | if (!skipCall) { |
| 4076 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetEvent(commandBuffer, event, stageMask); |
| 4077 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4078 | } |
| 4079 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4080 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 4081 | vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4082 | bool skipCall = false; |
| 4083 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4084 | assert(my_data != NULL); |
| 4085 | |
| 4086 | skipCall |= parameter_validation_vkCmdResetEvent(my_data->report_data, event, stageMask); |
| 4087 | |
| 4088 | if (!skipCall) { |
| 4089 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdResetEvent(commandBuffer, event, stageMask); |
| 4090 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4091 | } |
| 4092 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4093 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 4094 | vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, VkPipelineStageFlags srcStageMask, |
| 4095 | VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 4096 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 4097 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4098 | bool skipCall = 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 | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 4102 | skipCall |= parameter_validation_vkCmdWaitEvents(my_data->report_data, eventCount, pEvents, srcStageMask, dstStageMask, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4103 | memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, |
| 4104 | imageMemoryBarrierCount, pImageMemoryBarriers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4105 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4106 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4107 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4108 | ->CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, |
| 4109 | bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
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 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4113 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 4114 | vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, |
| 4115 | VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 4116 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 4117 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4118 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4119 | 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] | 4120 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4121 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 4122 | skipCall |= parameter_validation_vkCmdPipelineBarrier(my_data->report_data, srcStageMask, dstStageMask, dependencyFlags, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4123 | memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, |
| 4124 | pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4125 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4126 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4127 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4128 | ->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, |
| 4129 | bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4130 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4131 | } |
| 4132 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4133 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 4134 | vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4135 | bool skipCall = false; |
| 4136 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4137 | assert(my_data != NULL); |
| 4138 | |
| 4139 | skipCall |= parameter_validation_vkCmdBeginQuery(my_data->report_data, queryPool, slot, flags); |
| 4140 | |
| 4141 | if (!skipCall) { |
| 4142 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBeginQuery(commandBuffer, queryPool, slot, flags); |
| 4143 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4144 | } |
| 4145 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4146 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4147 | bool skipCall = false; |
| 4148 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4149 | assert(my_data != NULL); |
| 4150 | |
| 4151 | skipCall |= parameter_validation_vkCmdEndQuery(my_data->report_data, queryPool, slot); |
| 4152 | |
| 4153 | if (!skipCall) { |
| 4154 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdEndQuery(commandBuffer, queryPool, slot); |
| 4155 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4156 | } |
| 4157 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4158 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 4159 | vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4160 | bool skipCall = false; |
| 4161 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4162 | assert(my_data != NULL); |
| 4163 | |
| 4164 | skipCall |= parameter_validation_vkCmdResetQueryPool(my_data->report_data, queryPool, firstQuery, queryCount); |
| 4165 | |
| 4166 | if (!skipCall) { |
| 4167 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); |
| 4168 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4169 | } |
| 4170 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4171 | bool PostCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, |
| 4172 | uint32_t slot) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4173 | |
Chia-I Wu | 51ce5ea | 2015-10-26 19:40:27 +0800 | [diff] [blame] | 4174 | ValidateEnumerator(pipelineStage); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4175 | |
| 4176 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4177 | } |
| 4178 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4179 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, |
| 4180 | VkQueryPool queryPool, uint32_t query) { |
| 4181 | bool skipCall = false; |
| 4182 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4183 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4184 | |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4185 | skipCall |= parameter_validation_vkCmdWriteTimestamp(my_data->report_data, pipelineStage, queryPool, query); |
| 4186 | |
| 4187 | if (!skipCall) { |
| 4188 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 4189 | |
| 4190 | PostCmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 4191 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4192 | } |
| 4193 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4194 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 4195 | vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, |
| 4196 | VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4197 | bool skipCall = false; |
| 4198 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4199 | assert(my_data != NULL); |
| 4200 | |
| 4201 | skipCall |= parameter_validation_vkCmdCopyQueryPoolResults(my_data->report_data, queryPool, firstQuery, queryCount, dstBuffer, |
| 4202 | dstOffset, stride, flags); |
| 4203 | |
| 4204 | if (!skipCall) { |
| 4205 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4206 | ->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags); |
| 4207 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4208 | } |
| 4209 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4210 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, |
| 4211 | VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, |
| 4212 | const void *pValues) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4213 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4214 | 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] | 4215 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4216 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 4217 | skipCall |= parameter_validation_vkCmdPushConstants(my_data->report_data, layout, stageFlags, offset, size, pValues); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4218 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4219 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4220 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4221 | ->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4222 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4223 | } |
| 4224 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4225 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 4226 | vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, VkSubpassContents contents) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4227 | bool skipCall = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4228 | 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] | 4229 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4230 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 4231 | skipCall |= parameter_validation_vkCmdBeginRenderPass(my_data->report_data, pRenderPassBegin, contents); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4232 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4233 | if (!skipCall) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4234 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4235 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4236 | } |
| 4237 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4238 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4239 | bool skipCall = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4240 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4241 | assert(my_data != NULL); |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 4242 | |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4243 | skipCall |= parameter_validation_vkCmdNextSubpass(my_data->report_data, contents); |
| 4244 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4245 | if (!skipCall) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4246 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdNextSubpass(commandBuffer, contents); |
| 4247 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4248 | } |
| 4249 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4250 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4251 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdEndRenderPass(commandBuffer); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4252 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4253 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4254 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL |
| 4255 | vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4256 | bool skipCall = 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 | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 4260 | skipCall |= parameter_validation_vkCmdExecuteCommands(my_data->report_data, commandBufferCount, pCommandBuffers); |
Chia-I Wu | 0b50a1c | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 4261 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4262 | if (!skipCall) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4263 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4264 | ->CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4265 | } |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 4266 | } |
| 4267 | |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame^] | 4268 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, |
| 4269 | const char *pLayerName, uint32_t *pCount, |
| 4270 | VkExtensionProperties *pProperties) { |
| 4271 | /* parameter_validation does not have any physical device extensions */ |
| 4272 | if (pLayerName == NULL) { |
| 4273 | return get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4274 | ->EnumerateDeviceExtensionProperties(physicalDevice, NULL, pCount, pProperties); |
| 4275 | } else { |
| 4276 | return util_GetExtensionProperties(0, NULL, pCount, pProperties); |
| 4277 | } |
| 4278 | } |
| 4279 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4280 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *funcName) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 4281 | layer_data *data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 4282 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 4283 | if (validate_string(data->report_data, "vkGetDeviceProcAddr", "funcName", funcName)) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 4284 | return NULL; |
| 4285 | } |
| 4286 | |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 4287 | if (!strcmp(funcName, "vkGetDeviceProcAddr")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4288 | return (PFN_vkVoidFunction)vkGetDeviceProcAddr; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4289 | if (!strcmp(funcName, "vkDestroyDevice")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4290 | return (PFN_vkVoidFunction)vkDestroyDevice; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4291 | if (!strcmp(funcName, "vkGetDeviceQueue")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4292 | return (PFN_vkVoidFunction)vkGetDeviceQueue; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4293 | if (!strcmp(funcName, "vkQueueSubmit")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4294 | return (PFN_vkVoidFunction)vkQueueSubmit; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4295 | if (!strcmp(funcName, "vkQueueWaitIdle")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4296 | return (PFN_vkVoidFunction)vkQueueWaitIdle; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4297 | if (!strcmp(funcName, "vkDeviceWaitIdle")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4298 | return (PFN_vkVoidFunction)vkDeviceWaitIdle; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 4299 | if (!strcmp(funcName, "vkAllocateMemory")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4300 | return (PFN_vkVoidFunction)vkAllocateMemory; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4301 | if (!strcmp(funcName, "vkFreeMemory")) |
| 4302 | return (PFN_vkVoidFunction)vkFreeMemory; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4303 | if (!strcmp(funcName, "vkMapMemory")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4304 | return (PFN_vkVoidFunction)vkMapMemory; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4305 | if (!strcmp(funcName, "vkUnmapMemory")) |
| 4306 | return (PFN_vkVoidFunction)vkUnmapMemory; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4307 | if (!strcmp(funcName, "vkFlushMappedMemoryRanges")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4308 | return (PFN_vkVoidFunction)vkFlushMappedMemoryRanges; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4309 | if (!strcmp(funcName, "vkInvalidateMappedMemoryRanges")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4310 | return (PFN_vkVoidFunction)vkInvalidateMappedMemoryRanges; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4311 | if (!strcmp(funcName, "vkGetDeviceMemoryCommitment")) |
| 4312 | return (PFN_vkVoidFunction)vkGetDeviceMemoryCommitment; |
| 4313 | if (!strcmp(funcName, "vkBindBufferMemory")) |
| 4314 | return (PFN_vkVoidFunction)vkBindBufferMemory; |
| 4315 | if (!strcmp(funcName, "vkBindImageMemory")) |
| 4316 | return (PFN_vkVoidFunction)vkBindImageMemory; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4317 | if (!strcmp(funcName, "vkCreateFence")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4318 | return (PFN_vkVoidFunction)vkCreateFence; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4319 | if (!strcmp(funcName, "vkDestroyFence")) |
| 4320 | return (PFN_vkVoidFunction)vkDestroyFence; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4321 | if (!strcmp(funcName, "vkResetFences")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4322 | return (PFN_vkVoidFunction)vkResetFences; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4323 | if (!strcmp(funcName, "vkGetFenceStatus")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4324 | return (PFN_vkVoidFunction)vkGetFenceStatus; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4325 | if (!strcmp(funcName, "vkWaitForFences")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4326 | return (PFN_vkVoidFunction)vkWaitForFences; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4327 | if (!strcmp(funcName, "vkCreateSemaphore")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4328 | return (PFN_vkVoidFunction)vkCreateSemaphore; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4329 | if (!strcmp(funcName, "vkDestroySemaphore")) |
| 4330 | return (PFN_vkVoidFunction)vkDestroySemaphore; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4331 | if (!strcmp(funcName, "vkCreateEvent")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4332 | return (PFN_vkVoidFunction)vkCreateEvent; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4333 | if (!strcmp(funcName, "vkDestroyEvent")) |
| 4334 | return (PFN_vkVoidFunction)vkDestroyEvent; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4335 | if (!strcmp(funcName, "vkGetEventStatus")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4336 | return (PFN_vkVoidFunction)vkGetEventStatus; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4337 | if (!strcmp(funcName, "vkSetEvent")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4338 | return (PFN_vkVoidFunction)vkSetEvent; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4339 | if (!strcmp(funcName, "vkResetEvent")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4340 | return (PFN_vkVoidFunction)vkResetEvent; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4341 | if (!strcmp(funcName, "vkCreateQueryPool")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4342 | return (PFN_vkVoidFunction)vkCreateQueryPool; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4343 | if (!strcmp(funcName, "vkDestroyQueryPool")) |
| 4344 | return (PFN_vkVoidFunction)vkDestroyQueryPool; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4345 | if (!strcmp(funcName, "vkGetQueryPoolResults")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4346 | return (PFN_vkVoidFunction)vkGetQueryPoolResults; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4347 | if (!strcmp(funcName, "vkCreateBuffer")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4348 | return (PFN_vkVoidFunction)vkCreateBuffer; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4349 | if (!strcmp(funcName, "vkDestroyBuffer")) |
| 4350 | return (PFN_vkVoidFunction)vkDestroyBuffer; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4351 | if (!strcmp(funcName, "vkCreateBufferView")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4352 | return (PFN_vkVoidFunction)vkCreateBufferView; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4353 | if (!strcmp(funcName, "vkDestroyBufferView")) |
| 4354 | return (PFN_vkVoidFunction)vkDestroyBufferView; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4355 | if (!strcmp(funcName, "vkCreateImage")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4356 | return (PFN_vkVoidFunction)vkCreateImage; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4357 | if (!strcmp(funcName, "vkDestroyImage")) |
| 4358 | return (PFN_vkVoidFunction)vkDestroyImage; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4359 | if (!strcmp(funcName, "vkGetImageSubresourceLayout")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4360 | return (PFN_vkVoidFunction)vkGetImageSubresourceLayout; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4361 | if (!strcmp(funcName, "vkCreateImageView")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4362 | return (PFN_vkVoidFunction)vkCreateImageView; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4363 | if (!strcmp(funcName, "vkDestroyImageView")) |
| 4364 | return (PFN_vkVoidFunction)vkDestroyImageView; |
Michael Lentine | 03d8e57 | 2015-09-15 14:59:14 -0500 | [diff] [blame] | 4365 | if (!strcmp(funcName, "vkCreateShaderModule")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4366 | return (PFN_vkVoidFunction)vkCreateShaderModule; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4367 | if (!strcmp(funcName, "vkDestroyShaderModule")) |
| 4368 | return (PFN_vkVoidFunction)vkDestroyShaderModule; |
| 4369 | if (!strcmp(funcName, "vkCreatePipelineCache")) |
| 4370 | return (PFN_vkVoidFunction)vkCreatePipelineCache; |
| 4371 | if (!strcmp(funcName, "vkDestroyPipelineCache")) |
| 4372 | return (PFN_vkVoidFunction)vkDestroyPipelineCache; |
| 4373 | if (!strcmp(funcName, "vkGetPipelineCacheData")) |
| 4374 | return (PFN_vkVoidFunction)vkGetPipelineCacheData; |
| 4375 | if (!strcmp(funcName, "vkMergePipelineCaches")) |
| 4376 | return (PFN_vkVoidFunction)vkMergePipelineCaches; |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 4377 | if (!strcmp(funcName, "vkCreateGraphicsPipelines")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4378 | return (PFN_vkVoidFunction)vkCreateGraphicsPipelines; |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 4379 | if (!strcmp(funcName, "vkCreateComputePipelines")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4380 | return (PFN_vkVoidFunction)vkCreateComputePipelines; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4381 | if (!strcmp(funcName, "vkDestroyPipeline")) |
| 4382 | return (PFN_vkVoidFunction)vkDestroyPipeline; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4383 | if (!strcmp(funcName, "vkCreatePipelineLayout")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4384 | return (PFN_vkVoidFunction)vkCreatePipelineLayout; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4385 | if (!strcmp(funcName, "vkDestroyPipelineLayout")) |
| 4386 | return (PFN_vkVoidFunction)vkDestroyPipelineLayout; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4387 | if (!strcmp(funcName, "vkCreateSampler")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4388 | return (PFN_vkVoidFunction)vkCreateSampler; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4389 | if (!strcmp(funcName, "vkDestroySampler")) |
| 4390 | return (PFN_vkVoidFunction)vkDestroySampler; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4391 | if (!strcmp(funcName, "vkCreateDescriptorSetLayout")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4392 | return (PFN_vkVoidFunction)vkCreateDescriptorSetLayout; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4393 | if (!strcmp(funcName, "vkDestroyDescriptorSetLayout")) |
| 4394 | return (PFN_vkVoidFunction)vkDestroyDescriptorSetLayout; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4395 | if (!strcmp(funcName, "vkCreateDescriptorPool")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4396 | return (PFN_vkVoidFunction)vkCreateDescriptorPool; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4397 | if (!strcmp(funcName, "vkDestroyDescriptorPool")) |
| 4398 | return (PFN_vkVoidFunction)vkDestroyDescriptorPool; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4399 | if (!strcmp(funcName, "vkResetDescriptorPool")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4400 | return (PFN_vkVoidFunction)vkResetDescriptorPool; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 4401 | if (!strcmp(funcName, "vkAllocateDescriptorSets")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4402 | return (PFN_vkVoidFunction)vkAllocateDescriptorSets; |
Tobin Ehlis | b55bc27 | 2016-05-17 10:38:45 -0600 | [diff] [blame] | 4403 | if (!strcmp(funcName, "vkFreeDescriptorSets")) |
| 4404 | return (PFN_vkVoidFunction)vkFreeDescriptorSets; |
| 4405 | if (!strcmp(funcName, "vkUpdateDescriptorSets")) |
| 4406 | return (PFN_vkVoidFunction)vkUpdateDescriptorSets; |
Courtney Goeltzenleuchter | 49c7308 | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 4407 | if (!strcmp(funcName, "vkCmdSetViewport")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4408 | return (PFN_vkVoidFunction)vkCmdSetViewport; |
Courtney Goeltzenleuchter | 078f817 | 2015-09-21 11:44:06 -0600 | [diff] [blame] | 4409 | if (!strcmp(funcName, "vkCmdSetScissor")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4410 | return (PFN_vkVoidFunction)vkCmdSetScissor; |
Courtney Goeltzenleuchter | 49c7308 | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 4411 | if (!strcmp(funcName, "vkCmdSetLineWidth")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4412 | return (PFN_vkVoidFunction)vkCmdSetLineWidth; |
Courtney Goeltzenleuchter | 49c7308 | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 4413 | if (!strcmp(funcName, "vkCmdSetDepthBias")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4414 | return (PFN_vkVoidFunction)vkCmdSetDepthBias; |
Courtney Goeltzenleuchter | 49c7308 | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 4415 | if (!strcmp(funcName, "vkCmdSetBlendConstants")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4416 | return (PFN_vkVoidFunction)vkCmdSetBlendConstants; |
Courtney Goeltzenleuchter | 49c7308 | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 4417 | if (!strcmp(funcName, "vkCmdSetDepthBounds")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4418 | return (PFN_vkVoidFunction)vkCmdSetDepthBounds; |
Courtney Goeltzenleuchter | 49c7308 | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 4419 | if (!strcmp(funcName, "vkCmdSetStencilCompareMask")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4420 | return (PFN_vkVoidFunction)vkCmdSetStencilCompareMask; |
Courtney Goeltzenleuchter | 49c7308 | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 4421 | if (!strcmp(funcName, "vkCmdSetStencilWriteMask")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4422 | return (PFN_vkVoidFunction)vkCmdSetStencilWriteMask; |
Courtney Goeltzenleuchter | 49c7308 | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 4423 | if (!strcmp(funcName, "vkCmdSetStencilReference")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4424 | return (PFN_vkVoidFunction)vkCmdSetStencilReference; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 4425 | if (!strcmp(funcName, "vkAllocateCommandBuffers")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4426 | return (PFN_vkVoidFunction)vkAllocateCommandBuffers; |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 4427 | if (!strcmp(funcName, "vkFreeCommandBuffers")) |
| 4428 | return (PFN_vkVoidFunction)vkFreeCommandBuffers; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4429 | if (!strcmp(funcName, "vkBeginCommandBuffer")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4430 | return (PFN_vkVoidFunction)vkBeginCommandBuffer; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4431 | if (!strcmp(funcName, "vkEndCommandBuffer")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4432 | return (PFN_vkVoidFunction)vkEndCommandBuffer; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4433 | if (!strcmp(funcName, "vkResetCommandBuffer")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4434 | return (PFN_vkVoidFunction)vkResetCommandBuffer; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4435 | if (!strcmp(funcName, "vkCmdBindPipeline")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4436 | return (PFN_vkVoidFunction)vkCmdBindPipeline; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4437 | if (!strcmp(funcName, "vkCmdBindDescriptorSets")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4438 | return (PFN_vkVoidFunction)vkCmdBindDescriptorSets; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4439 | if (!strcmp(funcName, "vkCmdBindVertexBuffers")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4440 | return (PFN_vkVoidFunction)vkCmdBindVertexBuffers; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4441 | if (!strcmp(funcName, "vkCmdBindIndexBuffer")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4442 | return (PFN_vkVoidFunction)vkCmdBindIndexBuffer; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4443 | if (!strcmp(funcName, "vkCmdDraw")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4444 | return (PFN_vkVoidFunction)vkCmdDraw; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4445 | if (!strcmp(funcName, "vkCmdDrawIndexed")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4446 | return (PFN_vkVoidFunction)vkCmdDrawIndexed; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4447 | if (!strcmp(funcName, "vkCmdDrawIndirect")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4448 | return (PFN_vkVoidFunction)vkCmdDrawIndirect; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4449 | if (!strcmp(funcName, "vkCmdDrawIndexedIndirect")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4450 | return (PFN_vkVoidFunction)vkCmdDrawIndexedIndirect; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4451 | if (!strcmp(funcName, "vkCmdDispatch")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4452 | return (PFN_vkVoidFunction)vkCmdDispatch; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4453 | if (!strcmp(funcName, "vkCmdDispatchIndirect")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4454 | return (PFN_vkVoidFunction)vkCmdDispatchIndirect; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4455 | if (!strcmp(funcName, "vkCmdCopyBuffer")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4456 | return (PFN_vkVoidFunction)vkCmdCopyBuffer; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4457 | if (!strcmp(funcName, "vkCmdCopyImage")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4458 | return (PFN_vkVoidFunction)vkCmdCopyImage; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4459 | if (!strcmp(funcName, "vkCmdBlitImage")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4460 | return (PFN_vkVoidFunction)vkCmdBlitImage; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4461 | if (!strcmp(funcName, "vkCmdCopyBufferToImage")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4462 | return (PFN_vkVoidFunction)vkCmdCopyBufferToImage; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4463 | if (!strcmp(funcName, "vkCmdCopyImageToBuffer")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4464 | return (PFN_vkVoidFunction)vkCmdCopyImageToBuffer; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4465 | if (!strcmp(funcName, "vkCmdUpdateBuffer")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4466 | return (PFN_vkVoidFunction)vkCmdUpdateBuffer; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4467 | if (!strcmp(funcName, "vkCmdFillBuffer")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4468 | return (PFN_vkVoidFunction)vkCmdFillBuffer; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4469 | if (!strcmp(funcName, "vkCmdClearColorImage")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4470 | return (PFN_vkVoidFunction)vkCmdClearColorImage; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4471 | if (!strcmp(funcName, "vkCmdResolveImage")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4472 | return (PFN_vkVoidFunction)vkCmdResolveImage; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4473 | if (!strcmp(funcName, "vkCmdSetEvent")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4474 | return (PFN_vkVoidFunction)vkCmdSetEvent; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4475 | if (!strcmp(funcName, "vkCmdResetEvent")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4476 | return (PFN_vkVoidFunction)vkCmdResetEvent; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4477 | if (!strcmp(funcName, "vkCmdWaitEvents")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4478 | return (PFN_vkVoidFunction)vkCmdWaitEvents; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4479 | if (!strcmp(funcName, "vkCmdPipelineBarrier")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4480 | return (PFN_vkVoidFunction)vkCmdPipelineBarrier; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4481 | if (!strcmp(funcName, "vkCmdBeginQuery")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4482 | return (PFN_vkVoidFunction)vkCmdBeginQuery; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4483 | if (!strcmp(funcName, "vkCmdEndQuery")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4484 | return (PFN_vkVoidFunction)vkCmdEndQuery; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4485 | if (!strcmp(funcName, "vkCmdResetQueryPool")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4486 | return (PFN_vkVoidFunction)vkCmdResetQueryPool; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4487 | if (!strcmp(funcName, "vkCmdWriteTimestamp")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4488 | return (PFN_vkVoidFunction)vkCmdWriteTimestamp; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4489 | if (!strcmp(funcName, "vkCmdCopyQueryPoolResults")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4490 | return (PFN_vkVoidFunction)vkCmdCopyQueryPoolResults; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4491 | if (!strcmp(funcName, "vkCreateFramebuffer")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4492 | return (PFN_vkVoidFunction)vkCreateFramebuffer; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4493 | if (!strcmp(funcName, "vkDestroyFramebuffer")) |
| 4494 | return (PFN_vkVoidFunction)vkDestroyFramebuffer; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4495 | if (!strcmp(funcName, "vkCreateRenderPass")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4496 | return (PFN_vkVoidFunction)vkCreateRenderPass; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 4497 | if (!strcmp(funcName, "vkDestroyRenderPass")) |
| 4498 | return (PFN_vkVoidFunction)vkDestroyRenderPass; |
| 4499 | if (!strcmp(funcName, "vkGetRenderAreaGranularity")) |
| 4500 | return (PFN_vkVoidFunction)vkGetRenderAreaGranularity; |
| 4501 | if (!strcmp(funcName, "vkCreateCommandPool")) |
| 4502 | return (PFN_vkVoidFunction)vkCreateCommandPool; |
| 4503 | if (!strcmp(funcName, "vkDestroyCommandPool")) |
| 4504 | return (PFN_vkVoidFunction)vkDestroyCommandPool; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4505 | if (!strcmp(funcName, "vkResetCommandPool")) |
| 4506 | return (PFN_vkVoidFunction)vkResetCommandPool; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4507 | if (!strcmp(funcName, "vkCmdBeginRenderPass")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4508 | return (PFN_vkVoidFunction)vkCmdBeginRenderPass; |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 4509 | if (!strcmp(funcName, "vkCmdNextSubpass")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4510 | return (PFN_vkVoidFunction)vkCmdNextSubpass; |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 4511 | |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 4512 | if (device == NULL) { |
| 4513 | return NULL; |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4514 | } |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 4515 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4516 | if (get_dispatch_table(pc_device_table_map, device)->GetDeviceProcAddr == NULL) |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 4517 | return NULL; |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4518 | return get_dispatch_table(pc_device_table_map, device)->GetDeviceProcAddr(device, funcName); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4519 | } |
| 4520 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4521 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *funcName) { |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 4522 | if (!strcmp(funcName, "vkGetInstanceProcAddr")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4523 | return (PFN_vkVoidFunction)vkGetInstanceProcAddr; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4524 | if (!strcmp(funcName, "vkCreateInstance")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4525 | return (PFN_vkVoidFunction)vkCreateInstance; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4526 | if (!strcmp(funcName, "vkDestroyInstance")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4527 | return (PFN_vkVoidFunction)vkDestroyInstance; |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 4528 | if (!strcmp(funcName, "vkCreateDevice")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4529 | return (PFN_vkVoidFunction)vkCreateDevice; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4530 | if (!strcmp(funcName, "vkEnumeratePhysicalDevices")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4531 | return (PFN_vkVoidFunction)vkEnumeratePhysicalDevices; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4532 | if (!strcmp(funcName, "vkGetPhysicalDeviceProperties")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4533 | return (PFN_vkVoidFunction)vkGetPhysicalDeviceProperties; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4534 | if (!strcmp(funcName, "vkGetPhysicalDeviceFeatures")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4535 | return (PFN_vkVoidFunction)vkGetPhysicalDeviceFeatures; |
Courtney Goeltzenleuchter | 2caec86 | 2015-07-12 12:52:09 -0600 | [diff] [blame] | 4536 | if (!strcmp(funcName, "vkGetPhysicalDeviceFormatProperties")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4537 | return (PFN_vkVoidFunction)vkGetPhysicalDeviceFormatProperties; |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 4538 | if (!strcmp(funcName, "vkGetPhysicalDeviceImageFormatProperties")) |
| 4539 | return (PFN_vkVoidFunction)vkGetPhysicalDeviceImageFormatProperties; |
| 4540 | if (!strcmp(funcName, "vkGetPhysicalDeviceSparseImageFormatProperties")) |
| 4541 | return (PFN_vkVoidFunction)vkGetPhysicalDeviceSparseImageFormatProperties; |
| 4542 | if (!strcmp(funcName, "vkGetPhysicalDeviceQueueFamilyProperties")) |
| 4543 | return (PFN_vkVoidFunction)vkGetPhysicalDeviceQueueFamilyProperties; |
| 4544 | if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties")) |
| 4545 | return (PFN_vkVoidFunction)vkGetPhysicalDeviceMemoryProperties; |
Courtney Goeltzenleuchter | 35985f6 | 2015-09-14 17:22:16 -0600 | [diff] [blame] | 4546 | if (!strcmp(funcName, "vkEnumerateInstanceLayerProperties")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4547 | return (PFN_vkVoidFunction)vkEnumerateInstanceLayerProperties; |
Courtney Goeltzenleuchter | 35985f6 | 2015-09-14 17:22:16 -0600 | [diff] [blame] | 4548 | if (!strcmp(funcName, "vkEnumerateInstanceExtensionProperties")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4549 | return (PFN_vkVoidFunction)vkEnumerateInstanceExtensionProperties; |
Courtney Goeltzenleuchter | 35985f6 | 2015-09-14 17:22:16 -0600 | [diff] [blame] | 4550 | if (!strcmp(funcName, "vkEnumerateDeviceLayerProperties")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4551 | return (PFN_vkVoidFunction)vkEnumerateDeviceLayerProperties; |
Courtney Goeltzenleuchter | 35985f6 | 2015-09-14 17:22:16 -0600 | [diff] [blame] | 4552 | if (!strcmp(funcName, "vkEnumerateDeviceExtensionProperties")) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4553 | return (PFN_vkVoidFunction)vkEnumerateDeviceExtensionProperties; |
Courtney Goeltzenleuchter | 500b89b | 2015-06-01 14:45:27 -0600 | [diff] [blame] | 4554 | |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 4555 | if (instance == NULL) { |
| 4556 | return NULL; |
| 4557 | } |
| 4558 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4559 | 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] | 4560 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4561 | PFN_vkVoidFunction fptr = debug_report_get_instance_proc_addr(data->report_data, funcName); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4562 | if (fptr) |
Courtney Goeltzenleuchter | 500b89b | 2015-06-01 14:45:27 -0600 | [diff] [blame] | 4563 | return fptr; |
| 4564 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4565 | if (get_dispatch_table(pc_instance_table_map, instance)->GetInstanceProcAddr == NULL) |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 4566 | return NULL; |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4567 | return get_dispatch_table(pc_instance_table_map, instance)->GetInstanceProcAddr(instance, funcName); |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 4568 | } |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame^] | 4569 | |
| 4570 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 4571 | vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties *pProperties) { |
| 4572 | return util_GetExtensionProperties(1, instance_extensions, pCount, pProperties); |
| 4573 | } |
| 4574 | |
| 4575 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 4576 | vkEnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) { |
| 4577 | return util_GetLayerProperties(ARRAY_SIZE(pc_global_layers), pc_global_layers, pCount, pProperties); |
| 4578 | } |
| 4579 | |
| 4580 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 4581 | vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, VkLayerProperties *pProperties) { |
| 4582 | |
| 4583 | /* parameter_validation's physical device layers are the same as global */ |
| 4584 | return util_GetLayerProperties(ARRAY_SIZE(pc_global_layers), pc_global_layers, pCount, pProperties); |
| 4585 | } |