Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2016 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2016 Valve Corporation |
| 3 | * Copyright (c) 2015-2016 LunarG, Inc. |
| 4 | * Copyright (C) 2015-2016 Google Inc. |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 5 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 9 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 11 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
Courtney Goeltzenleuchter | 0555952 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 17 | * |
| 18 | * Author: Jeremy Hayes <jeremy@lunarg.com> |
| 19 | * Author: Tony Barbour <tony@LunarG.com> |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 20 | * Author: Mark Lobodzinski <mark@LunarG.com> |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 21 | * Author: Dustin Graves <dustin@lunarg.com> |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 22 | */ |
| 23 | |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 24 | #define NOMINMAX |
| 25 | |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 26 | #include <limits.h> |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 27 | #include <math.h> |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 28 | #include <stdio.h> |
| 29 | #include <stdlib.h> |
| 30 | #include <string.h> |
| 31 | |
| 32 | #include <iostream> |
| 33 | #include <string> |
| 34 | #include <sstream> |
Mark Lobodzinski | 2eed1eb | 2015-05-26 10:58:40 -0500 | [diff] [blame] | 35 | #include <unordered_map> |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 36 | #include <unordered_set> |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 37 | #include <vector> |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 38 | |
Tobin Ehlis | b835d1b | 2015-07-03 10:34:49 -0600 | [diff] [blame] | 39 | #include "vk_loader_platform.h" |
David Pinedo | 9316d3b | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 40 | #include "vulkan/vk_layer.h" |
Tobin Ehlis | a0cb02e | 2015-07-03 10:15:26 -0600 | [diff] [blame] | 41 | #include "vk_layer_config.h" |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 42 | #include "vk_enum_validate_helper.h" |
| 43 | #include "vk_struct_validate_helper.h" |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 44 | |
Tobin Ehlis | a0cb02e | 2015-07-03 10:15:26 -0600 | [diff] [blame] | 45 | #include "vk_layer_table.h" |
| 46 | #include "vk_layer_data.h" |
| 47 | #include "vk_layer_logging.h" |
Courtney Goeltzenleuchter | f13293f | 2015-07-07 11:02:42 -0600 | [diff] [blame] | 48 | #include "vk_layer_extension_utils.h" |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 49 | #include "vk_layer_utils.h" |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 50 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 51 | #include "parameter_name.h" |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 52 | #include "parameter_validation.h" |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 53 | |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 54 | namespace parameter_validation { |
Dustin Graves | b83fc2d | 2016-05-04 12:56:08 -0600 | [diff] [blame] | 55 | |
Cody Northrop | 55443ef | 2015-09-28 15:09:32 -0600 | [diff] [blame] | 56 | struct layer_data { |
Chia-I Wu | a570b7c | 2016-05-16 07:48:14 +0800 | [diff] [blame] | 57 | VkInstance instance; |
| 58 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 59 | debug_report_data *report_data; |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 60 | std::vector<VkDebugReportCallbackEXT> logging_callback; |
Cody Northrop | 55443ef | 2015-09-28 15:09:32 -0600 | [diff] [blame] | 61 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 62 | // The following are for keeping track of the temporary callbacks that can |
| 63 | // be used in vkCreateInstance and vkDestroyInstance: |
| 64 | uint32_t num_tmp_callbacks; |
| 65 | VkDebugReportCallbackCreateInfoEXT *tmp_dbg_create_infos; |
| 66 | VkDebugReportCallbackEXT *tmp_callbacks; |
| 67 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 68 | // TODO: Split instance/device structs |
| 69 | // Device Data |
| 70 | // Map for queue family index to queue count |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 71 | std::unordered_map<uint32_t, uint32_t> queueFamilyIndexMap; |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 72 | VkPhysicalDeviceLimits device_limits; |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 73 | VkPhysicalDeviceFeatures physical_device_features; |
| 74 | VkPhysicalDevice physical_device; |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 75 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 76 | bool wsi_enabled; |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 77 | bool wsi_display_swapchain_enabled; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 78 | |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 79 | layer_data() |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 80 | : report_data(nullptr), num_tmp_callbacks(0), tmp_dbg_create_infos(nullptr), tmp_callbacks(nullptr), device_limits{}, |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 81 | physical_device_features{}, physical_device{}, wsi_enabled(false), wsi_display_swapchain_enabled(false) {}; |
Cody Northrop | 55443ef | 2015-09-28 15:09:32 -0600 | [diff] [blame] | 82 | }; |
Mark Lobodzinski | 2eed1eb | 2015-05-26 10:58:40 -0500 | [diff] [blame] | 83 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 84 | static std::unordered_map<void *, struct instance_extension_enables> instance_extension_map; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 85 | static std::unordered_map<void *, layer_data *> layer_data_map; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 86 | static device_table_map pc_device_table_map; |
| 87 | static instance_table_map pc_instance_table_map; |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 88 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 89 | static void init_parameter_validation(layer_data *my_data, const VkAllocationCallbacks *pAllocator) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 90 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 91 | 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] | 92 | } |
| 93 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 94 | VKAPI_ATTR VkResult VKAPI_CALL CreateDebugReportCallbackEXT(VkInstance instance, |
| 95 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 96 | const VkAllocationCallbacks *pAllocator, |
| 97 | VkDebugReportCallbackEXT *pMsgCallback) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 98 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 99 | VkResult result = pTable->CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 100 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 101 | if (result == VK_SUCCESS) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 102 | layer_data *data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
Mark Lobodzinski | 97c4d51 | 2016-05-19 15:27:18 -0600 | [diff] [blame] | 103 | result = layer_create_msg_callback(data->report_data, false, pCreateInfo, pAllocator, pMsgCallback); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | return result; |
| 107 | } |
| 108 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 109 | VKAPI_ATTR void VKAPI_CALL DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 110 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 111 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 112 | pTable->DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 113 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 114 | 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] | 115 | layer_destroy_msg_callback(data->report_data, msgCallback, pAllocator); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 116 | } |
| 117 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 118 | VKAPI_ATTR void VKAPI_CALL DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 119 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 120 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 121 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
| 122 | pTable->DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
Courtney Goeltzenleuchter | f0de724 | 2015-12-01 14:10:55 -0700 | [diff] [blame] | 123 | } |
| 124 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 125 | 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] | 126 | |
Chia-I Wu | 3384db8 | 2016-05-16 07:30:58 +0800 | [diff] [blame] | 127 | static const VkLayerProperties global_layer = { |
Jon Ashburn | dc9111c | 2016-03-22 12:57:13 -0600 | [diff] [blame] | 128 | "VK_LAYER_LUNARG_parameter_validation", VK_LAYER_API_VERSION, 1, "LunarG Validation Layer", |
Chia-I Wu | 3384db8 | 2016-05-16 07:30:58 +0800 | [diff] [blame] | 129 | }; |
Courtney Goeltzenleuchter | 5285766 | 2015-12-01 14:08:28 -0700 | [diff] [blame] | 130 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 131 | static bool ValidateEnumerator(VkFormatFeatureFlagBits const &enumerator) { |
Courtney Goeltzenleuchter | f1ece60 | 2015-09-10 16:25:49 -0600 | [diff] [blame] | 132 | VkFormatFeatureFlagBits allFlags = (VkFormatFeatureFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 133 | VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT | VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | |
| 134 | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT | |
| 135 | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT | VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | |
| 136 | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | |
| 137 | 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] | 138 | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 139 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 140 | return false; |
| 141 | } |
| 142 | |
| 143 | return true; |
| 144 | } |
| 145 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 146 | static std::string EnumeratorString(VkFormatFeatureFlagBits const &enumerator) { |
| 147 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 148 | return "unrecognized enumerator"; |
| 149 | } |
| 150 | |
| 151 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 152 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 153 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT"); |
| 154 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 155 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 156 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT"); |
| 157 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 158 | if (enumerator & VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 159 | strings.push_back("VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT"); |
| 160 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 161 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 162 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT"); |
| 163 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 164 | if (enumerator & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 165 | strings.push_back("VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT"); |
| 166 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 167 | if (enumerator & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 168 | strings.push_back("VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT"); |
| 169 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 170 | if (enumerator & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 171 | strings.push_back("VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT"); |
| 172 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 173 | if (enumerator & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 174 | strings.push_back("VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT"); |
| 175 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 176 | if (enumerator & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 177 | strings.push_back("VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT"); |
| 178 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 179 | if (enumerator & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 180 | strings.push_back("VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
| 181 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 182 | if (enumerator & VK_FORMAT_FEATURE_BLIT_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 183 | strings.push_back("VK_FORMAT_FEATURE_BLIT_SRC_BIT"); |
Cody Northrop | 61d6dd6 | 2015-08-18 14:58:29 -0600 | [diff] [blame] | 184 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 185 | if (enumerator & VK_FORMAT_FEATURE_BLIT_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 186 | strings.push_back("VK_FORMAT_FEATURE_BLIT_DST_BIT"); |
Cody Northrop | 61d6dd6 | 2015-08-18 14:58:29 -0600 | [diff] [blame] | 187 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 188 | if (enumerator & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) { |
Jon Ashburn | 766866a | 2016-01-22 15:39:20 -0700 | [diff] [blame] | 189 | strings.push_back("VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT"); |
| 190 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 191 | |
| 192 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 193 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 194 | enumeratorString += string; |
| 195 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 196 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 197 | enumeratorString += '|'; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | return enumeratorString; |
| 202 | } |
| 203 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 204 | static bool ValidateEnumerator(VkImageUsageFlagBits const &enumerator) { |
| 205 | VkImageUsageFlagBits allFlags = (VkImageUsageFlagBits)( |
| 206 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | |
| 207 | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | |
| 208 | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT); |
| 209 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 210 | return false; |
| 211 | } |
| 212 | |
| 213 | return true; |
| 214 | } |
| 215 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 216 | static std::string EnumeratorString(VkImageUsageFlagBits const &enumerator) { |
| 217 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 218 | return "unrecognized enumerator"; |
| 219 | } |
| 220 | |
| 221 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 222 | if (enumerator & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 223 | strings.push_back("VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT"); |
| 224 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 225 | if (enumerator & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) { |
Courtney Goeltzenleuchter | 660f0ca | 2015-09-10 14:14:11 -0600 | [diff] [blame] | 226 | strings.push_back("VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 227 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 228 | if (enumerator & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 229 | strings.push_back("VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT"); |
| 230 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 231 | if (enumerator & VK_IMAGE_USAGE_STORAGE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 232 | strings.push_back("VK_IMAGE_USAGE_STORAGE_BIT"); |
| 233 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 234 | if (enumerator & VK_IMAGE_USAGE_SAMPLED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 235 | strings.push_back("VK_IMAGE_USAGE_SAMPLED_BIT"); |
| 236 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 237 | if (enumerator & VK_IMAGE_USAGE_TRANSFER_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 238 | strings.push_back("VK_IMAGE_USAGE_TRANSFER_DST_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 239 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 240 | if (enumerator & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 241 | strings.push_back("VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT"); |
| 242 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 243 | if (enumerator & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 244 | strings.push_back("VK_IMAGE_USAGE_TRANSFER_SRC_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 245 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 246 | |
| 247 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 248 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 249 | enumeratorString += string; |
| 250 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 251 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 252 | enumeratorString += '|'; |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | return enumeratorString; |
| 257 | } |
| 258 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 259 | static bool ValidateEnumerator(VkQueueFlagBits const &enumerator) { |
| 260 | VkQueueFlagBits allFlags = |
| 261 | (VkQueueFlagBits)(VK_QUEUE_TRANSFER_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_SPARSE_BINDING_BIT | VK_QUEUE_GRAPHICS_BIT); |
| 262 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 263 | return false; |
| 264 | } |
| 265 | |
| 266 | return true; |
| 267 | } |
| 268 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 269 | static std::string EnumeratorString(VkQueueFlagBits const &enumerator) { |
| 270 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 271 | return "unrecognized enumerator"; |
| 272 | } |
| 273 | |
| 274 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 275 | if (enumerator & VK_QUEUE_TRANSFER_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 276 | strings.push_back("VK_QUEUE_TRANSFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 277 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 278 | if (enumerator & VK_QUEUE_COMPUTE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 279 | strings.push_back("VK_QUEUE_COMPUTE_BIT"); |
| 280 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 281 | if (enumerator & VK_QUEUE_SPARSE_BINDING_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 282 | strings.push_back("VK_QUEUE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 283 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 284 | if (enumerator & VK_QUEUE_GRAPHICS_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 285 | strings.push_back("VK_QUEUE_GRAPHICS_BIT"); |
| 286 | } |
| 287 | |
| 288 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 289 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 290 | enumeratorString += string; |
| 291 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 292 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 293 | enumeratorString += '|'; |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | return enumeratorString; |
| 298 | } |
| 299 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 300 | static bool ValidateEnumerator(VkMemoryPropertyFlagBits const &enumerator) { |
| 301 | VkMemoryPropertyFlagBits allFlags = (VkMemoryPropertyFlagBits)( |
| 302 | VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | |
| 303 | VK_MEMORY_PROPERTY_HOST_CACHED_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); |
| 304 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 305 | return false; |
| 306 | } |
| 307 | |
| 308 | return true; |
| 309 | } |
| 310 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 311 | static std::string EnumeratorString(VkMemoryPropertyFlagBits const &enumerator) { |
| 312 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 313 | return "unrecognized enumerator"; |
| 314 | } |
| 315 | |
| 316 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 317 | if (enumerator & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 318 | strings.push_back("VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT"); |
| 319 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 320 | if (enumerator & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 321 | strings.push_back("VK_MEMORY_PROPERTY_HOST_COHERENT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 322 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 323 | if (enumerator & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 324 | strings.push_back("VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT"); |
| 325 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 326 | if (enumerator & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 327 | strings.push_back("VK_MEMORY_PROPERTY_HOST_CACHED_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 328 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 329 | if (enumerator & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 330 | strings.push_back("VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 331 | } |
| 332 | |
| 333 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 334 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 335 | enumeratorString += string; |
| 336 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 337 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 338 | enumeratorString += '|'; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | return enumeratorString; |
| 343 | } |
| 344 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 345 | static bool ValidateEnumerator(VkMemoryHeapFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 346 | VkMemoryHeapFlagBits allFlags = (VkMemoryHeapFlagBits)(VK_MEMORY_HEAP_DEVICE_LOCAL_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 347 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 348 | return false; |
| 349 | } |
| 350 | |
| 351 | return true; |
| 352 | } |
| 353 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 354 | static std::string EnumeratorString(VkMemoryHeapFlagBits const &enumerator) { |
| 355 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 356 | return "unrecognized enumerator"; |
| 357 | } |
| 358 | |
| 359 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 360 | if (enumerator & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) { |
Chia-I Wu | c8ea02f | 2015-10-27 18:53:22 +0800 | [diff] [blame] | 361 | strings.push_back("VK_MEMORY_HEAP_DEVICE_LOCAL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 362 | } |
| 363 | |
| 364 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 365 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 366 | enumeratorString += string; |
| 367 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 368 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 369 | enumeratorString += '|'; |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | return enumeratorString; |
| 374 | } |
| 375 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 376 | static bool ValidateEnumerator(VkSparseImageFormatFlagBits const &enumerator) { |
| 377 | VkSparseImageFormatFlagBits allFlags = |
| 378 | (VkSparseImageFormatFlagBits)(VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT | |
| 379 | VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT | VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT); |
| 380 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 381 | return false; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 382 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 383 | |
| 384 | return true; |
| 385 | } |
| 386 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 387 | static std::string EnumeratorString(VkSparseImageFormatFlagBits const &enumerator) { |
| 388 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 389 | return "unrecognized enumerator"; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 390 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 391 | |
| 392 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 393 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 394 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 395 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 396 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 397 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 398 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 399 | if (enumerator & VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT) { |
Chia-I Wu | 2bfb33c | 2015-10-26 17:24:52 +0800 | [diff] [blame] | 400 | strings.push_back("VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 401 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 402 | |
| 403 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 404 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 405 | enumeratorString += string; |
| 406 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 407 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 408 | enumeratorString += '|'; |
| 409 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 410 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 411 | |
| 412 | return enumeratorString; |
| 413 | } |
| 414 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 415 | static bool ValidateEnumerator(VkFenceCreateFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 416 | VkFenceCreateFlagBits allFlags = (VkFenceCreateFlagBits)(VK_FENCE_CREATE_SIGNALED_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 417 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 418 | return false; |
| 419 | } |
| 420 | |
| 421 | return true; |
| 422 | } |
| 423 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 424 | static std::string EnumeratorString(VkFenceCreateFlagBits const &enumerator) { |
| 425 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 426 | return "unrecognized enumerator"; |
| 427 | } |
| 428 | |
| 429 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 430 | if (enumerator & VK_FENCE_CREATE_SIGNALED_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 431 | strings.push_back("VK_FENCE_CREATE_SIGNALED_BIT"); |
| 432 | } |
| 433 | |
| 434 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 435 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 436 | enumeratorString += string; |
| 437 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 438 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 439 | enumeratorString += '|'; |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | return enumeratorString; |
| 444 | } |
| 445 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 446 | static bool ValidateEnumerator(VkQueryPipelineStatisticFlagBits const &enumerator) { |
| 447 | VkQueryPipelineStatisticFlagBits allFlags = (VkQueryPipelineStatisticFlagBits)( |
| 448 | VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT | VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT | |
| 449 | VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT | VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT | |
| 450 | VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT | VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT | |
| 451 | 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] | 452 | VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT | |
| 453 | VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT | |
| 454 | VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 455 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 456 | return false; |
| 457 | } |
| 458 | |
| 459 | return true; |
| 460 | } |
| 461 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 462 | static std::string EnumeratorString(VkQueryPipelineStatisticFlagBits const &enumerator) { |
| 463 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 464 | return "unrecognized enumerator"; |
| 465 | } |
| 466 | |
| 467 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 468 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 469 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 470 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 471 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 472 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 473 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 474 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 475 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 476 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 477 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 478 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 479 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 480 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 481 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 482 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 483 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 484 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 485 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 486 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 487 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 488 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 489 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 490 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 491 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 492 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 493 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 494 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 495 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 496 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 497 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 498 | if (enumerator & VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 499 | strings.push_back("VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 503 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 504 | enumeratorString += string; |
| 505 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 506 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 507 | enumeratorString += '|'; |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | return enumeratorString; |
| 512 | } |
| 513 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 514 | static bool ValidateEnumerator(VkQueryResultFlagBits const &enumerator) { |
| 515 | VkQueryResultFlagBits allFlags = (VkQueryResultFlagBits)(VK_QUERY_RESULT_PARTIAL_BIT | VK_QUERY_RESULT_WITH_AVAILABILITY_BIT | |
| 516 | VK_QUERY_RESULT_WAIT_BIT | VK_QUERY_RESULT_64_BIT); |
| 517 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 518 | return false; |
| 519 | } |
| 520 | |
| 521 | return true; |
| 522 | } |
| 523 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 524 | static std::string EnumeratorString(VkQueryResultFlagBits const &enumerator) { |
| 525 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 526 | return "unrecognized enumerator"; |
| 527 | } |
| 528 | |
| 529 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 530 | if (enumerator & VK_QUERY_RESULT_PARTIAL_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 531 | strings.push_back("VK_QUERY_RESULT_PARTIAL_BIT"); |
| 532 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 533 | if (enumerator & VK_QUERY_RESULT_WITH_AVAILABILITY_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 534 | strings.push_back("VK_QUERY_RESULT_WITH_AVAILABILITY_BIT"); |
| 535 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 536 | if (enumerator & VK_QUERY_RESULT_WAIT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 537 | strings.push_back("VK_QUERY_RESULT_WAIT_BIT"); |
| 538 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 539 | if (enumerator & VK_QUERY_RESULT_64_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 540 | strings.push_back("VK_QUERY_RESULT_64_BIT"); |
| 541 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 542 | |
| 543 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 544 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 545 | enumeratorString += string; |
| 546 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 547 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 548 | enumeratorString += '|'; |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | return enumeratorString; |
| 553 | } |
| 554 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 555 | static bool ValidateEnumerator(VkBufferUsageFlagBits const &enumerator) { |
| 556 | VkBufferUsageFlagBits allFlags = (VkBufferUsageFlagBits)( |
| 557 | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT | |
| 558 | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | |
| 559 | VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT); |
| 560 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 561 | return false; |
| 562 | } |
| 563 | |
| 564 | return true; |
| 565 | } |
| 566 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 567 | static std::string EnumeratorString(VkBufferUsageFlagBits const &enumerator) { |
| 568 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 569 | return "unrecognized enumerator"; |
| 570 | } |
| 571 | |
| 572 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 573 | if (enumerator & VK_BUFFER_USAGE_VERTEX_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 574 | strings.push_back("VK_BUFFER_USAGE_VERTEX_BUFFER_BIT"); |
| 575 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 576 | if (enumerator & VK_BUFFER_USAGE_INDEX_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 577 | strings.push_back("VK_BUFFER_USAGE_INDEX_BUFFER_BIT"); |
| 578 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 579 | if (enumerator & VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 580 | strings.push_back("VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT"); |
| 581 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 582 | if (enumerator & VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 583 | strings.push_back("VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT"); |
| 584 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 585 | if (enumerator & VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 586 | strings.push_back("VK_BUFFER_USAGE_STORAGE_BUFFER_BIT"); |
| 587 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 588 | if (enumerator & VK_BUFFER_USAGE_TRANSFER_DST_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 589 | strings.push_back("VK_BUFFER_USAGE_TRANSFER_DST_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 590 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 591 | if (enumerator & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 592 | strings.push_back("VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT"); |
| 593 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 594 | if (enumerator & VK_BUFFER_USAGE_TRANSFER_SRC_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 595 | strings.push_back("VK_BUFFER_USAGE_TRANSFER_SRC_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 596 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 597 | if (enumerator & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 598 | strings.push_back("VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT"); |
| 599 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 600 | |
| 601 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 602 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 603 | enumeratorString += string; |
| 604 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 605 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 606 | enumeratorString += '|'; |
| 607 | } |
| 608 | } |
| 609 | |
| 610 | return enumeratorString; |
| 611 | } |
| 612 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 613 | static bool ValidateEnumerator(VkBufferCreateFlagBits const &enumerator) { |
| 614 | VkBufferCreateFlagBits allFlags = (VkBufferCreateFlagBits)( |
| 615 | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT | VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT | VK_BUFFER_CREATE_SPARSE_BINDING_BIT); |
| 616 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 617 | return false; |
| 618 | } |
| 619 | |
| 620 | return true; |
| 621 | } |
| 622 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 623 | static std::string EnumeratorString(VkBufferCreateFlagBits const &enumerator) { |
| 624 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 625 | return "unrecognized enumerator"; |
| 626 | } |
| 627 | |
| 628 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 629 | if (enumerator & VK_BUFFER_CREATE_SPARSE_ALIASED_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 630 | strings.push_back("VK_BUFFER_CREATE_SPARSE_ALIASED_BIT"); |
| 631 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 632 | if (enumerator & VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 633 | strings.push_back("VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT"); |
| 634 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 635 | if (enumerator & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) { |
Courtney Goeltzenleuchter | 8134da0 | 2015-09-10 17:00:22 -0600 | [diff] [blame] | 636 | strings.push_back("VK_BUFFER_CREATE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 637 | } |
| 638 | |
| 639 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 640 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 641 | enumeratorString += string; |
| 642 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 643 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 644 | enumeratorString += '|'; |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | return enumeratorString; |
| 649 | } |
| 650 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 651 | static bool ValidateEnumerator(VkImageCreateFlagBits const &enumerator) { |
| 652 | VkImageCreateFlagBits allFlags = (VkImageCreateFlagBits)( |
| 653 | VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | |
| 654 | VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_SPARSE_BINDING_BIT); |
| 655 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 656 | return false; |
| 657 | } |
| 658 | |
| 659 | return true; |
| 660 | } |
| 661 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 662 | static std::string EnumeratorString(VkImageCreateFlagBits const &enumerator) { |
| 663 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 664 | return "unrecognized enumerator"; |
| 665 | } |
| 666 | |
| 667 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 668 | if (enumerator & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 669 | strings.push_back("VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT"); |
| 670 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 671 | if (enumerator & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 672 | strings.push_back("VK_IMAGE_CREATE_SPARSE_ALIASED_BIT"); |
| 673 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 674 | if (enumerator & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 675 | strings.push_back("VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT"); |
| 676 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 677 | if (enumerator & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 678 | strings.push_back("VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT"); |
| 679 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 680 | if (enumerator & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) { |
Courtney Goeltzenleuchter | 8134da0 | 2015-09-10 17:00:22 -0600 | [diff] [blame] | 681 | strings.push_back("VK_IMAGE_CREATE_SPARSE_BINDING_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 682 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 683 | |
| 684 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 685 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 686 | enumeratorString += string; |
| 687 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 688 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 689 | enumeratorString += '|'; |
| 690 | } |
| 691 | } |
| 692 | |
| 693 | return enumeratorString; |
| 694 | } |
| 695 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 696 | static bool ValidateEnumerator(VkColorComponentFlagBits const &enumerator) { |
| 697 | VkColorComponentFlagBits allFlags = (VkColorComponentFlagBits)(VK_COLOR_COMPONENT_A_BIT | VK_COLOR_COMPONENT_B_BIT | |
| 698 | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_R_BIT); |
| 699 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 700 | return false; |
| 701 | } |
| 702 | |
| 703 | return true; |
| 704 | } |
| 705 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 706 | static std::string EnumeratorString(VkColorComponentFlagBits const &enumerator) { |
| 707 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 708 | return "unrecognized enumerator"; |
| 709 | } |
| 710 | |
| 711 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 712 | if (enumerator & VK_COLOR_COMPONENT_A_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 713 | strings.push_back("VK_COLOR_COMPONENT_A_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 714 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 715 | if (enumerator & VK_COLOR_COMPONENT_B_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 716 | strings.push_back("VK_COLOR_COMPONENT_B_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 717 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 718 | if (enumerator & VK_COLOR_COMPONENT_G_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 719 | strings.push_back("VK_COLOR_COMPONENT_G_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 720 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 721 | if (enumerator & VK_COLOR_COMPONENT_R_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 722 | strings.push_back("VK_COLOR_COMPONENT_R_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 723 | } |
| 724 | |
| 725 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 726 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 727 | enumeratorString += string; |
| 728 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 729 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 730 | enumeratorString += '|'; |
| 731 | } |
| 732 | } |
| 733 | |
| 734 | return enumeratorString; |
| 735 | } |
| 736 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 737 | static bool ValidateEnumerator(VkPipelineCreateFlagBits const &enumerator) { |
| 738 | VkPipelineCreateFlagBits allFlags = (VkPipelineCreateFlagBits)( |
| 739 | VK_PIPELINE_CREATE_DERIVATIVE_BIT | VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT | VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT); |
| 740 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 741 | return false; |
| 742 | } |
| 743 | |
| 744 | return true; |
| 745 | } |
| 746 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 747 | static std::string EnumeratorString(VkPipelineCreateFlagBits const &enumerator) { |
| 748 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 749 | return "unrecognized enumerator"; |
| 750 | } |
| 751 | |
| 752 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 753 | if (enumerator & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 754 | strings.push_back("VK_PIPELINE_CREATE_DERIVATIVE_BIT"); |
| 755 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 756 | if (enumerator & VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 757 | strings.push_back("VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT"); |
| 758 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 759 | if (enumerator & VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 760 | strings.push_back("VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 761 | } |
| 762 | |
| 763 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 764 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 765 | enumeratorString += string; |
| 766 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 767 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 768 | enumeratorString += '|'; |
| 769 | } |
| 770 | } |
| 771 | |
| 772 | return enumeratorString; |
| 773 | } |
| 774 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 775 | static bool ValidateEnumerator(VkShaderStageFlagBits const &enumerator) { |
| 776 | VkShaderStageFlagBits allFlags = (VkShaderStageFlagBits)( |
| 777 | VK_SHADER_STAGE_ALL | VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_GEOMETRY_BIT | VK_SHADER_STAGE_COMPUTE_BIT | |
| 778 | VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT | VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT | VK_SHADER_STAGE_VERTEX_BIT); |
| 779 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 780 | return false; |
| 781 | } |
| 782 | |
| 783 | return true; |
| 784 | } |
| 785 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 786 | static std::string EnumeratorString(VkShaderStageFlagBits const &enumerator) { |
| 787 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 788 | return "unrecognized enumerator"; |
| 789 | } |
| 790 | |
| 791 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 792 | if (enumerator & VK_SHADER_STAGE_ALL) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 793 | strings.push_back("VK_SHADER_STAGE_ALL"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 794 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 795 | if (enumerator & VK_SHADER_STAGE_FRAGMENT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 796 | strings.push_back("VK_SHADER_STAGE_FRAGMENT_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 797 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 798 | if (enumerator & VK_SHADER_STAGE_GEOMETRY_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 799 | strings.push_back("VK_SHADER_STAGE_GEOMETRY_BIT"); |
| 800 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 801 | if (enumerator & VK_SHADER_STAGE_COMPUTE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 802 | strings.push_back("VK_SHADER_STAGE_COMPUTE_BIT"); |
| 803 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 804 | if (enumerator & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 805 | strings.push_back("VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 806 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 807 | if (enumerator & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 808 | strings.push_back("VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 809 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 810 | if (enumerator & VK_SHADER_STAGE_VERTEX_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 811 | strings.push_back("VK_SHADER_STAGE_VERTEX_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 812 | } |
| 813 | |
| 814 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 815 | for (auto const &string : strings) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 816 | enumeratorString += string; |
| 817 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 818 | if (string != strings.back()) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 819 | enumeratorString += '|'; |
| 820 | } |
| 821 | } |
| 822 | |
| 823 | return enumeratorString; |
| 824 | } |
| 825 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 826 | static bool ValidateEnumerator(VkPipelineStageFlagBits const &enumerator) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 827 | VkPipelineStageFlagBits allFlags = (VkPipelineStageFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 828 | VK_PIPELINE_STAGE_ALL_COMMANDS_BIT | VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | VK_PIPELINE_STAGE_HOST_BIT | |
| 829 | VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | |
| 830 | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | |
| 831 | VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | |
| 832 | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT | |
| 833 | 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] | 834 | VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 835 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 836 | return false; |
| 837 | } |
| 838 | |
| 839 | return true; |
| 840 | } |
| 841 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 842 | static std::string EnumeratorString(VkPipelineStageFlagBits const &enumerator) { |
| 843 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 844 | return "unrecognized enumerator"; |
| 845 | } |
| 846 | |
| 847 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 848 | if (enumerator & VK_PIPELINE_STAGE_ALL_COMMANDS_BIT) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 849 | strings.push_back("VK_PIPELINE_STAGE_ALL_COMMANDS_BIT"); |
| 850 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 851 | if (enumerator & VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT) { |
Chia-I Wu | 89d0f94 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 852 | strings.push_back("VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 853 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 854 | if (enumerator & VK_PIPELINE_STAGE_HOST_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 855 | strings.push_back("VK_PIPELINE_STAGE_HOST_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 856 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 857 | if (enumerator & VK_PIPELINE_STAGE_TRANSFER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 858 | strings.push_back("VK_PIPELINE_STAGE_TRANSFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 859 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 860 | if (enumerator & VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 861 | strings.push_back("VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 862 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 863 | if (enumerator & VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT) { |
Jon Ashburn | 4bf8ba4 | 2015-12-31 12:14:37 -0700 | [diff] [blame] | 864 | strings.push_back("VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 865 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 866 | if (enumerator & VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 867 | strings.push_back("VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 868 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 869 | if (enumerator & VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 870 | strings.push_back("VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 871 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 872 | if (enumerator & VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT) { |
Courtney Goeltzenleuchter | 9683589 | 2015-10-15 17:35:38 -0600 | [diff] [blame] | 873 | strings.push_back("VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 874 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 875 | if (enumerator & VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 876 | strings.push_back("VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 877 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 878 | if (enumerator & VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 879 | strings.push_back("VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT"); |
| 880 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 881 | if (enumerator & VK_PIPELINE_STAGE_VERTEX_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 882 | strings.push_back("VK_PIPELINE_STAGE_VERTEX_SHADER_BIT"); |
| 883 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 884 | if (enumerator & VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 885 | strings.push_back("VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 886 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 887 | if (enumerator & VK_PIPELINE_STAGE_VERTEX_INPUT_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 888 | strings.push_back("VK_PIPELINE_STAGE_VERTEX_INPUT_BIT"); |
| 889 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 890 | if (enumerator & VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 891 | strings.push_back("VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT"); |
| 892 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 893 | if (enumerator & VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 894 | strings.push_back("VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT"); |
| 895 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 896 | if (enumerator & VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 897 | strings.push_back("VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 898 | } |
| 899 | |
| 900 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 901 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 902 | enumeratorString += string; |
| 903 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 904 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 905 | enumeratorString += '|'; |
| 906 | } |
| 907 | } |
| 908 | |
| 909 | return enumeratorString; |
| 910 | } |
| 911 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 912 | static bool ValidateEnumerator(VkAccessFlagBits const &enumerator) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 913 | VkAccessFlagBits allFlags = (VkAccessFlagBits)( |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 914 | VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_INDEX_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | |
| 915 | VK_ACCESS_UNIFORM_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT | VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT | |
| 916 | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | |
| 917 | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT | |
| 918 | 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] | 919 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 920 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 921 | return false; |
| 922 | } |
| 923 | |
| 924 | return true; |
| 925 | } |
| 926 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 927 | static std::string EnumeratorString(VkAccessFlagBits const &enumerator) { |
| 928 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 929 | return "unrecognized enumerator"; |
| 930 | } |
| 931 | |
| 932 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 933 | if (enumerator & VK_ACCESS_INDIRECT_COMMAND_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 934 | strings.push_back("VK_ACCESS_INDIRECT_COMMAND_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 935 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 936 | if (enumerator & VK_ACCESS_INDEX_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 937 | strings.push_back("VK_ACCESS_INDEX_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 938 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 939 | if (enumerator & VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 940 | strings.push_back("VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 941 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 942 | if (enumerator & VK_ACCESS_UNIFORM_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 943 | strings.push_back("VK_ACCESS_UNIFORM_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 944 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 945 | if (enumerator & VK_ACCESS_INPUT_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 946 | strings.push_back("VK_ACCESS_INPUT_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 947 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 948 | if (enumerator & VK_ACCESS_SHADER_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 949 | strings.push_back("VK_ACCESS_SHADER_READ_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 950 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 951 | if (enumerator & VK_ACCESS_SHADER_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 952 | strings.push_back("VK_ACCESS_SHADER_WRITE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 953 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 954 | if (enumerator & VK_ACCESS_COLOR_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 955 | strings.push_back("VK_ACCESS_COLOR_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 956 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 957 | if (enumerator & VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 958 | strings.push_back("VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 959 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 960 | if (enumerator & VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 961 | strings.push_back("VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 962 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 963 | if (enumerator & VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 964 | strings.push_back("VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 965 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 966 | if (enumerator & VK_ACCESS_TRANSFER_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 967 | strings.push_back("VK_ACCESS_TRANSFER_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 968 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 969 | if (enumerator & VK_ACCESS_TRANSFER_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 970 | strings.push_back("VK_ACCESS_TRANSFER_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 971 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 972 | if (enumerator & VK_ACCESS_HOST_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 973 | strings.push_back("VK_ACCESS_HOST_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 974 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 975 | if (enumerator & VK_ACCESS_HOST_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 976 | strings.push_back("VK_ACCESS_HOST_WRITE_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 977 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 978 | if (enumerator & VK_ACCESS_MEMORY_READ_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 979 | strings.push_back("VK_ACCESS_MEMORY_READ_BIT"); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 980 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 981 | if (enumerator & VK_ACCESS_MEMORY_WRITE_BIT) { |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 982 | strings.push_back("VK_ACCESS_MEMORY_WRITE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 983 | } |
| 984 | |
| 985 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 986 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 987 | enumeratorString += string; |
| 988 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 989 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 990 | enumeratorString += '|'; |
| 991 | } |
| 992 | } |
| 993 | |
| 994 | return enumeratorString; |
| 995 | } |
| 996 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 997 | static bool ValidateEnumerator(VkCommandPoolCreateFlagBits const &enumerator) { |
| 998 | VkCommandPoolCreateFlagBits allFlags = |
| 999 | (VkCommandPoolCreateFlagBits)(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT | VK_COMMAND_POOL_CREATE_TRANSIENT_BIT); |
| 1000 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1001 | return false; |
| 1002 | } |
| 1003 | |
| 1004 | return true; |
| 1005 | } |
| 1006 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1007 | static std::string EnumeratorString(VkCommandPoolCreateFlagBits const &enumerator) { |
| 1008 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1009 | return "unrecognized enumerator"; |
| 1010 | } |
| 1011 | |
| 1012 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1013 | if (enumerator & VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1014 | strings.push_back("VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1015 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1016 | if (enumerator & VK_COMMAND_POOL_CREATE_TRANSIENT_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1017 | strings.push_back("VK_COMMAND_POOL_CREATE_TRANSIENT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1018 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1019 | |
| 1020 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1021 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1022 | enumeratorString += string; |
| 1023 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1024 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1025 | enumeratorString += '|'; |
| 1026 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1027 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1028 | |
| 1029 | return enumeratorString; |
| 1030 | } |
| 1031 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1032 | static bool ValidateEnumerator(VkCommandPoolResetFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1033 | VkCommandPoolResetFlagBits allFlags = (VkCommandPoolResetFlagBits)(VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1034 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1035 | return false; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1036 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1037 | |
| 1038 | return true; |
| 1039 | } |
| 1040 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1041 | static std::string EnumeratorString(VkCommandPoolResetFlagBits const &enumerator) { |
| 1042 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1043 | return "unrecognized enumerator"; |
| 1044 | } |
| 1045 | |
| 1046 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1047 | if (enumerator & VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1048 | strings.push_back("VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1049 | } |
| 1050 | |
| 1051 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1052 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1053 | enumeratorString += string; |
| 1054 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1055 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1056 | enumeratorString += '|'; |
| 1057 | } |
| 1058 | } |
| 1059 | |
| 1060 | return enumeratorString; |
| 1061 | } |
| 1062 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1063 | static bool ValidateEnumerator(VkCommandBufferUsageFlags const &enumerator) { |
| 1064 | VkCommandBufferUsageFlags allFlags = |
| 1065 | (VkCommandBufferUsageFlags)(VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT | VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT | |
| 1066 | VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT); |
| 1067 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1068 | return false; |
| 1069 | } |
| 1070 | |
| 1071 | return true; |
| 1072 | } |
| 1073 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1074 | static std::string EnumeratorString(VkCommandBufferUsageFlags const &enumerator) { |
| 1075 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1076 | return "unrecognized enumerator"; |
| 1077 | } |
| 1078 | |
| 1079 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1080 | if (enumerator & VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1081 | strings.push_back("VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1082 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1083 | if (enumerator & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1084 | strings.push_back("VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1085 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1086 | if (enumerator & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1087 | strings.push_back("VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1088 | } |
| 1089 | |
| 1090 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1091 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1092 | enumeratorString += string; |
| 1093 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1094 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1095 | enumeratorString += '|'; |
| 1096 | } |
| 1097 | } |
| 1098 | |
| 1099 | return enumeratorString; |
| 1100 | } |
| 1101 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1102 | static bool ValidateEnumerator(VkCommandBufferResetFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1103 | VkCommandBufferResetFlagBits allFlags = (VkCommandBufferResetFlagBits)(VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1104 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1105 | return false; |
| 1106 | } |
| 1107 | |
| 1108 | return true; |
| 1109 | } |
| 1110 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1111 | static std::string EnumeratorString(VkCommandBufferResetFlagBits const &enumerator) { |
| 1112 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1113 | return "unrecognized enumerator"; |
| 1114 | } |
| 1115 | |
| 1116 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1117 | if (enumerator & VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1118 | strings.push_back("VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT"); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1119 | } |
| 1120 | |
| 1121 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1122 | for (auto const &string : strings) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1123 | enumeratorString += string; |
| 1124 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1125 | if (string != strings.back()) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1126 | enumeratorString += '|'; |
| 1127 | } |
| 1128 | } |
| 1129 | |
| 1130 | return enumeratorString; |
| 1131 | } |
| 1132 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1133 | static bool ValidateEnumerator(VkImageAspectFlagBits const &enumerator) { |
| 1134 | VkImageAspectFlagBits allFlags = (VkImageAspectFlagBits)(VK_IMAGE_ASPECT_METADATA_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 1135 | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_COLOR_BIT); |
| 1136 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1137 | return false; |
| 1138 | } |
| 1139 | |
| 1140 | return true; |
| 1141 | } |
| 1142 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1143 | static std::string EnumeratorString(VkImageAspectFlagBits const &enumerator) { |
| 1144 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1145 | return "unrecognized enumerator"; |
| 1146 | } |
| 1147 | |
| 1148 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1149 | if (enumerator & VK_IMAGE_ASPECT_METADATA_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1150 | strings.push_back("VK_IMAGE_ASPECT_METADATA_BIT"); |
| 1151 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1152 | if (enumerator & VK_IMAGE_ASPECT_STENCIL_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1153 | strings.push_back("VK_IMAGE_ASPECT_STENCIL_BIT"); |
| 1154 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1155 | if (enumerator & VK_IMAGE_ASPECT_DEPTH_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1156 | strings.push_back("VK_IMAGE_ASPECT_DEPTH_BIT"); |
| 1157 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1158 | if (enumerator & VK_IMAGE_ASPECT_COLOR_BIT) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1159 | strings.push_back("VK_IMAGE_ASPECT_COLOR_BIT"); |
| 1160 | } |
| 1161 | |
| 1162 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1163 | for (auto const &string : strings) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1164 | enumeratorString += string; |
| 1165 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1166 | if (string != strings.back()) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1167 | enumeratorString += '|'; |
| 1168 | } |
| 1169 | } |
| 1170 | |
| 1171 | return enumeratorString; |
| 1172 | } |
| 1173 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1174 | static bool ValidateEnumerator(VkQueryControlFlagBits const &enumerator) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1175 | VkQueryControlFlagBits allFlags = (VkQueryControlFlagBits)(VK_QUERY_CONTROL_PRECISE_BIT); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1176 | if (enumerator & (~allFlags)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1177 | return false; |
| 1178 | } |
| 1179 | |
| 1180 | return true; |
| 1181 | } |
| 1182 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1183 | static std::string EnumeratorString(VkQueryControlFlagBits const &enumerator) { |
| 1184 | if (!ValidateEnumerator(enumerator)) { |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1185 | return "unrecognized enumerator"; |
| 1186 | } |
| 1187 | |
| 1188 | std::vector<std::string> strings; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1189 | if (enumerator & VK_QUERY_CONTROL_PRECISE_BIT) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 1190 | strings.push_back("VK_QUERY_CONTROL_PRECISE_BIT"); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1191 | } |
| 1192 | |
| 1193 | std::string enumeratorString; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1194 | for (auto const &string : strings) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1195 | enumeratorString += string; |
| 1196 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1197 | if (string != strings.back()) { |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1198 | enumeratorString += '|'; |
| 1199 | } |
| 1200 | } |
| 1201 | |
| 1202 | return enumeratorString; |
| 1203 | } |
| 1204 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1205 | static const int MaxParamCheckerStringLength = 256; |
| 1206 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 1207 | static bool validate_string(debug_report_data *report_data, const char *apiName, const ParameterName &stringName, |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 1208 | const char *validateString) { |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1209 | assert(apiName != nullptr); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1210 | assert(validateString != nullptr); |
| 1211 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1212 | bool skip_call = false; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1213 | |
| 1214 | VkStringErrorFlags result = vk_string_validate(MaxParamCheckerStringLength, validateString); |
| 1215 | |
| 1216 | if (result == VK_STRING_ERROR_NONE) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1217 | return skip_call; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1218 | } else if (result & VK_STRING_ERROR_LENGTH) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 1219 | |
| 1220 | skip_call = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 1221 | INVALID_USAGE, LayerName, "%s: string %s exceeds max length %d", apiName, stringName.get_name().c_str(), |
| 1222 | MaxParamCheckerStringLength); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1223 | } else if (result & VK_STRING_ERROR_BAD_DATA) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 1224 | skip_call = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 1225 | INVALID_USAGE, LayerName, "%s: string %s contains invalid characters or is badly formed", apiName, |
| 1226 | stringName.get_name().c_str()); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1227 | } |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1228 | return skip_call; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1229 | } |
| 1230 | |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1231 | static bool validate_queue_family_index(layer_data *device_data, const char *function_name, const char *parameter_name, |
| 1232 | uint32_t index) { |
| 1233 | assert(device_data != nullptr); |
| 1234 | debug_report_data *report_data = device_data->report_data; |
| 1235 | bool skip_call = false; |
| 1236 | |
| 1237 | if (index == VK_QUEUE_FAMILY_IGNORED) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1238 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 1239 | "%s: %s cannot be VK_QUEUE_FAMILY_IGNORED.", function_name, parameter_name); |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1240 | } else { |
| 1241 | const auto &queue_data = device_data->queueFamilyIndexMap.find(index); |
| 1242 | if (queue_data == device_data->queueFamilyIndexMap.end()) { |
| 1243 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1244 | LayerName, "%s: %s (%d) must be one of the indices specified when the device was created, via " |
| 1245 | "the VkDeviceQueueCreateInfo structure.", |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1246 | function_name, parameter_name, index); |
| 1247 | return false; |
| 1248 | } |
| 1249 | } |
| 1250 | |
| 1251 | return skip_call; |
| 1252 | } |
| 1253 | |
| 1254 | static bool validate_queue_family_indices(layer_data *device_data, const char *function_name, const char *parameter_name, |
| 1255 | const uint32_t count, const uint32_t *indices) { |
| 1256 | assert(device_data != nullptr); |
| 1257 | debug_report_data *report_data = device_data->report_data; |
| 1258 | bool skip_call = false; |
| 1259 | |
| 1260 | if (indices != nullptr) { |
| 1261 | for (uint32_t i = 0; i < count; i++) { |
| 1262 | if (indices[i] == VK_QUEUE_FAMILY_IGNORED) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1263 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 1264 | LayerName, "%s: %s[%d] cannot be VK_QUEUE_FAMILY_IGNORED.", function_name, parameter_name, i); |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1265 | } else { |
| 1266 | const auto &queue_data = device_data->queueFamilyIndexMap.find(indices[i]); |
| 1267 | if (queue_data == device_data->queueFamilyIndexMap.end()) { |
| 1268 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1269 | LayerName, "%s: %s[%d] (%d) must be one of the indices specified when the device was " |
| 1270 | "created, via the VkDeviceQueueCreateInfo structure.", |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1271 | function_name, parameter_name, i, indices[i]); |
| 1272 | return false; |
| 1273 | } |
| 1274 | } |
| 1275 | } |
| 1276 | } |
| 1277 | |
| 1278 | return skip_call; |
| 1279 | } |
| 1280 | |
Mark Lobodzinski | 7d80ef6 | 2016-08-15 16:22:50 -0600 | [diff] [blame] | 1281 | static void CheckInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance); |
| 1282 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1283 | VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 1284 | VkInstance *pInstance) { |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1285 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1286 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1287 | VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1288 | assert(chain_info != nullptr); |
| 1289 | assert(chain_info->u.pLayerInfo != nullptr); |
| 1290 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1291 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 1292 | PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)fpGetInstanceProcAddr(NULL, "vkCreateInstance"); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1293 | if (fpCreateInstance == NULL) { |
| 1294 | return VK_ERROR_INITIALIZATION_FAILED; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1295 | } |
| 1296 | |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1297 | // Advance the link info for the next element on the chain |
| 1298 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 1299 | |
| 1300 | result = fpCreateInstance(pCreateInfo, pAllocator, pInstance); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1301 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1302 | if (result == VK_SUCCESS) { |
| 1303 | layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map); |
| 1304 | assert(my_instance_data != nullptr); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1305 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1306 | VkLayerInstanceDispatchTable *pTable = initInstanceTable(*pInstance, fpGetInstanceProcAddr, pc_instance_table_map); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1307 | |
Chia-I Wu | a570b7c | 2016-05-16 07:48:14 +0800 | [diff] [blame] | 1308 | my_instance_data->instance = *pInstance; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1309 | my_instance_data->report_data = debug_report_create_instance(pTable, *pInstance, pCreateInfo->enabledExtensionCount, |
| 1310 | pCreateInfo->ppEnabledExtensionNames); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1311 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1312 | // Look for one or more debug report create info structures |
| 1313 | // and setup a callback(s) for each one found. |
| 1314 | if (!layer_copy_tmp_callbacks(pCreateInfo->pNext, &my_instance_data->num_tmp_callbacks, |
| 1315 | &my_instance_data->tmp_dbg_create_infos, &my_instance_data->tmp_callbacks)) { |
| 1316 | if (my_instance_data->num_tmp_callbacks > 0) { |
| 1317 | // Setup the temporary callback(s) here to catch early issues: |
| 1318 | if (layer_enable_tmp_callbacks(my_instance_data->report_data, my_instance_data->num_tmp_callbacks, |
| 1319 | my_instance_data->tmp_dbg_create_infos, my_instance_data->tmp_callbacks)) { |
| 1320 | // Failure of setting up one or more of the callback. |
| 1321 | // Therefore, clean up and don't use those callbacks: |
| 1322 | layer_free_tmp_callbacks(my_instance_data->tmp_dbg_create_infos, my_instance_data->tmp_callbacks); |
| 1323 | my_instance_data->num_tmp_callbacks = 0; |
| 1324 | } |
| 1325 | } |
| 1326 | } |
| 1327 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1328 | init_parameter_validation(my_instance_data, pAllocator); |
Mark Lobodzinski | 7d80ef6 | 2016-08-15 16:22:50 -0600 | [diff] [blame] | 1329 | CheckInstanceRegisterExtensions(pCreateInfo, *pInstance); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1330 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1331 | // Ordinarily we'd check these before calling down the chain, but none of the layer |
| 1332 | // support is in place until now, if we survive we can report the issue now. |
| 1333 | parameter_validation_vkCreateInstance(my_instance_data->report_data, pCreateInfo, pAllocator, pInstance); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1334 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1335 | if (pCreateInfo->pApplicationInfo) { |
| 1336 | if (pCreateInfo->pApplicationInfo->pApplicationName) { |
| 1337 | validate_string(my_instance_data->report_data, "vkCreateInstance", |
| 1338 | "pCreateInfo->VkApplicationInfo->pApplicationName", |
| 1339 | pCreateInfo->pApplicationInfo->pApplicationName); |
| 1340 | } |
Courtney Goeltzenleuchter | 842691b | 2016-02-10 14:00:52 -0700 | [diff] [blame] | 1341 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1342 | if (pCreateInfo->pApplicationInfo->pEngineName) { |
| 1343 | validate_string(my_instance_data->report_data, "vkCreateInstance", "pCreateInfo->VkApplicationInfo->pEngineName", |
| 1344 | pCreateInfo->pApplicationInfo->pEngineName); |
| 1345 | } |
Courtney Goeltzenleuchter | 41c5c4b | 2016-02-10 15:13:55 -0700 | [diff] [blame] | 1346 | } |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1347 | |
| 1348 | // Disable the tmp callbacks: |
| 1349 | if (my_instance_data->num_tmp_callbacks > 0) { |
| 1350 | layer_disable_tmp_callbacks(my_instance_data->report_data, my_instance_data->num_tmp_callbacks, |
| 1351 | my_instance_data->tmp_callbacks); |
| 1352 | } |
Courtney Goeltzenleuchter | 842691b | 2016-02-10 14:00:52 -0700 | [diff] [blame] | 1353 | } |
| 1354 | |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1355 | return result; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1356 | } |
| 1357 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1358 | VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1359 | // Grab the key before the instance is destroyed. |
| 1360 | dispatch_key key = get_dispatch_key(instance); |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1361 | bool skip_call = false; |
Courtney Goeltzenleuchter | d29f4f0 | 2015-10-05 15:59:45 -0600 | [diff] [blame] | 1362 | layer_data *my_data = get_my_data_ptr(key, layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1363 | assert(my_data != NULL); |
| 1364 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1365 | // Enable the temporary callback(s) here to catch vkDestroyInstance issues: |
| 1366 | bool callback_setup = false; |
| 1367 | if (my_data->num_tmp_callbacks > 0) { |
| 1368 | if (!layer_enable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_dbg_create_infos, |
| 1369 | my_data->tmp_callbacks)) { |
| 1370 | callback_setup = true; |
| 1371 | } |
| 1372 | } |
| 1373 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1374 | skip_call |= parameter_validation_vkDestroyInstance(my_data->report_data, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1375 | |
Ian Elliott | ed6b5ac | 2016-04-28 09:08:13 -0600 | [diff] [blame] | 1376 | // Disable and cleanup the temporary callback(s): |
| 1377 | if (callback_setup) { |
| 1378 | layer_disable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_callbacks); |
| 1379 | } |
| 1380 | if (my_data->num_tmp_callbacks > 0) { |
| 1381 | layer_free_tmp_callbacks(my_data->tmp_dbg_create_infos, my_data->tmp_callbacks); |
| 1382 | my_data->num_tmp_callbacks = 0; |
| 1383 | } |
| 1384 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1385 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1386 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1387 | pTable->DestroyInstance(instance, pAllocator); |
| 1388 | |
| 1389 | // Clean up logging callback, if any |
| 1390 | while (my_data->logging_callback.size() > 0) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1391 | VkDebugReportCallbackEXT callback = my_data->logging_callback.back(); |
| 1392 | layer_destroy_msg_callback(my_data->report_data, callback, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1393 | my_data->logging_callback.pop_back(); |
| 1394 | } |
| 1395 | |
Chris Forbes | 78a56b0 | 2016-11-02 16:13:01 +1300 | [diff] [blame] | 1396 | layer_debug_report_destroy_instance(my_data->report_data); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1397 | layer_data_map.erase(pTable); |
| 1398 | |
| 1399 | pc_instance_table_map.erase(key); |
Tony Barbour | 24edb7c | 2016-03-22 13:23:24 -0600 | [diff] [blame] | 1400 | layer_data_map.erase(key); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1401 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1402 | } |
| 1403 | |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 1404 | VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, |
| 1405 | VkPhysicalDevice *pPhysicalDevices) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1406 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1407 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1408 | 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] | 1409 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1410 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1411 | skip_call |= parameter_validation_vkEnumeratePhysicalDevices(my_data->report_data, pPhysicalDeviceCount, pPhysicalDevices); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1412 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1413 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1414 | result = get_dispatch_table(pc_instance_table_map, instance) |
| 1415 | ->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1416 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1417 | validate_result(my_data->report_data, "vkEnumeratePhysicalDevices", result); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 1418 | if ((result == VK_SUCCESS) && (NULL != pPhysicalDevices)) { |
| 1419 | for (uint32_t i = 0; i < *pPhysicalDeviceCount; i++) { |
| 1420 | layer_data *phy_dev_data = get_my_data_ptr(get_dispatch_key(pPhysicalDevices[i]), layer_data_map); |
| 1421 | // Save the supported features for each physical device |
| 1422 | VkLayerInstanceDispatchTable *disp_table = get_dispatch_table(pc_instance_table_map, pPhysicalDevices[i]); |
| 1423 | disp_table->GetPhysicalDeviceFeatures(pPhysicalDevices[i], &(phy_dev_data->physical_device_features)); |
| 1424 | } |
| 1425 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1426 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1427 | return result; |
| 1428 | } |
| 1429 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1430 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) { |
| 1431 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1432 | 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] | 1433 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1434 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1435 | skip_call |= parameter_validation_vkGetPhysicalDeviceFeatures(my_data->report_data, pFeatures); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1436 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1437 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1438 | get_dispatch_table(pc_instance_table_map, physicalDevice)->GetPhysicalDeviceFeatures(physicalDevice, pFeatures); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1439 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1440 | } |
| 1441 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1442 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 1443 | VkFormatProperties *pFormatProperties) { |
| 1444 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1445 | 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] | 1446 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1447 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1448 | skip_call |= parameter_validation_vkGetPhysicalDeviceFormatProperties(my_data->report_data, format, pFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1449 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1450 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1451 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1452 | ->GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1453 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1454 | } |
| 1455 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1456 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 1457 | VkImageType type, VkImageTiling tiling, |
| 1458 | VkImageUsageFlags usage, VkImageCreateFlags flags, |
| 1459 | VkImageFormatProperties *pImageFormatProperties) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1460 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1461 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1462 | 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] | 1463 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1464 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1465 | skip_call |= parameter_validation_vkGetPhysicalDeviceImageFormatProperties(my_data->report_data, format, type, tiling, usage, |
| 1466 | flags, pImageFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1467 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1468 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1469 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1470 | ->GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, |
| 1471 | pImageFormatProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1472 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1473 | validate_result(my_data->report_data, "vkGetPhysicalDeviceImageFormatProperties", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1474 | } |
Chia-I Wu | 1724104 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 1475 | |
| 1476 | return result; |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1477 | } |
| 1478 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1479 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) { |
| 1480 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1481 | 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] | 1482 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1483 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1484 | skip_call |= parameter_validation_vkGetPhysicalDeviceProperties(my_data->report_data, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1485 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1486 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1487 | get_dispatch_table(pc_instance_table_map, physicalDevice)->GetPhysicalDeviceProperties(physicalDevice, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1488 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1489 | } |
| 1490 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1491 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, |
| 1492 | uint32_t *pQueueFamilyPropertyCount, |
| 1493 | VkQueueFamilyProperties *pQueueFamilyProperties) { |
| 1494 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1495 | 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] | 1496 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1497 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1498 | skip_call |= parameter_validation_vkGetPhysicalDeviceQueueFamilyProperties(my_data->report_data, pQueueFamilyPropertyCount, |
| 1499 | pQueueFamilyProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1500 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1501 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1502 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1503 | ->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1504 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1505 | } |
| 1506 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1507 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, |
| 1508 | VkPhysicalDeviceMemoryProperties *pMemoryProperties) { |
| 1509 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1510 | 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] | 1511 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1512 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1513 | skip_call |= parameter_validation_vkGetPhysicalDeviceMemoryProperties(my_data->report_data, pMemoryProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1514 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1515 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1516 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 1517 | ->GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1518 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 1519 | } |
| 1520 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1521 | void validateDeviceCreateInfo(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
| 1522 | const std::vector<VkQueueFamilyProperties> properties) { |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 1523 | std::unordered_set<uint32_t> set; |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1524 | |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1525 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 1526 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 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)) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1530 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1531 | INVALID_USAGE, LayerName, |
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)) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1543 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1544 | __LINE__, INVALID_USAGE, LayerName, |
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( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1554 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1555 | INVALID_USAGE, LayerName, |
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( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1562 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1563 | INVALID_USAGE, LayerName, |
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 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1572 | static void CheckInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1573 | VkLayerInstanceDispatchTable *dispatch_table = get_dispatch_table(pc_instance_table_map, instance); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1574 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1575 | instance_extension_map[dispatch_table] = {}; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1576 | |
| 1577 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
| 1578 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1579 | instance_extension_map[dispatch_table].wsi_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1580 | } |
| 1581 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 1582 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1583 | instance_extension_map[dispatch_table].xlib_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1584 | } |
| 1585 | #endif |
| 1586 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 1587 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1588 | instance_extension_map[dispatch_table].xcb_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1589 | } |
| 1590 | #endif |
| 1591 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 1592 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1593 | instance_extension_map[dispatch_table].wayland_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1594 | } |
| 1595 | #endif |
| 1596 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 1597 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1598 | instance_extension_map[dispatch_table].mir_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1599 | } |
| 1600 | #endif |
| 1601 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 1602 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1603 | instance_extension_map[dispatch_table].android_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1604 | } |
| 1605 | #endif |
| 1606 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 1607 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1608 | instance_extension_map[dispatch_table].win32_enabled = true; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1609 | } |
| 1610 | #endif |
| 1611 | } |
| 1612 | } |
| 1613 | |
| 1614 | static void CheckDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, VkDevice device) { |
| 1615 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1616 | device_data->wsi_enabled = false; |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 1617 | device_data->wsi_display_swapchain_enabled = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1618 | |
| 1619 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
| 1620 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0) { |
| 1621 | device_data->wsi_enabled = true; |
| 1622 | } |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 1623 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME) == 0) { |
| 1624 | device_data->wsi_display_swapchain_enabled = true; |
| 1625 | } |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1626 | } |
| 1627 | } |
| 1628 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1629 | void storeCreateDeviceData(VkDevice device, const VkDeviceCreateInfo *pCreateInfo) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1630 | 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] | 1631 | |
| 1632 | if ((pCreateInfo != nullptr) && (pCreateInfo->pQueueCreateInfos != nullptr)) { |
| 1633 | for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { |
| 1634 | my_device_data->queueFamilyIndexMap.insert( |
| 1635 | std::make_pair(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex, pCreateInfo->pQueueCreateInfos[i].queueCount)); |
| 1636 | } |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1637 | } |
| 1638 | } |
| 1639 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1640 | VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1641 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { |
Courtney Goeltzenleuchter | bafcdf3 | 2015-09-08 17:42:57 -0600 | [diff] [blame] | 1642 | /* |
Courtney Goeltzenleuchter | bafcdf3 | 2015-09-08 17:42:57 -0600 | [diff] [blame] | 1643 | * NOTE: We do not validate physicalDevice or any dispatchable |
| 1644 | * object as the first parameter. We couldn't get here if it was wrong! |
| 1645 | */ |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1646 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1647 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1648 | bool skip_call = false; |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1649 | 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] | 1650 | assert(my_instance_data != nullptr); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 1651 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1652 | skip_call |= parameter_validation_vkCreateDevice(my_instance_data->report_data, pCreateInfo, pAllocator, pDevice); |
Dustin Graves | 842621d | 2016-03-03 14:17:08 -0700 | [diff] [blame] | 1653 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1654 | if (pCreateInfo != NULL) { |
| 1655 | if ((pCreateInfo->enabledLayerCount > 0) && (pCreateInfo->ppEnabledLayerNames != NULL)) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 1656 | for (size_t i = 0; i < pCreateInfo->enabledLayerCount; i++) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1657 | skip_call |= validate_string(my_instance_data->report_data, "vkCreateDevice", "pCreateInfo->ppEnabledLayerNames", |
| 1658 | pCreateInfo->ppEnabledLayerNames[i]); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1659 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1660 | } |
Michael Lentine | 774704f | 2016-01-27 13:36:46 -0600 | [diff] [blame] | 1661 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1662 | if ((pCreateInfo->enabledExtensionCount > 0) && (pCreateInfo->ppEnabledExtensionNames != NULL)) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 1663 | for (size_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1664 | skip_call |= validate_string(my_instance_data->report_data, "vkCreateDevice", |
| 1665 | "pCreateInfo->ppEnabledExtensionNames", pCreateInfo->ppEnabledExtensionNames[i]); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1666 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1667 | } |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1668 | } |
| 1669 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1670 | if (!skip_call) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1671 | VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1672 | assert(chain_info != nullptr); |
| 1673 | assert(chain_info->u.pLayerInfo != nullptr); |
| 1674 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1675 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 1676 | PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; |
Chia-I Wu | a570b7c | 2016-05-16 07:48:14 +0800 | [diff] [blame] | 1677 | PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(my_instance_data->instance, "vkCreateDevice"); |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1678 | if (fpCreateDevice == NULL) { |
| 1679 | return VK_ERROR_INITIALIZATION_FAILED; |
| 1680 | } |
| 1681 | |
| 1682 | // Advance the link info for the next element on the chain |
| 1683 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 1684 | |
| 1685 | result = fpCreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1686 | |
| 1687 | validate_result(my_instance_data->report_data, "vkCreateDevice", result); |
| 1688 | |
| 1689 | if (result == VK_SUCCESS) { |
| 1690 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map); |
| 1691 | assert(my_device_data != nullptr); |
| 1692 | |
| 1693 | my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice); |
| 1694 | initDeviceTable(*pDevice, fpGetDeviceProcAddr, pc_device_table_map); |
| 1695 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 1696 | CheckDeviceRegisterExtensions(pCreateInfo, *pDevice); |
| 1697 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1698 | uint32_t count; |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 1699 | VkLayerInstanceDispatchTable *instance_dispatch_table = get_dispatch_table(pc_instance_table_map, physicalDevice); |
| 1700 | instance_dispatch_table->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, nullptr); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1701 | std::vector<VkQueueFamilyProperties> properties(count); |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 1702 | instance_dispatch_table->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, &properties[0]); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1703 | |
| 1704 | validateDeviceCreateInfo(physicalDevice, pCreateInfo, properties); |
| 1705 | storeCreateDeviceData(*pDevice, pCreateInfo); |
Mark Lobodzinski | a493251 | 2016-06-27 15:13:00 -0600 | [diff] [blame] | 1706 | |
| 1707 | // Query and save physical device limits for this device |
| 1708 | VkPhysicalDeviceProperties device_properties = {}; |
| 1709 | instance_dispatch_table->GetPhysicalDeviceProperties(physicalDevice, &device_properties); |
| 1710 | memcpy(&my_device_data->device_limits, &device_properties.limits, sizeof(VkPhysicalDeviceLimits)); |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 1711 | my_device_data->physical_device = physicalDevice; |
Mark Lobodzinski | 7bdd9f2 | 2016-08-09 13:41:09 -0600 | [diff] [blame] | 1712 | |
| 1713 | // Save app-enabled features in this device's layer_data structure |
| 1714 | if (pCreateInfo->pEnabledFeatures) { |
| 1715 | my_device_data->physical_device_features = *pCreateInfo->pEnabledFeatures; |
| 1716 | } else { |
| 1717 | memset(&my_device_data->physical_device_features, 0, sizeof(VkPhysicalDeviceFeatures)); |
| 1718 | } |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1719 | } |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 1720 | } |
Michael Lentine | 157a2ec | 2016-01-27 11:25:05 -0600 | [diff] [blame] | 1721 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1722 | return result; |
| 1723 | } |
| 1724 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1725 | VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1726 | dispatch_key key = get_dispatch_key(device); |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1727 | bool skip_call = false; |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1728 | layer_data *my_data = get_my_data_ptr(key, layer_data_map); |
| 1729 | assert(my_data != NULL); |
| 1730 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1731 | skip_call |= parameter_validation_vkDestroyDevice(my_data->report_data, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1732 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1733 | if (!skip_call) { |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1734 | layer_debug_report_destroy_device(device); |
| 1735 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1736 | #if DISPATCH_MAP_DEBUG |
Mark Mueller | aab3650 | 2016-05-03 13:17:29 -0600 | [diff] [blame] | 1737 | fprintf(stderr, "Device: 0x%p, key: 0x%p\n", device, key); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1738 | #endif |
| 1739 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1740 | get_dispatch_table(pc_device_table_map, device)->DestroyDevice(device, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1741 | pc_device_table_map.erase(key); |
Tony Barbour | d4eb06d | 2016-03-29 15:14:59 -0600 | [diff] [blame] | 1742 | layer_data_map.erase(key); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1743 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1744 | } |
| 1745 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1746 | bool PreGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1747 | 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] | 1748 | assert(my_device_data != nullptr); |
| 1749 | |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 1750 | validate_queue_family_index(my_device_data, "vkGetDeviceQueue", "queueFamilyIndex", queueFamilyIndex); |
Mark Lobodzinski | f20f094 | 2016-03-22 10:07:26 -0600 | [diff] [blame] | 1751 | |
Dustin Graves | f5b498c | 2016-03-17 11:04:45 -0600 | [diff] [blame] | 1752 | const auto &queue_data = my_device_data->queueFamilyIndexMap.find(queueFamilyIndex); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1753 | if (queue_data->second <= queueIndex) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1754 | log_msg(my_device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, INVALID_USAGE, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1755 | LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1756 | "VkGetDeviceQueue parameter, uint32_t queueIndex %d, must be less than the number of queues given when the device " |
| 1757 | "was created.", |
| 1758 | queueIndex); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1759 | return false; |
| 1760 | } |
| 1761 | return true; |
| 1762 | } |
| 1763 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1764 | VKAPI_ATTR void VKAPI_CALL GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) { |
| 1765 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1766 | 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] | 1767 | assert(my_data != NULL); |
Michael Lentine | bdf744f | 2016-01-27 15:43:43 -0600 | [diff] [blame] | 1768 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1769 | skip_call |= parameter_validation_vkGetDeviceQueue(my_data->report_data, queueFamilyIndex, queueIndex, pQueue); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1770 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1771 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1772 | PreGetDeviceQueue(device, queueFamilyIndex, queueIndex); |
| 1773 | |
| 1774 | 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] | 1775 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1776 | } |
| 1777 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1778 | VKAPI_ATTR VkResult VKAPI_CALL QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1779 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1780 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1781 | 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] | 1782 | assert(my_data != NULL); |
| 1783 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1784 | skip_call |= parameter_validation_vkQueueSubmit(my_data->report_data, submitCount, pSubmits, fence); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1785 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1786 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1787 | result = get_dispatch_table(pc_device_table_map, queue)->QueueSubmit(queue, submitCount, pSubmits, fence); |
| 1788 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1789 | validate_result(my_data->report_data, "vkQueueSubmit", result); |
Courtney Goeltzenleuchter | 646b907 | 2015-10-20 18:04:07 -0600 | [diff] [blame] | 1790 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1791 | |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1792 | return result; |
| 1793 | } |
| 1794 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1795 | VKAPI_ATTR VkResult VKAPI_CALL QueueWaitIdle(VkQueue queue) { |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1796 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map); |
| 1797 | assert(my_data != NULL); |
| 1798 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1799 | VkResult result = get_dispatch_table(pc_device_table_map, queue)->QueueWaitIdle(queue); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1800 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1801 | validate_result(my_data->report_data, "vkQueueWaitIdle", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1802 | |
| 1803 | return result; |
| 1804 | } |
| 1805 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1806 | VKAPI_ATTR VkResult VKAPI_CALL DeviceWaitIdle(VkDevice device) { |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1807 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1808 | assert(my_data != NULL); |
| 1809 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 1810 | VkResult result = get_dispatch_table(pc_device_table_map, device)->DeviceWaitIdle(device); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1811 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1812 | validate_result(my_data->report_data, "vkDeviceWaitIdle", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1813 | |
| 1814 | return result; |
| 1815 | } |
| 1816 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1817 | VKAPI_ATTR VkResult VKAPI_CALL AllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1818 | const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1819 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1820 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1821 | 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] | 1822 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1823 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1824 | skip_call |= parameter_validation_vkAllocateMemory(my_data->report_data, pAllocateInfo, pAllocator, pMemory); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1825 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1826 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1827 | result = get_dispatch_table(pc_device_table_map, device)->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory); |
| 1828 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1829 | validate_result(my_data->report_data, "vkAllocateMemory", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1830 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1831 | |
| 1832 | return result; |
| 1833 | } |
| 1834 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1835 | VKAPI_ATTR void VKAPI_CALL FreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator) { |
| 1836 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1837 | 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] | 1838 | assert(my_data != NULL); |
| 1839 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1840 | skip_call |= parameter_validation_vkFreeMemory(my_data->report_data, memory, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1841 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1842 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1843 | get_dispatch_table(pc_device_table_map, device)->FreeMemory(device, memory, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 1844 | } |
| 1845 | } |
| 1846 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1847 | VKAPI_ATTR VkResult VKAPI_CALL MapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, |
| 1848 | VkMemoryMapFlags flags, void **ppData) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1849 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1850 | bool skip_call = 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); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1853 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1854 | skip_call |= parameter_validation_vkMapMemory(my_data->report_data, memory, offset, size, flags, ppData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1855 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1856 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1857 | result = get_dispatch_table(pc_device_table_map, device)->MapMemory(device, memory, offset, size, flags, ppData); |
| 1858 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1859 | validate_result(my_data->report_data, "vkMapMemory", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1860 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1861 | |
| 1862 | return result; |
| 1863 | } |
| 1864 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1865 | VKAPI_ATTR void VKAPI_CALL UnmapMemory(VkDevice device, VkDeviceMemory memory) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1866 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1867 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1868 | assert(my_data != NULL); |
| 1869 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1870 | skip_call |= parameter_validation_vkUnmapMemory(my_data->report_data, memory); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1871 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1872 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1873 | get_dispatch_table(pc_device_table_map, device)->UnmapMemory(device, memory); |
| 1874 | } |
| 1875 | } |
| 1876 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1877 | VKAPI_ATTR VkResult VKAPI_CALL FlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, |
| 1878 | const VkMappedMemoryRange *pMemoryRanges) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1879 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1880 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1881 | 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] | 1882 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1883 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1884 | skip_call |= parameter_validation_vkFlushMappedMemoryRanges(my_data->report_data, memoryRangeCount, pMemoryRanges); |
Tony Barbour | b125054 | 2015-04-16 19:23:13 -0600 | [diff] [blame] | 1885 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1886 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1887 | result = get_dispatch_table(pc_device_table_map, device)->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
| 1888 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1889 | validate_result(my_data->report_data, "vkFlushMappedMemoryRanges", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1890 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1891 | |
Courtney Goeltzenleuchter | f69f8a2 | 2015-04-29 17:16:21 -0600 | [diff] [blame] | 1892 | return result; |
| 1893 | } |
| 1894 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1895 | VKAPI_ATTR VkResult VKAPI_CALL InvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, |
| 1896 | const VkMappedMemoryRange *pMemoryRanges) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1897 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1898 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1899 | 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] | 1900 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1901 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1902 | skip_call |= parameter_validation_vkInvalidateMappedMemoryRanges(my_data->report_data, memoryRangeCount, pMemoryRanges); |
Courtney Goeltzenleuchter | f69f8a2 | 2015-04-29 17:16:21 -0600 | [diff] [blame] | 1903 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1904 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1905 | result = |
| 1906 | get_dispatch_table(pc_device_table_map, device)->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1907 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1908 | validate_result(my_data->report_data, "vkInvalidateMappedMemoryRanges", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1909 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1910 | |
Tony Barbour | b125054 | 2015-04-16 19:23:13 -0600 | [diff] [blame] | 1911 | return result; |
| 1912 | } |
| 1913 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1914 | VKAPI_ATTR void VKAPI_CALL GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, |
| 1915 | VkDeviceSize *pCommittedMemoryInBytes) { |
| 1916 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1917 | 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] | 1918 | assert(my_data != NULL); |
Courtney Goeltzenleuchter | fb71f22 | 2015-07-09 21:57:28 -0600 | [diff] [blame] | 1919 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1920 | skip_call |= parameter_validation_vkGetDeviceMemoryCommitment(my_data->report_data, memory, pCommittedMemoryInBytes); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1921 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1922 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1923 | get_dispatch_table(pc_device_table_map, device)->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1924 | } |
Courtney Goeltzenleuchter | fb71f22 | 2015-07-09 21:57:28 -0600 | [diff] [blame] | 1925 | } |
| 1926 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 1927 | VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, |
| 1928 | VkDeviceSize memoryOffset) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1929 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1930 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1931 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1932 | assert(my_data != NULL); |
| 1933 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1934 | skip_call |= parameter_validation_vkBindBufferMemory(my_data->report_data, buffer, memory, memoryOffset); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1935 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1936 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1937 | result = get_dispatch_table(pc_device_table_map, device)->BindBufferMemory(device, buffer, memory, memoryOffset); |
| 1938 | |
| 1939 | validate_result(my_data->report_data, "vkBindBufferMemory", result); |
| 1940 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 1941 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 1942 | return result; |
| 1943 | } |
| 1944 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1945 | VKAPI_ATTR VkResult VKAPI_CALL BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1946 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1947 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 1948 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1949 | assert(my_data != NULL); |
| 1950 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1951 | skip_call |= parameter_validation_vkBindImageMemory(my_data->report_data, image, memory, memoryOffset); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1952 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1953 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 1954 | result = get_dispatch_table(pc_device_table_map, device)->BindImageMemory(device, image, memory, memoryOffset); |
| 1955 | |
| 1956 | validate_result(my_data->report_data, "vkBindImageMemory", result); |
| 1957 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1958 | |
| 1959 | return result; |
| 1960 | } |
| 1961 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1962 | VKAPI_ATTR void VKAPI_CALL GetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, |
| 1963 | VkMemoryRequirements *pMemoryRequirements) { |
| 1964 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1965 | 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] | 1966 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1967 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1968 | skip_call |= parameter_validation_vkGetBufferMemoryRequirements(my_data->report_data, buffer, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1969 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1970 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1971 | get_dispatch_table(pc_device_table_map, device)->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1972 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1973 | } |
| 1974 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1975 | VKAPI_ATTR void VKAPI_CALL GetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements) { |
| 1976 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1977 | 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] | 1978 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1979 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1980 | skip_call |= parameter_validation_vkGetImageMemoryRequirements(my_data->report_data, image, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1981 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 1982 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1983 | get_dispatch_table(pc_device_table_map, device)->GetImageMemoryRequirements(device, image, pMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1984 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 1985 | } |
| 1986 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1987 | bool PostGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pNumRequirements, |
| 1988 | VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1989 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1990 | if (pSparseMemoryRequirements != nullptr) { |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 1991 | if ((pSparseMemoryRequirements->formatProperties.aspectMask & |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1992 | (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 1993 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 1994 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 1995 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 1996 | "vkGetImageSparseMemoryRequirements parameter, VkImageAspect " |
| 1997 | "pSparseMemoryRequirements->formatProperties.aspectMask, is an unrecognized enumerator"); |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 1998 | return false; |
| 1999 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2000 | } |
| 2001 | |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2002 | return true; |
| 2003 | } |
| 2004 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2005 | VKAPI_ATTR void VKAPI_CALL GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, |
| 2006 | VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { |
| 2007 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2008 | 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] | 2009 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2010 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2011 | skip_call |= parameter_validation_vkGetImageSparseMemoryRequirements(my_data->report_data, image, pSparseMemoryRequirementCount, |
| 2012 | pSparseMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2013 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2014 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2015 | get_dispatch_table(pc_device_table_map, device) |
| 2016 | ->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2017 | |
| 2018 | PostGetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 2019 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2020 | } |
| 2021 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2022 | bool PostGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, |
| 2023 | VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, |
| 2024 | uint32_t *pNumProperties, VkSparseImageFormatProperties *pProperties) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 2025 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2026 | if (pProperties != nullptr) { |
| 2027 | if ((pProperties->aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 2028 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 2029 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, 1, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2030 | LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2031 | "vkGetPhysicalDeviceSparseImageFormatProperties parameter, VkImageAspect pProperties->aspectMask, is an " |
| 2032 | "unrecognized enumerator"); |
Dustin Graves | 02a24a2 | 2016-03-08 13:34:49 -0700 | [diff] [blame] | 2033 | return false; |
| 2034 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2035 | } |
| 2036 | |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2037 | return true; |
| 2038 | } |
| 2039 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2040 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 2041 | VkImageType type, VkSampleCountFlagBits samples, |
| 2042 | VkImageUsageFlags usage, VkImageTiling tiling, |
| 2043 | uint32_t *pPropertyCount, |
| 2044 | VkSparseImageFormatProperties *pProperties) { |
| 2045 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2046 | 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] | 2047 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2048 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2049 | skip_call |= parameter_validation_vkGetPhysicalDeviceSparseImageFormatProperties(my_data->report_data, format, type, samples, |
| 2050 | usage, tiling, pPropertyCount, pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2051 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2052 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2053 | get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 2054 | ->GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, |
| 2055 | pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2056 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2057 | PostGetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, |
| 2058 | pProperties); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2059 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2060 | } |
| 2061 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2062 | VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, |
| 2063 | VkFence fence) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2064 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2065 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2066 | 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] | 2067 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2068 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2069 | skip_call |= parameter_validation_vkQueueBindSparse(my_data->report_data, bindInfoCount, pBindInfo, fence); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2070 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2071 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2072 | result = get_dispatch_table(pc_device_table_map, queue)->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); |
| 2073 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2074 | validate_result(my_data->report_data, "vkQueueBindSparse", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2075 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2076 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 2077 | return result; |
| 2078 | } |
| 2079 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2080 | VKAPI_ATTR VkResult VKAPI_CALL CreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, |
| 2081 | const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2082 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2083 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2084 | 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] | 2085 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2086 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2087 | skip_call |= parameter_validation_vkCreateFence(my_data->report_data, pCreateInfo, pAllocator, pFence); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2088 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2089 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2090 | result = get_dispatch_table(pc_device_table_map, device)->CreateFence(device, pCreateInfo, pAllocator, pFence); |
| 2091 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2092 | validate_result(my_data->report_data, "vkCreateFence", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2093 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2094 | |
| 2095 | return result; |
| 2096 | } |
| 2097 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2098 | VKAPI_ATTR void VKAPI_CALL DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2099 | bool skip_call = 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 | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2101 | assert(my_data != NULL); |
| 2102 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2103 | skip_call |= parameter_validation_vkDestroyFence(my_data->report_data, fence, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2104 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2105 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2106 | get_dispatch_table(pc_device_table_map, device)->DestroyFence(device, fence, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2107 | } |
| 2108 | } |
| 2109 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2110 | VKAPI_ATTR VkResult VKAPI_CALL ResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2111 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2112 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2113 | 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] | 2114 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2115 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2116 | skip_call |= parameter_validation_vkResetFences(my_data->report_data, fenceCount, pFences); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2117 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2118 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2119 | result = get_dispatch_table(pc_device_table_map, device)->ResetFences(device, fenceCount, pFences); |
| 2120 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2121 | validate_result(my_data->report_data, "vkResetFences", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2122 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2123 | |
| 2124 | return result; |
| 2125 | } |
| 2126 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2127 | VKAPI_ATTR VkResult VKAPI_CALL GetFenceStatus(VkDevice device, VkFence fence) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2128 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2129 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2130 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2131 | assert(my_data != NULL); |
| 2132 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2133 | skip_call |= parameter_validation_vkGetFenceStatus(my_data->report_data, fence); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2134 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2135 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2136 | result = get_dispatch_table(pc_device_table_map, device)->GetFenceStatus(device, fence); |
| 2137 | |
| 2138 | validate_result(my_data->report_data, "vkGetFenceStatus", result); |
| 2139 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2140 | |
| 2141 | return result; |
| 2142 | } |
| 2143 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2144 | VKAPI_ATTR VkResult VKAPI_CALL WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, |
| 2145 | uint64_t timeout) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2146 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2147 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2148 | 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] | 2149 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2150 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2151 | skip_call |= parameter_validation_vkWaitForFences(my_data->report_data, fenceCount, pFences, waitAll, timeout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2152 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2153 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2154 | result = get_dispatch_table(pc_device_table_map, device)->WaitForFences(device, fenceCount, pFences, waitAll, timeout); |
| 2155 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2156 | validate_result(my_data->report_data, "vkWaitForFences", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2157 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2158 | |
| 2159 | return result; |
| 2160 | } |
| 2161 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2162 | VKAPI_ATTR VkResult VKAPI_CALL CreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2163 | const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2164 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2165 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2166 | 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] | 2167 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2168 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2169 | skip_call |= parameter_validation_vkCreateSemaphore(my_data->report_data, pCreateInfo, pAllocator, pSemaphore); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2170 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2171 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2172 | result = get_dispatch_table(pc_device_table_map, device)->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore); |
| 2173 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2174 | validate_result(my_data->report_data, "vkCreateSemaphore", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2175 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2176 | |
| 2177 | return result; |
| 2178 | } |
| 2179 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2180 | VKAPI_ATTR void VKAPI_CALL DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator) { |
| 2181 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2182 | 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] | 2183 | assert(my_data != NULL); |
| 2184 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2185 | skip_call |= parameter_validation_vkDestroySemaphore(my_data->report_data, semaphore, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2186 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2187 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2188 | get_dispatch_table(pc_device_table_map, device)->DestroySemaphore(device, semaphore, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2189 | } |
| 2190 | } |
| 2191 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2192 | VKAPI_ATTR VkResult VKAPI_CALL CreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, |
| 2193 | const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2194 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2195 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2196 | 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] | 2197 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2198 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2199 | skip_call |= parameter_validation_vkCreateEvent(my_data->report_data, pCreateInfo, pAllocator, pEvent); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2200 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2201 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2202 | result = get_dispatch_table(pc_device_table_map, device)->CreateEvent(device, pCreateInfo, pAllocator, pEvent); |
| 2203 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2204 | validate_result(my_data->report_data, "vkCreateEvent", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2205 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2206 | |
| 2207 | return result; |
| 2208 | } |
| 2209 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2210 | VKAPI_ATTR void VKAPI_CALL DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2211 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2212 | 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] | 2213 | assert(my_data != NULL); |
| 2214 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2215 | skip_call |= parameter_validation_vkDestroyEvent(my_data->report_data, event, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2216 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2217 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2218 | get_dispatch_table(pc_device_table_map, device)->DestroyEvent(device, event, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2219 | } |
| 2220 | } |
| 2221 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2222 | VKAPI_ATTR VkResult VKAPI_CALL GetEventStatus(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2223 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2224 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2225 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2226 | assert(my_data != NULL); |
| 2227 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2228 | skip_call |= parameter_validation_vkGetEventStatus(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2229 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2230 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2231 | result = get_dispatch_table(pc_device_table_map, device)->GetEventStatus(device, event); |
| 2232 | |
| 2233 | validate_result(my_data->report_data, "vkGetEventStatus", result); |
| 2234 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2235 | |
| 2236 | return result; |
| 2237 | } |
| 2238 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2239 | VKAPI_ATTR VkResult VKAPI_CALL SetEvent(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2240 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2241 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2242 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2243 | assert(my_data != NULL); |
| 2244 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2245 | skip_call |= parameter_validation_vkSetEvent(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2246 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2247 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2248 | result = get_dispatch_table(pc_device_table_map, device)->SetEvent(device, event); |
| 2249 | |
| 2250 | validate_result(my_data->report_data, "vkSetEvent", result); |
| 2251 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2252 | |
| 2253 | return result; |
| 2254 | } |
| 2255 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2256 | VKAPI_ATTR VkResult VKAPI_CALL ResetEvent(VkDevice device, VkEvent event) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2257 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2258 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2259 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2260 | assert(my_data != NULL); |
| 2261 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2262 | skip_call |= parameter_validation_vkResetEvent(my_data->report_data, event); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2263 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2264 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 2265 | result = get_dispatch_table(pc_device_table_map, device)->ResetEvent(device, event); |
| 2266 | |
| 2267 | validate_result(my_data->report_data, "vkResetEvent", result); |
| 2268 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2269 | |
| 2270 | return result; |
| 2271 | } |
| 2272 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2273 | VKAPI_ATTR VkResult VKAPI_CALL CreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2274 | const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2275 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2276 | bool skip_call = false; |
| 2277 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2278 | assert(device_data != nullptr); |
| 2279 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2280 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2281 | skip_call |= parameter_validation_vkCreateQueryPool(device_data->report_data, pCreateInfo, pAllocator, pQueryPool); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2282 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2283 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2284 | if (pCreateInfo != nullptr) { |
| 2285 | // If queryType is VK_QUERY_TYPE_PIPELINE_STATISTICS, pipelineStatistics must be a valid combination of |
| 2286 | // VkQueryPipelineStatisticFlagBits values |
| 2287 | if ((pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS) && (pCreateInfo->pipelineStatistics != 0) && |
| 2288 | ((pCreateInfo->pipelineStatistics & (~AllVkQueryPipelineStatisticFlagBits)) != 0)) { |
| 2289 | skip_call |= |
| 2290 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2291 | UNRECOGNIZED_VALUE, LayerName, "vkCreateQueryPool: if pCreateInfo->queryType is " |
| 2292 | "VK_QUERY_TYPE_PIPELINE_STATISTICS, pCreateInfo->pipelineStatistics must be " |
| 2293 | "a valid combination of VkQueryPipelineStatisticFlagBits values"); |
| 2294 | } |
| 2295 | } |
| 2296 | |
| 2297 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2298 | result = get_dispatch_table(pc_device_table_map, device)->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); |
| 2299 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2300 | validate_result(report_data, "vkCreateQueryPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2301 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2302 | |
| 2303 | return result; |
| 2304 | } |
| 2305 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2306 | VKAPI_ATTR void VKAPI_CALL DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator) { |
| 2307 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2308 | 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] | 2309 | assert(my_data != NULL); |
| 2310 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2311 | skip_call |= parameter_validation_vkDestroyQueryPool(my_data->report_data, queryPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2312 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2313 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2314 | get_dispatch_table(pc_device_table_map, device)->DestroyQueryPool(device, queryPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2315 | } |
| 2316 | } |
| 2317 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2318 | VKAPI_ATTR VkResult VKAPI_CALL GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, |
| 2319 | size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2320 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2321 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2322 | 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] | 2323 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2324 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2325 | skip_call |= parameter_validation_vkGetQueryPoolResults(my_data->report_data, queryPool, firstQuery, queryCount, dataSize, |
| 2326 | pData, stride, flags); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2327 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2328 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2329 | result = get_dispatch_table(pc_device_table_map, device) |
| 2330 | ->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2331 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2332 | validate_result(my_data->report_data, "vkGetQueryPoolResults", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2333 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2334 | |
| 2335 | return result; |
| 2336 | } |
| 2337 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2338 | VKAPI_ATTR VkResult VKAPI_CALL CreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, |
| 2339 | const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2340 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2341 | bool skip_call = false; |
| 2342 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2343 | assert(device_data != nullptr); |
| 2344 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2345 | |
Karl Schultz | a9ef1e5 | 2016-10-06 17:53:48 -0600 | [diff] [blame] | 2346 | // TODO: Add check for VALIDATION_ERROR_00660 |
| 2347 | // TODO: Add check for VALIDATION_ERROR_00661 |
| 2348 | // TODO: Add check for VALIDATION_ERROR_00662 |
| 2349 | // TODO: Add check for VALIDATION_ERROR_00670 |
| 2350 | // TODO: Add check for VALIDATION_ERROR_00671 |
| 2351 | // TODO: Add check for VALIDATION_ERROR_00672 |
| 2352 | // TODO: Add check for VALIDATION_ERROR_00673 |
| 2353 | // TODO: Add check for VALIDATION_ERROR_00674 |
| 2354 | // TODO: Add check for VALIDATION_ERROR_00675 |
| 2355 | // TODO: Note that the above errors need to be generated from the next function, which is codegened. |
| 2356 | // TODO: Add check for VALIDATION_ERROR_00663 |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2357 | skip_call |= parameter_validation_vkCreateBuffer(report_data, pCreateInfo, pAllocator, pBuffer); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2358 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2359 | if (pCreateInfo != nullptr) { |
| 2360 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2361 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 2362 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 2363 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Karl Schultz | a9ef1e5 | 2016-10-06 17:53:48 -0600 | [diff] [blame] | 2364 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2365 | __LINE__, VALIDATION_ERROR_00665, LayerName, |
| 2366 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2367 | "pCreateInfo->queueFamilyIndexCount must be greater than 1. %s", |
| 2368 | validation_error_map[VALIDATION_ERROR_00665]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2369 | } |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2370 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2371 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 2372 | // queueFamilyIndexCount uint32_t values |
| 2373 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
| 2374 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Karl Schultz | a9ef1e5 | 2016-10-06 17:53:48 -0600 | [diff] [blame] | 2375 | __LINE__, VALIDATION_ERROR_00664, LayerName, |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2376 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2377 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
Karl Schultz | a9ef1e5 | 2016-10-06 17:53:48 -0600 | [diff] [blame] | 2378 | "pCreateInfo->queueFamilyIndexCount uint32_t values. %s", |
| 2379 | validation_error_map[VALIDATION_ERROR_00664]); |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2380 | } |
| 2381 | |
| 2382 | // Ensure that the queue family indices were specified at device creation |
| 2383 | skip_call |= validate_queue_family_indices(device_data, "vkCreateBuffer", "pCreateInfo->pQueueFamilyIndices", |
| 2384 | pCreateInfo->queueFamilyIndexCount, pCreateInfo->pQueueFamilyIndices); |
| 2385 | } |
| 2386 | } |
| 2387 | |
| 2388 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2389 | result = get_dispatch_table(pc_device_table_map, device)->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); |
| 2390 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2391 | validate_result(report_data, "vkCreateBuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2392 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2393 | |
| 2394 | return result; |
| 2395 | } |
| 2396 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2397 | VKAPI_ATTR void VKAPI_CALL DestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator) { |
| 2398 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2399 | 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] | 2400 | assert(my_data != NULL); |
| 2401 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2402 | skip_call |= parameter_validation_vkDestroyBuffer(my_data->report_data, buffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2403 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2404 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2405 | get_dispatch_table(pc_device_table_map, device)->DestroyBuffer(device, buffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2406 | } |
| 2407 | } |
| 2408 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2409 | VKAPI_ATTR VkResult VKAPI_CALL CreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, |
| 2410 | const VkAllocationCallbacks *pAllocator, VkBufferView *pView) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2411 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2412 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2413 | 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] | 2414 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2415 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2416 | skip_call |= parameter_validation_vkCreateBufferView(my_data->report_data, pCreateInfo, pAllocator, pView); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2417 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2418 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2419 | result = get_dispatch_table(pc_device_table_map, device)->CreateBufferView(device, pCreateInfo, pAllocator, pView); |
| 2420 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2421 | validate_result(my_data->report_data, "vkCreateBufferView", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2422 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2423 | |
| 2424 | return result; |
| 2425 | } |
| 2426 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2427 | VKAPI_ATTR void VKAPI_CALL DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator) { |
| 2428 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2429 | 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] | 2430 | assert(my_data != NULL); |
| 2431 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2432 | skip_call |= parameter_validation_vkDestroyBufferView(my_data->report_data, bufferView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2433 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2434 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2435 | get_dispatch_table(pc_device_table_map, device)->DestroyBufferView(device, bufferView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2436 | } |
| 2437 | } |
| 2438 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2439 | VKAPI_ATTR VkResult VKAPI_CALL CreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, |
| 2440 | const VkAllocationCallbacks *pAllocator, VkImage *pImage) { |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2441 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 2442 | bool skip_call = false; |
| 2443 | 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] | 2444 | assert(device_data != nullptr); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2445 | debug_report_data *report_data = device_data->report_data; |
| 2446 | |
| 2447 | skip_call |= parameter_validation_vkCreateImage(report_data, pCreateInfo, pAllocator, pImage); |
| 2448 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2449 | if (pCreateInfo != nullptr) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2450 | // 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] | 2451 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2452 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 2453 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
| 2454 | skip_call |= |
| 2455 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2456 | INVALID_USAGE, LayerName, "vkCreateImage: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2457 | "pCreateInfo->queueFamilyIndexCount must be greater than 1"); |
| 2458 | } |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2459 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2460 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 2461 | // queueFamilyIndexCount uint32_t values |
| 2462 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
| 2463 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2464 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 2465 | "vkCreateImage: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2466 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
| 2467 | "pCreateInfo->queueFamilyIndexCount uint32_t values"); |
| 2468 | } |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2469 | |
| 2470 | skip_call |= validate_queue_family_indices(device_data, "vkCreateImage", "pCreateInfo->pQueueFamilyIndices", |
| 2471 | pCreateInfo->queueFamilyIndexCount, pCreateInfo->pQueueFamilyIndices); |
| 2472 | } |
| 2473 | |
| 2474 | // width, height, and depth members of extent must be greater than 0 |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2475 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.width", pCreateInfo->extent.width, 0u); |
| 2476 | skip_call |= |
| 2477 | ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.height", pCreateInfo->extent.height, 0u); |
| 2478 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->extent.depth", pCreateInfo->extent.depth, 0u); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2479 | |
| 2480 | // mipLevels must be greater than 0 |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2481 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->mipLevels", pCreateInfo->mipLevels, 0u); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2482 | |
| 2483 | // arrayLayers must be greater than 0 |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2484 | skip_call |= ValidateGreaterThan(report_data, "vkCreateImage", "pCreateInfo->arrayLayers", pCreateInfo->arrayLayers, 0u); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2485 | |
| 2486 | // If imageType is VK_IMAGE_TYPE_1D, both extent.height and extent.depth must be 1 |
| 2487 | if ((pCreateInfo->imageType == VK_IMAGE_TYPE_1D) && (pCreateInfo->extent.height != 1) && (pCreateInfo->extent.depth != 1)) { |
| 2488 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2489 | LayerName, "vkCreateImage: if pCreateInfo->imageType is VK_IMAGE_TYPE_1D, both " |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2490 | "pCreateInfo->extent.height and pCreateInfo->extent.depth must be 1"); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2491 | } |
| 2492 | |
| 2493 | if (pCreateInfo->imageType == VK_IMAGE_TYPE_2D) { |
| 2494 | // If imageType is VK_IMAGE_TYPE_2D and flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, extent.width and |
| 2495 | // extent.height must be equal |
| 2496 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) && |
| 2497 | (pCreateInfo->extent.width != pCreateInfo->extent.height)) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2498 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2499 | LayerName, "vkCreateImage: if pCreateInfo->imageType is VK_IMAGE_TYPE_2D and " |
| 2500 | "pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, " |
| 2501 | "pCreateInfo->extent.width and pCreateInfo->extent.height must be equal"); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2502 | } |
| 2503 | |
| 2504 | if (pCreateInfo->extent.depth != 1) { |
| 2505 | skip_call |= |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2506 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2507 | "vkCreateImage: if pCreateInfo->imageType is VK_IMAGE_TYPE_2D, pCreateInfo->extent.depth must be 1"); |
| 2508 | } |
| 2509 | } |
| 2510 | |
| 2511 | // mipLevels must be less than or equal to floor(log2(max(extent.width,extent.height,extent.depth)))+1 |
| 2512 | uint32_t maxDim = std::max(std::max(pCreateInfo->extent.width, pCreateInfo->extent.height), pCreateInfo->extent.depth); |
| 2513 | if (pCreateInfo->mipLevels > (floor(log2(maxDim)) + 1)) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2514 | skip_call |= |
| 2515 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 2516 | "vkCreateImage: pCreateInfo->mipLevels must be less than or equal to " |
| 2517 | "floor(log2(max(pCreateInfo->extent.width, pCreateInfo->extent.height, pCreateInfo->extent.depth)))+1"); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2518 | } |
| 2519 | |
| 2520 | // If flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, it must also contain |
| 2521 | // VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
| 2522 | if (((pCreateInfo->flags & (VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT)) != 0) && |
| 2523 | ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) != VK_IMAGE_CREATE_SPARSE_BINDING_BIT)) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2524 | skip_call |= |
| 2525 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, LayerName, |
| 2526 | "vkCreateImage: pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or " |
| 2527 | "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] | 2528 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2529 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2530 | |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2531 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2532 | result = get_dispatch_table(pc_device_table_map, device)->CreateImage(device, pCreateInfo, pAllocator, pImage); |
| 2533 | |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 2534 | validate_result(report_data, "vkCreateImage", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2535 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2536 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 2537 | return result; |
| 2538 | } |
| 2539 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2540 | VKAPI_ATTR void VKAPI_CALL DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2541 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2542 | 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] | 2543 | assert(my_data != NULL); |
| 2544 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2545 | skip_call |= parameter_validation_vkDestroyImage(my_data->report_data, image, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2546 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2547 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2548 | get_dispatch_table(pc_device_table_map, device)->DestroyImage(device, image, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2549 | } |
| 2550 | } |
| 2551 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2552 | bool PreGetImageSubresourceLayout(VkDevice device, const VkImageSubresource *pSubresource) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 2553 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2554 | if (pSubresource != nullptr) { |
| 2555 | if ((pSubresource->aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | |
| 2556 | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 2557 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2558 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2559 | "vkGetImageSubresourceLayout parameter, VkImageAspect pSubresource->aspectMask, is an unrecognized enumerator"); |
| 2560 | return false; |
| 2561 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2562 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2563 | |
| 2564 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2565 | } |
| 2566 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2567 | VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, |
| 2568 | VkSubresourceLayout *pLayout) { |
| 2569 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2570 | 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] | 2571 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2572 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2573 | skip_call |= parameter_validation_vkGetImageSubresourceLayout(my_data->report_data, image, pSubresource, pLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2574 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2575 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2576 | PreGetImageSubresourceLayout(device, pSubresource); |
| 2577 | |
| 2578 | 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] | 2579 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2580 | } |
| 2581 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2582 | VKAPI_ATTR VkResult VKAPI_CALL CreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, |
| 2583 | const VkAllocationCallbacks *pAllocator, VkImageView *pView) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2584 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2585 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2586 | 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] | 2587 | assert(my_data != NULL); |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2588 | debug_report_data *report_data = my_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 2589 | |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2590 | skip_call |= parameter_validation_vkCreateImageView(report_data, pCreateInfo, pAllocator, pView); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2591 | |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2592 | if (pCreateInfo != nullptr) { |
| 2593 | if ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D) || (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_2D)) { |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2594 | if ((pCreateInfo->subresourceRange.layerCount != 1) && |
| 2595 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2596 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2597 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_%dD, " |
| 2598 | "pCreateInfo->subresourceRange.layerCount must be 1", |
| 2599 | ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D) ? 1 : 2)); |
| 2600 | } |
| 2601 | } else if ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY) || |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2602 | (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_2D_ARRAY)) { |
| 2603 | if ((pCreateInfo->subresourceRange.layerCount < 1) && |
| 2604 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2605 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2606 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_%dD_ARRAY, " |
| 2607 | "pCreateInfo->subresourceRange.layerCount must be >= 1", |
| 2608 | ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY) ? 1 : 2)); |
| 2609 | } |
| 2610 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE) { |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2611 | if ((pCreateInfo->subresourceRange.layerCount != 6) && |
| 2612 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2613 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2614 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_CUBE, " |
| 2615 | "pCreateInfo->subresourceRange.layerCount must be 6"); |
| 2616 | } |
| 2617 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY) { |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2618 | if (((pCreateInfo->subresourceRange.layerCount == 0) || ((pCreateInfo->subresourceRange.layerCount % 6) != 0)) && |
| 2619 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2620 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2621 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_CUBE_ARRAY, " |
| 2622 | "pCreateInfo->subresourceRange.layerCount must be a multiple of 6"); |
| 2623 | } |
| 2624 | } else if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_3D) { |
| 2625 | if (pCreateInfo->subresourceRange.baseArrayLayer != 0) { |
| 2626 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2627 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_3D, " |
| 2628 | "pCreateInfo->subresourceRange.baseArrayLayer must be 0"); |
| 2629 | } |
| 2630 | |
Dustin Graves | 2a80dc6 | 2016-07-12 13:57:02 -0600 | [diff] [blame] | 2631 | if ((pCreateInfo->subresourceRange.layerCount != 1) && |
| 2632 | (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS)) { |
Dustin Graves | 0b70a63 | 2016-04-27 17:44:56 -0600 | [diff] [blame] | 2633 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, |
| 2634 | LayerName, "vkCreateImageView: if pCreateInfo->viewType is VK_IMAGE_TYPE_3D, " |
| 2635 | "pCreateInfo->subresourceRange.layerCount must be 1"); |
| 2636 | } |
| 2637 | } |
| 2638 | } |
| 2639 | |
| 2640 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2641 | result = get_dispatch_table(pc_device_table_map, device)->CreateImageView(device, pCreateInfo, pAllocator, pView); |
| 2642 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2643 | validate_result(my_data->report_data, "vkCreateImageView", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2644 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 2645 | |
| 2646 | return result; |
| 2647 | } |
| 2648 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2649 | VKAPI_ATTR void VKAPI_CALL DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) { |
| 2650 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2651 | 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] | 2652 | assert(my_data != NULL); |
| 2653 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2654 | skip_call |= parameter_validation_vkDestroyImageView(my_data->report_data, imageView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2655 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2656 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2657 | get_dispatch_table(pc_device_table_map, device)->DestroyImageView(device, imageView, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2658 | } |
| 2659 | } |
| 2660 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2661 | VKAPI_ATTR VkResult VKAPI_CALL CreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2662 | const VkAllocationCallbacks *pAllocator, VkShaderModule *pShaderModule) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2663 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2664 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2665 | 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] | 2666 | assert(my_data != NULL); |
| 2667 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2668 | skip_call |= parameter_validation_vkCreateShaderModule(my_data->report_data, pCreateInfo, pAllocator, pShaderModule); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2669 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2670 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2671 | result = |
| 2672 | 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] | 2673 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2674 | validate_result(my_data->report_data, "vkCreateShaderModule", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2675 | } |
| 2676 | |
Michael Lentine | 03d8e57 | 2015-09-15 14:59:14 -0500 | [diff] [blame] | 2677 | return result; |
| 2678 | } |
| 2679 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2680 | VKAPI_ATTR void VKAPI_CALL DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, |
| 2681 | const VkAllocationCallbacks *pAllocator) { |
| 2682 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2683 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2684 | assert(my_data != NULL); |
| 2685 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2686 | skip_call |= parameter_validation_vkDestroyShaderModule(my_data->report_data, shaderModule, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2687 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2688 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2689 | get_dispatch_table(pc_device_table_map, device)->DestroyShaderModule(device, shaderModule, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2690 | } |
| 2691 | } |
| 2692 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 2693 | VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2694 | const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2695 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2696 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2697 | 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] | 2698 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2699 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2700 | skip_call |= parameter_validation_vkCreatePipelineCache(my_data->report_data, pCreateInfo, pAllocator, pPipelineCache); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2701 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2702 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2703 | result = |
| 2704 | 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] | 2705 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2706 | validate_result(my_data->report_data, "vkCreatePipelineCache", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2707 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2708 | |
| 2709 | return result; |
| 2710 | } |
| 2711 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2712 | VKAPI_ATTR void VKAPI_CALL DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, |
| 2713 | const VkAllocationCallbacks *pAllocator) { |
| 2714 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2715 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2716 | assert(my_data != NULL); |
| 2717 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2718 | skip_call |= parameter_validation_vkDestroyPipelineCache(my_data->report_data, pipelineCache, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2719 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2720 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2721 | get_dispatch_table(pc_device_table_map, device)->DestroyPipelineCache(device, pipelineCache, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 2722 | } |
| 2723 | } |
| 2724 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2725 | VKAPI_ATTR VkResult VKAPI_CALL GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, |
| 2726 | void *pData) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2727 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2728 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2729 | 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] | 2730 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2731 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2732 | skip_call |= parameter_validation_vkGetPipelineCacheData(my_data->report_data, pipelineCache, pDataSize, pData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2733 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2734 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2735 | result = get_dispatch_table(pc_device_table_map, device)->GetPipelineCacheData(device, pipelineCache, pDataSize, pData); |
| 2736 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2737 | validate_result(my_data->report_data, "vkGetPipelineCacheData", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2738 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2739 | |
| 2740 | return result; |
| 2741 | } |
| 2742 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2743 | VKAPI_ATTR VkResult VKAPI_CALL MergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, |
| 2744 | const VkPipelineCache *pSrcCaches) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2745 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2746 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2747 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2748 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2749 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2750 | skip_call |= parameter_validation_vkMergePipelineCaches(my_data->report_data, dstCache, srcCacheCount, pSrcCaches); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2751 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2752 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2753 | result = get_dispatch_table(pc_device_table_map, device)->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches); |
| 2754 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 2755 | validate_result(my_data->report_data, "vkMergePipelineCaches", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 2756 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2757 | |
| 2758 | return result; |
| 2759 | } |
| 2760 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2761 | bool PreCreateGraphicsPipelines(VkDevice device, const VkGraphicsPipelineCreateInfo *pCreateInfos) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 2762 | layer_data *data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2763 | |
| 2764 | // TODO: Handle count |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2765 | if (pCreateInfos != nullptr) { |
| 2766 | if (pCreateInfos->flags | VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
| 2767 | if (pCreateInfos->basePipelineIndex != -1) { |
| 2768 | if (pCreateInfos->basePipelineHandle != VK_NULL_HANDLE) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 2769 | log_msg(data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2770 | INVALID_USAGE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2771 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineHandle, must be VK_NULL_HANDLE if " |
| 2772 | "pCreateInfos->flags " |
| 2773 | "contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and pCreateInfos->basePipelineIndex is not -1"); |
| 2774 | return false; |
| 2775 | } |
| 2776 | } |
| 2777 | |
| 2778 | if (pCreateInfos->basePipelineHandle != VK_NULL_HANDLE) { |
| 2779 | if (pCreateInfos->basePipelineIndex != -1) { |
| 2780 | log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 2781 | data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2782 | INVALID_USAGE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2783 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineIndex, must be -1 if pCreateInfos->flags " |
| 2784 | "contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and pCreateInfos->basePipelineHandle is not " |
| 2785 | "VK_NULL_HANDLE"); |
| 2786 | return false; |
| 2787 | } |
Jeremy Hayes | 2fdaaf2 | 2016-03-01 17:51:54 -0700 | [diff] [blame] | 2788 | } |
| 2789 | } |
| 2790 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2791 | if (pCreateInfos->pRasterizationState != nullptr) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2792 | if (pCreateInfos->pRasterizationState->cullMode & ~VK_CULL_MODE_FRONT_AND_BACK) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 2793 | log_msg(data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 2794 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2795 | "vkCreateGraphicsPipelines parameter, VkCullMode pCreateInfos->pRasterizationState->cullMode, is an " |
| 2796 | "unrecognized enumerator"); |
| 2797 | return false; |
| 2798 | } |
Mark Lobodzinski | 2e67fdb | 2016-08-09 13:10:51 -0600 | [diff] [blame] | 2799 | |
| 2800 | if ((pCreateInfos->pRasterizationState->polygonMode != VK_POLYGON_MODE_FILL) && |
| 2801 | (data->physical_device_features.fillModeNonSolid == false)) { |
| 2802 | log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 2803 | data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | 2e67fdb | 2016-08-09 13:10:51 -0600 | [diff] [blame] | 2804 | DEVICE_FEATURE, LayerName, |
| 2805 | "vkCreateGraphicsPipelines parameter, VkPolygonMode pCreateInfos->pRasterizationState->polygonMode cannot be " |
| 2806 | "VK_POLYGON_MODE_POINT or VK_POLYGON_MODE_LINE if VkPhysicalDeviceFeatures->fillModeNonSolid is false."); |
| 2807 | return false; |
| 2808 | } |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2809 | } |
Jeremy Hayes | 2fdaaf2 | 2016-03-01 17:51:54 -0700 | [diff] [blame] | 2810 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2811 | size_t i = 0; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 2812 | for (size_t j = 0; j < pCreateInfos[i].stageCount; j++) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2813 | validate_string(data->report_data, "vkCreateGraphicsPipelines", |
| 2814 | ParameterName("pCreateInfos[%i].pStages[%i].pName", ParameterName::IndexVector{i, j}), |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2815 | pCreateInfos[i].pStages[j].pName); |
| 2816 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2817 | } |
| 2818 | |
| 2819 | return true; |
| 2820 | } |
| 2821 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 2822 | VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 2823 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
| 2824 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 2825 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2826 | bool skip_call = false; |
| 2827 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 2828 | assert(device_data != nullptr); |
| 2829 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2830 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2831 | skip_call |= parameter_validation_vkCreateGraphicsPipelines(report_data, pipelineCache, createInfoCount, pCreateInfos, |
| 2832 | pAllocator, pPipelines); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 2833 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2834 | if (pCreateInfos != nullptr) { |
| 2835 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
| 2836 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2837 | if (pCreateInfos[i].pTessellationState == nullptr) { |
| 2838 | if (pCreateInfos[i].pStages != nullptr) { |
| 2839 | // If pStages includes a tessellation control shader stage and a tessellation evaluation shader stage, |
| 2840 | // pTessellationState must not be NULL |
| 2841 | bool has_control = false; |
| 2842 | bool has_eval = false; |
| 2843 | |
| 2844 | for (uint32_t stage_index = 0; stage_index < pCreateInfos[i].stageCount; ++stage_index) { |
| 2845 | if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { |
| 2846 | has_control = true; |
| 2847 | } else if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { |
| 2848 | has_eval = true; |
| 2849 | } |
| 2850 | } |
| 2851 | |
| 2852 | if (has_control && has_eval) { |
| 2853 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2854 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 2855 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pStages includes a tessellation " |
| 2856 | "control shader stage and a tessellation evaluation shader stage, " |
| 2857 | "pCreateInfos[%d].pTessellationState must not be NULL", |
| 2858 | i, i); |
| 2859 | } |
| 2860 | } |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2861 | } else { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2862 | skip_call |= validate_struct_pnext( |
| 2863 | report_data, "vkCreateGraphicsPipelines", |
| 2864 | ParameterName("pCreateInfos[%i].pTessellationState->pNext", ParameterName::IndexVector{i}), NULL, |
| 2865 | pCreateInfos[i].pTessellationState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2866 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2867 | skip_call |= validate_reserved_flags( |
| 2868 | report_data, "vkCreateGraphicsPipelines", |
| 2869 | ParameterName("pCreateInfos[%i].pTessellationState->flags", ParameterName::IndexVector{i}), |
| 2870 | pCreateInfos[i].pTessellationState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2871 | |
| 2872 | if (pCreateInfos[i].pTessellationState->sType != VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO) { |
| 2873 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2874 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 2875 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pTessellationState->sType must be " |
| 2876 | "VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO", |
| 2877 | i); |
| 2878 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2879 | } |
| 2880 | |
| 2881 | if (pCreateInfos[i].pViewportState == nullptr) { |
| 2882 | // If the rasterizerDiscardEnable member of pRasterizationState is VK_FALSE, pViewportState must be a pointer to a |
| 2883 | // valid VkPipelineViewportStateCreateInfo structure |
| 2884 | if ((pCreateInfos[i].pRasterizationState != nullptr) && |
| 2885 | (pCreateInfos[i].pRasterizationState->rasterizerDiscardEnable == VK_FALSE)) { |
| 2886 | skip_call |= log_msg( |
| 2887 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2888 | REQUIRED_PARAMETER, LayerName, |
| 2889 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pRasterizationState->rasterizerDiscardEnable is VK_FALSE, " |
| 2890 | "pCreateInfos[%d].pViewportState must be a pointer to a valid VkPipelineViewportStateCreateInfo structure", |
| 2891 | i, i); |
| 2892 | } |
| 2893 | } else { |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2894 | skip_call |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2895 | validate_struct_pnext(report_data, "vkCreateGraphicsPipelines", |
| 2896 | ParameterName("pCreateInfos[%i].pViewportState->pNext", ParameterName::IndexVector{i}), |
| 2897 | NULL, pCreateInfos[i].pViewportState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2898 | |
| 2899 | skip_call |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2900 | validate_reserved_flags(report_data, "vkCreateGraphicsPipelines", |
| 2901 | ParameterName("pCreateInfos[%i].pViewportState->flags", ParameterName::IndexVector{i}), |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2902 | pCreateInfos[i].pViewportState->flags); |
| 2903 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2904 | if (pCreateInfos[i].pViewportState->sType != VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO) { |
| 2905 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2906 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 2907 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pViewportState->sType must be " |
| 2908 | "VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO", |
| 2909 | i); |
| 2910 | } |
| 2911 | |
| 2912 | if (pCreateInfos[i].pDynamicState != nullptr) { |
| 2913 | bool has_dynamic_viewport = false; |
| 2914 | bool has_dynamic_scissor = false; |
| 2915 | |
| 2916 | for (uint32_t state_index = 0; state_index < pCreateInfos[i].pDynamicState->dynamicStateCount; ++state_index) { |
| 2917 | if (pCreateInfos[i].pDynamicState->pDynamicStates[state_index] == VK_DYNAMIC_STATE_VIEWPORT) { |
| 2918 | has_dynamic_viewport = true; |
| 2919 | } else if (pCreateInfos[i].pDynamicState->pDynamicStates[state_index] == VK_DYNAMIC_STATE_SCISSOR) { |
| 2920 | has_dynamic_scissor = true; |
| 2921 | } |
| 2922 | } |
| 2923 | |
| 2924 | // viewportCount must be greater than 0 |
| 2925 | // TODO: viewportCount must be 1 when multiple_viewport feature is not enabled |
| 2926 | if (pCreateInfos[i].pViewportState->viewportCount == 0) { |
| 2927 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2928 | __LINE__, REQUIRED_PARAMETER, LayerName, |
Tobin Ehlis | bebd316 | 2016-08-18 10:53:58 -0600 | [diff] [blame] | 2929 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates does " |
| 2930 | "not contain VK_DYNAMIC_STATE_VIEWPORT, pCreateInfos[%d].pViewportState->viewportCount " |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2931 | "must be greater than 0", |
| 2932 | i, i); |
| 2933 | } |
| 2934 | |
| 2935 | // If no element of the pDynamicStates member of pDynamicState is VK_DYNAMIC_STATE_VIEWPORT, the pViewports |
| 2936 | // member of pViewportState must be a pointer to an array of pViewportState->viewportCount VkViewport structures |
| 2937 | if (!has_dynamic_viewport && (pCreateInfos[i].pViewportState->pViewports == nullptr)) { |
| 2938 | skip_call |= |
| 2939 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2940 | __LINE__, REQUIRED_PARAMETER, LayerName, |
Tobin Ehlis | bebd316 | 2016-08-18 10:53:58 -0600 | [diff] [blame] | 2941 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates does not contain " |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2942 | "VK_DYNAMIC_STATE_VIEWPORT, pCreateInfos[%d].pViewportState->pViewports must not be NULL", |
| 2943 | i, i); |
| 2944 | } |
| 2945 | |
| 2946 | // scissorCount must be greater than 0 |
| 2947 | // TODO: scissorCount must be 1 when multiple_viewport feature is not enabled |
| 2948 | if (pCreateInfos[i].pViewportState->scissorCount == 0) { |
| 2949 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2950 | __LINE__, REQUIRED_PARAMETER, LayerName, |
Tobin Ehlis | bebd316 | 2016-08-18 10:53:58 -0600 | [diff] [blame] | 2951 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates does " |
| 2952 | "not contain VK_DYNAMIC_STATE_SCISSOR, pCreateInfos[%d].pViewportState->scissorCount " |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2953 | "must be greater than 0", |
| 2954 | i, i); |
| 2955 | } |
| 2956 | |
| 2957 | // If no element of the pDynamicStates member of pDynamicState is VK_DYNAMIC_STATE_SCISSOR, the pScissors member |
| 2958 | // of pViewportState must be a pointer to an array of pViewportState->scissorCount VkRect2D structures |
| 2959 | if (!has_dynamic_scissor && (pCreateInfos[i].pViewportState->pScissors == nullptr)) { |
| 2960 | skip_call |= |
| 2961 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2962 | __LINE__, REQUIRED_PARAMETER, LayerName, |
Tobin Ehlis | bebd316 | 2016-08-18 10:53:58 -0600 | [diff] [blame] | 2963 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pDynamicState->pDynamicStates does not contain " |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 2964 | "VK_DYNAMIC_STATE_SCISSOR, pCreateInfos[%d].pViewportState->pScissors must not be NULL", |
| 2965 | i, i); |
| 2966 | } |
| 2967 | } |
| 2968 | } |
| 2969 | |
| 2970 | if (pCreateInfos[i].pMultisampleState == nullptr) { |
| 2971 | // If the rasterizerDiscardEnable member of pRasterizationState is VK_FALSE, pMultisampleState must be a pointer to |
| 2972 | // a valid VkPipelineMultisampleStateCreateInfo structure |
| 2973 | if ((pCreateInfos[i].pRasterizationState != nullptr) && |
| 2974 | pCreateInfos[i].pRasterizationState->rasterizerDiscardEnable == VK_FALSE) { |
| 2975 | skip_call |= |
| 2976 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 2977 | REQUIRED_PARAMETER, LayerName, "vkCreateGraphicsPipelines: if " |
| 2978 | "pCreateInfos[%d].pRasterizationState->rasterizerDiscardEnable is " |
| 2979 | "VK_FALSE, pCreateInfos[%d].pMultisampleState must not be NULL", |
| 2980 | i, i); |
| 2981 | } |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2982 | } else { |
| 2983 | skip_call |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2984 | validate_struct_pnext(report_data, "vkCreateGraphicsPipelines", |
| 2985 | ParameterName("pCreateInfos[%i].pMultisampleState->pNext", ParameterName::IndexVector{i}), |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 2986 | NULL, pCreateInfos[i].pMultisampleState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2987 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2988 | skip_call |= validate_reserved_flags( |
| 2989 | report_data, "vkCreateGraphicsPipelines", |
| 2990 | ParameterName("pCreateInfos[%i].pMultisampleState->flags", ParameterName::IndexVector{i}), |
| 2991 | pCreateInfos[i].pMultisampleState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2992 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2993 | skip_call |= validate_bool32( |
| 2994 | report_data, "vkCreateGraphicsPipelines", |
| 2995 | ParameterName("pCreateInfos[%i].pMultisampleState->sampleShadingEnable", ParameterName::IndexVector{i}), |
| 2996 | pCreateInfos[i].pMultisampleState->sampleShadingEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 2997 | |
| 2998 | skip_call |= validate_array( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 2999 | report_data, "vkCreateGraphicsPipelines", |
| 3000 | ParameterName("pCreateInfos[%i].pMultisampleState->rasterizationSamples", ParameterName::IndexVector{i}), |
| 3001 | ParameterName("pCreateInfos[%i].pMultisampleState->pSampleMask", ParameterName::IndexVector{i}), |
| 3002 | pCreateInfos[i].pMultisampleState->rasterizationSamples, pCreateInfos[i].pMultisampleState->pSampleMask, true, |
| 3003 | false); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3004 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3005 | skip_call |= validate_bool32( |
| 3006 | report_data, "vkCreateGraphicsPipelines", |
| 3007 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToCoverageEnable", ParameterName::IndexVector{i}), |
| 3008 | pCreateInfos[i].pMultisampleState->alphaToCoverageEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3009 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3010 | skip_call |= validate_bool32( |
| 3011 | report_data, "vkCreateGraphicsPipelines", |
| 3012 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToOneEnable", ParameterName::IndexVector{i}), |
| 3013 | pCreateInfos[i].pMultisampleState->alphaToOneEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3014 | |
| 3015 | if (pCreateInfos[i].pMultisampleState->sType != VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO) { |
| 3016 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3017 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 3018 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pMultisampleState->sType must be " |
| 3019 | "VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO", |
| 3020 | i); |
| 3021 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3022 | } |
| 3023 | |
| 3024 | // TODO: Conditional NULL check based on rasterizerDiscardEnable and subpass |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3025 | if (pCreateInfos[i].pDepthStencilState != nullptr) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3026 | skip_call |= validate_struct_pnext( |
| 3027 | report_data, "vkCreateGraphicsPipelines", |
| 3028 | ParameterName("pCreateInfos[%i].pDepthStencilState->pNext", ParameterName::IndexVector{i}), NULL, |
| 3029 | pCreateInfos[i].pDepthStencilState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3030 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3031 | skip_call |= validate_reserved_flags( |
| 3032 | report_data, "vkCreateGraphicsPipelines", |
| 3033 | ParameterName("pCreateInfos[%i].pDepthStencilState->flags", ParameterName::IndexVector{i}), |
| 3034 | pCreateInfos[i].pDepthStencilState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3035 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3036 | skip_call |= validate_bool32( |
| 3037 | report_data, "vkCreateGraphicsPipelines", |
| 3038 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthTestEnable", ParameterName::IndexVector{i}), |
| 3039 | pCreateInfos[i].pDepthStencilState->depthTestEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3040 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3041 | skip_call |= validate_bool32( |
| 3042 | report_data, "vkCreateGraphicsPipelines", |
| 3043 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthWriteEnable", ParameterName::IndexVector{i}), |
| 3044 | pCreateInfos[i].pDepthStencilState->depthWriteEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3045 | |
| 3046 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3047 | report_data, "vkCreateGraphicsPipelines", |
| 3048 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthCompareOp", ParameterName::IndexVector{i}), |
| 3049 | "VkCompareOp", VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, |
| 3050 | pCreateInfos[i].pDepthStencilState->depthCompareOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3051 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3052 | skip_call |= validate_bool32( |
| 3053 | report_data, "vkCreateGraphicsPipelines", |
| 3054 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthBoundsTestEnable", ParameterName::IndexVector{i}), |
| 3055 | pCreateInfos[i].pDepthStencilState->depthBoundsTestEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3056 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3057 | skip_call |= validate_bool32( |
| 3058 | report_data, "vkCreateGraphicsPipelines", |
| 3059 | ParameterName("pCreateInfos[%i].pDepthStencilState->stencilTestEnable", ParameterName::IndexVector{i}), |
| 3060 | pCreateInfos[i].pDepthStencilState->stencilTestEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3061 | |
| 3062 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3063 | report_data, "vkCreateGraphicsPipelines", |
| 3064 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.failOp", ParameterName::IndexVector{i}), |
| 3065 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3066 | pCreateInfos[i].pDepthStencilState->front.failOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3067 | |
| 3068 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3069 | report_data, "vkCreateGraphicsPipelines", |
| 3070 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.passOp", ParameterName::IndexVector{i}), |
| 3071 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3072 | pCreateInfos[i].pDepthStencilState->front.passOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3073 | |
| 3074 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3075 | report_data, "vkCreateGraphicsPipelines", |
| 3076 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.depthFailOp", ParameterName::IndexVector{i}), |
| 3077 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3078 | pCreateInfos[i].pDepthStencilState->front.depthFailOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3079 | |
| 3080 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3081 | report_data, "vkCreateGraphicsPipelines", |
| 3082 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.compareOp", ParameterName::IndexVector{i}), |
| 3083 | "VkCompareOp", VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, |
| 3084 | pCreateInfos[i].pDepthStencilState->front.compareOp); |
| 3085 | |
| 3086 | skip_call |= validate_ranged_enum( |
| 3087 | report_data, "vkCreateGraphicsPipelines", |
| 3088 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.failOp", ParameterName::IndexVector{i}), "VkStencilOp", |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3089 | VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, pCreateInfos[i].pDepthStencilState->back.failOp); |
| 3090 | |
| 3091 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3092 | report_data, "vkCreateGraphicsPipelines", |
| 3093 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.passOp", ParameterName::IndexVector{i}), "VkStencilOp", |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3094 | VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, pCreateInfos[i].pDepthStencilState->back.passOp); |
| 3095 | |
| 3096 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3097 | report_data, "vkCreateGraphicsPipelines", |
| 3098 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.depthFailOp", ParameterName::IndexVector{i}), |
| 3099 | "VkStencilOp", VK_STENCIL_OP_BEGIN_RANGE, VK_STENCIL_OP_END_RANGE, |
| 3100 | pCreateInfos[i].pDepthStencilState->back.depthFailOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3101 | |
| 3102 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3103 | report_data, "vkCreateGraphicsPipelines", |
| 3104 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.compareOp", ParameterName::IndexVector{i}), |
| 3105 | "VkCompareOp", VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, |
| 3106 | pCreateInfos[i].pDepthStencilState->back.compareOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3107 | |
| 3108 | if (pCreateInfos[i].pDepthStencilState->sType != VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO) { |
| 3109 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3110 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 3111 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pDepthStencilState->sType must be " |
| 3112 | "VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO", |
| 3113 | i); |
| 3114 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3115 | } |
| 3116 | |
| 3117 | // TODO: Conditional NULL check based on rasterizerDiscardEnable and subpass |
| 3118 | if (pCreateInfos[i].pColorBlendState != nullptr) { |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3119 | skip_call |= |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3120 | validate_struct_pnext(report_data, "vkCreateGraphicsPipelines", |
| 3121 | ParameterName("pCreateInfos[%i].pColorBlendState->pNext", ParameterName::IndexVector{i}), |
| 3122 | NULL, pCreateInfos[i].pColorBlendState->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3123 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3124 | skip_call |= validate_reserved_flags( |
| 3125 | report_data, "vkCreateGraphicsPipelines", |
| 3126 | ParameterName("pCreateInfos[%i].pColorBlendState->flags", ParameterName::IndexVector{i}), |
| 3127 | pCreateInfos[i].pColorBlendState->flags); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3128 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3129 | skip_call |= validate_bool32( |
| 3130 | report_data, "vkCreateGraphicsPipelines", |
| 3131 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOpEnable", ParameterName::IndexVector{i}), |
| 3132 | pCreateInfos[i].pColorBlendState->logicOpEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3133 | |
| 3134 | skip_call |= validate_array( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3135 | report_data, "vkCreateGraphicsPipelines", |
| 3136 | ParameterName("pCreateInfos[%i].pColorBlendState->attachmentCount", ParameterName::IndexVector{i}), |
| 3137 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments", ParameterName::IndexVector{i}), |
| 3138 | pCreateInfos[i].pColorBlendState->attachmentCount, pCreateInfos[i].pColorBlendState->pAttachments, false, true); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3139 | |
| 3140 | if (pCreateInfos[i].pColorBlendState->pAttachments != NULL) { |
| 3141 | for (uint32_t attachmentIndex = 0; attachmentIndex < pCreateInfos[i].pColorBlendState->attachmentCount; |
| 3142 | ++attachmentIndex) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3143 | skip_call |= |
| 3144 | validate_bool32(report_data, "vkCreateGraphicsPipelines", |
| 3145 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].blendEnable", |
| 3146 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3147 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].blendEnable); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3148 | |
| 3149 | skip_call |= validate_ranged_enum( |
| 3150 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3151 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcColorBlendFactor", |
| 3152 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3153 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3154 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].srcColorBlendFactor); |
| 3155 | |
| 3156 | skip_call |= validate_ranged_enum( |
| 3157 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3158 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstColorBlendFactor", |
| 3159 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3160 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3161 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].dstColorBlendFactor); |
| 3162 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3163 | skip_call |= |
| 3164 | validate_ranged_enum(report_data, "vkCreateGraphicsPipelines", |
| 3165 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorBlendOp", |
| 3166 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3167 | "VkBlendOp", VK_BLEND_OP_BEGIN_RANGE, VK_BLEND_OP_END_RANGE, |
| 3168 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].colorBlendOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3169 | |
| 3170 | skip_call |= validate_ranged_enum( |
| 3171 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3172 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcAlphaBlendFactor", |
| 3173 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3174 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3175 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].srcAlphaBlendFactor); |
| 3176 | |
| 3177 | skip_call |= validate_ranged_enum( |
| 3178 | report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3179 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstAlphaBlendFactor", |
| 3180 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3181 | "VkBlendFactor", VK_BLEND_FACTOR_BEGIN_RANGE, VK_BLEND_FACTOR_END_RANGE, |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3182 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].dstAlphaBlendFactor); |
| 3183 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3184 | skip_call |= |
| 3185 | validate_ranged_enum(report_data, "vkCreateGraphicsPipelines", |
| 3186 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].alphaBlendOp", |
| 3187 | ParameterName::IndexVector{i, attachmentIndex}), |
| 3188 | "VkBlendOp", VK_BLEND_OP_BEGIN_RANGE, VK_BLEND_OP_END_RANGE, |
| 3189 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].alphaBlendOp); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3190 | |
| 3191 | skip_call |= |
| 3192 | validate_flags(report_data, "vkCreateGraphicsPipelines", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3193 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorWriteMask", |
| 3194 | ParameterName::IndexVector{i, attachmentIndex}), |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3195 | "VkColorComponentFlagBits", AllVkColorComponentFlagBits, |
| 3196 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].colorWriteMask, false); |
| 3197 | } |
| 3198 | } |
| 3199 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3200 | if (pCreateInfos[i].pColorBlendState->sType != VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO) { |
| 3201 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3202 | __LINE__, INVALID_STRUCT_STYPE, LayerName, |
| 3203 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pColorBlendState->sType must be " |
| 3204 | "VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO", |
| 3205 | i); |
| 3206 | } |
| 3207 | |
| 3208 | // If logicOpEnable is VK_TRUE, logicOp must be a valid VkLogicOp value |
| 3209 | if (pCreateInfos[i].pColorBlendState->logicOpEnable == VK_TRUE) { |
| 3210 | skip_call |= validate_ranged_enum( |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3211 | report_data, "vkCreateGraphicsPipelines", |
| 3212 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOp", ParameterName::IndexVector{i}), "VkLogicOp", |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3213 | VK_LOGIC_OP_BEGIN_RANGE, VK_LOGIC_OP_END_RANGE, pCreateInfos[i].pColorBlendState->logicOp); |
| 3214 | } |
| 3215 | } |
| 3216 | } |
| 3217 | } |
| 3218 | |
| 3219 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3220 | PreCreateGraphicsPipelines(device, pCreateInfos); |
| 3221 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3222 | result = get_dispatch_table(pc_device_table_map, device) |
| 3223 | ->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3224 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3225 | validate_result(report_data, "vkCreateGraphicsPipelines", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3226 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3227 | |
| 3228 | return result; |
| 3229 | } |
| 3230 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3231 | bool PreCreateComputePipelines(VkDevice device, const VkComputePipelineCreateInfo *pCreateInfos) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 3232 | layer_data *data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3233 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3234 | if (pCreateInfos != nullptr) { |
| 3235 | // TODO: Handle count! |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3236 | uint32_t i = 0; |
| 3237 | validate_string(data->report_data, "vkCreateComputePipelines", |
| 3238 | ParameterName("pCreateInfos[%i].stage.pName", ParameterName::IndexVector{i}), pCreateInfos[i].stage.pName); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3239 | } |
| 3240 | |
| 3241 | return true; |
| 3242 | } |
| 3243 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3244 | VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 3245 | const VkComputePipelineCreateInfo *pCreateInfos, |
| 3246 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3247 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3248 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3249 | 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] | 3250 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3251 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3252 | skip_call |= parameter_validation_vkCreateComputePipelines(my_data->report_data, pipelineCache, createInfoCount, pCreateInfos, |
| 3253 | pAllocator, pPipelines); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3254 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3255 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3256 | PreCreateComputePipelines(device, pCreateInfos); |
| 3257 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3258 | result = get_dispatch_table(pc_device_table_map, device) |
| 3259 | ->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3260 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3261 | validate_result(my_data->report_data, "vkCreateComputePipelines", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3262 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3263 | |
| 3264 | return result; |
| 3265 | } |
| 3266 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3267 | VKAPI_ATTR void VKAPI_CALL DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) { |
| 3268 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3269 | 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] | 3270 | assert(my_data != NULL); |
| 3271 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3272 | skip_call |= parameter_validation_vkDestroyPipeline(my_data->report_data, pipeline, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3273 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3274 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3275 | get_dispatch_table(pc_device_table_map, device)->DestroyPipeline(device, pipeline, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3276 | } |
| 3277 | } |
| 3278 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3279 | VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, |
| 3280 | const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3281 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3282 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3283 | 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] | 3284 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3285 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3286 | skip_call |= parameter_validation_vkCreatePipelineLayout(my_data->report_data, pCreateInfo, pAllocator, pPipelineLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3287 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3288 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3289 | result = |
| 3290 | 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] | 3291 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3292 | validate_result(my_data->report_data, "vkCreatePipelineLayout", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3293 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3294 | |
| 3295 | return result; |
| 3296 | } |
| 3297 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3298 | VKAPI_ATTR void VKAPI_CALL DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, |
| 3299 | const VkAllocationCallbacks *pAllocator) { |
| 3300 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3301 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3302 | assert(my_data != NULL); |
| 3303 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3304 | skip_call |= parameter_validation_vkDestroyPipelineLayout(my_data->report_data, pipelineLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3305 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3306 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3307 | get_dispatch_table(pc_device_table_map, device)->DestroyPipelineLayout(device, pipelineLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3308 | } |
| 3309 | } |
| 3310 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3311 | VKAPI_ATTR VkResult VKAPI_CALL CreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, |
| 3312 | const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3313 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3314 | bool skip_call = false; |
| 3315 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3316 | assert(device_data != NULL); |
| 3317 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3318 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3319 | skip_call |= parameter_validation_vkCreateSampler(report_data, pCreateInfo, pAllocator, pSampler); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3320 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3321 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3322 | if (pCreateInfo != nullptr) { |
| 3323 | // If compareEnable is VK_TRUE, compareOp must be a valid VkCompareOp value |
| 3324 | if (pCreateInfo->compareEnable == VK_TRUE) { |
| 3325 | skip_call |= validate_ranged_enum(report_data, "vkCreateSampler", "pCreateInfo->compareOp", "VkCompareOp", |
| 3326 | VK_COMPARE_OP_BEGIN_RANGE, VK_COMPARE_OP_END_RANGE, pCreateInfo->compareOp); |
| 3327 | } |
| 3328 | |
| 3329 | // If any of addressModeU, addressModeV or addressModeW are VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, borderColor must be a |
| 3330 | // valid VkBorderColor value |
| 3331 | if ((pCreateInfo->addressModeU == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 3332 | (pCreateInfo->addressModeV == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 3333 | (pCreateInfo->addressModeW == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)) { |
| 3334 | skip_call |= validate_ranged_enum(report_data, "vkCreateSampler", "pCreateInfo->borderColor", "VkBorderColor", |
| 3335 | VK_BORDER_COLOR_BEGIN_RANGE, VK_BORDER_COLOR_END_RANGE, pCreateInfo->borderColor); |
| 3336 | } |
| 3337 | } |
| 3338 | |
| 3339 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3340 | result = get_dispatch_table(pc_device_table_map, device)->CreateSampler(device, pCreateInfo, pAllocator, pSampler); |
| 3341 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3342 | validate_result(report_data, "vkCreateSampler", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3343 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3344 | |
| 3345 | return result; |
| 3346 | } |
| 3347 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3348 | VKAPI_ATTR void VKAPI_CALL DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator) { |
| 3349 | bool skip_call = 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 | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3353 | skip_call |= parameter_validation_vkDestroySampler(my_data->report_data, sampler, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3354 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3355 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3356 | get_dispatch_table(pc_device_table_map, device)->DestroySampler(device, sampler, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3357 | } |
| 3358 | } |
| 3359 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3360 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
| 3361 | const VkAllocationCallbacks *pAllocator, |
| 3362 | VkDescriptorSetLayout *pSetLayout) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3363 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3364 | bool skip_call = false; |
| 3365 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3366 | assert(device_data != nullptr); |
| 3367 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3368 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3369 | skip_call |= parameter_validation_vkCreateDescriptorSetLayout(report_data, pCreateInfo, pAllocator, pSetLayout); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3370 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3371 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3372 | if ((pCreateInfo != nullptr) && (pCreateInfo->pBindings != nullptr)) { |
| 3373 | for (uint32_t i = 0; i < pCreateInfo->bindingCount; ++i) { |
| 3374 | if (pCreateInfo->pBindings[i].descriptorCount != 0) { |
| 3375 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER or VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, and descriptorCount |
| 3376 | // is not 0 and pImmutableSamplers is not NULL, pImmutableSamplers must be a pointer to an array of descriptorCount |
| 3377 | // valid VkSampler handles |
| 3378 | if (((pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 3379 | (pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)) && |
| 3380 | (pCreateInfo->pBindings[i].pImmutableSamplers != nullptr)) { |
| 3381 | for (uint32_t descriptor_index = 0; descriptor_index < pCreateInfo->pBindings[i].descriptorCount; |
| 3382 | ++descriptor_index) { |
| 3383 | if (pCreateInfo->pBindings[i].pImmutableSamplers[descriptor_index] == VK_NULL_HANDLE) { |
| 3384 | skip_call |= |
| 3385 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3386 | __LINE__, REQUIRED_PARAMETER, LayerName, "vkCreateDescriptorSetLayout: required parameter " |
| 3387 | "pCreateInfo->pBindings[%d].pImmutableSamplers[%d]" |
| 3388 | " specified as VK_NULL_HANDLE", |
| 3389 | i, descriptor_index); |
| 3390 | } |
| 3391 | } |
| 3392 | } |
| 3393 | |
| 3394 | // If descriptorCount is not 0, stageFlags must be a valid combination of VkShaderStageFlagBits values |
| 3395 | if ((pCreateInfo->pBindings[i].stageFlags != 0) && |
| 3396 | ((pCreateInfo->pBindings[i].stageFlags & (~AllVkShaderStageFlagBits)) != 0)) { |
| 3397 | skip_call |= |
| 3398 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3399 | UNRECOGNIZED_VALUE, LayerName, |
| 3400 | "vkCreateDescriptorSetLayout: if pCreateInfo->pBindings[%d].descriptorCount is not 0, " |
| 3401 | "pCreateInfo->pBindings[%d].stageFlags must be a valid combination of VkShaderStageFlagBits values", |
| 3402 | i, i); |
| 3403 | } |
| 3404 | } |
| 3405 | } |
| 3406 | } |
| 3407 | |
| 3408 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3409 | result = |
| 3410 | 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] | 3411 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3412 | validate_result(report_data, "vkCreateDescriptorSetLayout", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3413 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3414 | |
| 3415 | return result; |
| 3416 | } |
| 3417 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3418 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, |
| 3419 | const VkAllocationCallbacks *pAllocator) { |
| 3420 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3421 | 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] | 3422 | assert(my_data != NULL); |
| 3423 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3424 | skip_call |= parameter_validation_vkDestroyDescriptorSetLayout(my_data->report_data, descriptorSetLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3425 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3426 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3427 | get_dispatch_table(pc_device_table_map, device)->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3428 | } |
| 3429 | } |
| 3430 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3431 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, |
| 3432 | const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3433 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3434 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3435 | 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] | 3436 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3437 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3438 | skip_call |= parameter_validation_vkCreateDescriptorPool(my_data->report_data, pCreateInfo, pAllocator, pDescriptorPool); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3439 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3440 | /* TODOVV: How do we validate maxSets? Probably belongs in the limits layer? */ |
| 3441 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3442 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3443 | result = |
| 3444 | 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] | 3445 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3446 | validate_result(my_data->report_data, "vkCreateDescriptorPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3447 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3448 | |
| 3449 | return result; |
| 3450 | } |
| 3451 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3452 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 3453 | const VkAllocationCallbacks *pAllocator) { |
| 3454 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3455 | 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] | 3456 | assert(my_data != NULL); |
| 3457 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3458 | skip_call |= parameter_validation_vkDestroyDescriptorPool(my_data->report_data, descriptorPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3459 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3460 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3461 | get_dispatch_table(pc_device_table_map, device)->DestroyDescriptorPool(device, descriptorPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3462 | } |
| 3463 | } |
| 3464 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3465 | VKAPI_ATTR VkResult VKAPI_CALL ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 3466 | VkDescriptorPoolResetFlags flags) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3467 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3468 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3469 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3470 | assert(my_data != NULL); |
| 3471 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3472 | skip_call |= parameter_validation_vkResetDescriptorPool(my_data->report_data, descriptorPool, flags); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3473 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3474 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3475 | result = get_dispatch_table(pc_device_table_map, device)->ResetDescriptorPool(device, descriptorPool, flags); |
| 3476 | |
| 3477 | validate_result(my_data->report_data, "vkResetDescriptorPool", result); |
| 3478 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3479 | |
| 3480 | return result; |
| 3481 | } |
| 3482 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3483 | VKAPI_ATTR VkResult VKAPI_CALL AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, |
| 3484 | VkDescriptorSet *pDescriptorSets) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3485 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3486 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3487 | 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] | 3488 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3489 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3490 | skip_call |= parameter_validation_vkAllocateDescriptorSets(my_data->report_data, pAllocateInfo, pDescriptorSets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3491 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3492 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3493 | result = get_dispatch_table(pc_device_table_map, device)->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets); |
| 3494 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3495 | validate_result(my_data->report_data, "vkAllocateDescriptorSets", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3496 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3497 | |
| 3498 | return result; |
| 3499 | } |
| 3500 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3501 | VKAPI_ATTR VkResult VKAPI_CALL FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3502 | const VkDescriptorSet *pDescriptorSets) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3503 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3504 | bool skip_call = false; |
| 3505 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3506 | assert(device_data != nullptr); |
| 3507 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3508 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3509 | skip_call |= parameter_validation_vkFreeDescriptorSets(report_data, descriptorPool, descriptorSetCount, pDescriptorSets); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3510 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3511 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3512 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 3513 | // validate_array() |
| 3514 | skip_call |= validate_array(report_data, "vkFreeDescriptorSets", "descriptorSetCount", "pDescriptorSets", descriptorSetCount, |
| 3515 | pDescriptorSets, true, true); |
| 3516 | |
| 3517 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3518 | result = get_dispatch_table(pc_device_table_map, device) |
| 3519 | ->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3520 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3521 | validate_result(report_data, "vkFreeDescriptorSets", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3522 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3523 | |
| 3524 | return result; |
| 3525 | } |
| 3526 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3527 | VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, |
| 3528 | const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, |
| 3529 | const VkCopyDescriptorSet *pDescriptorCopies) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3530 | bool skip_call = false; |
| 3531 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3532 | assert(device_data != NULL); |
| 3533 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3534 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3535 | skip_call |= parameter_validation_vkUpdateDescriptorSets(report_data, descriptorWriteCount, pDescriptorWrites, |
| 3536 | descriptorCopyCount, pDescriptorCopies); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3537 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3538 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3539 | if (pDescriptorWrites != NULL) { |
| 3540 | for (uint32_t i = 0; i < descriptorWriteCount; ++i) { |
| 3541 | // descriptorCount must be greater than 0 |
| 3542 | if (pDescriptorWrites[i].descriptorCount == 0) { |
| 3543 | skip_call |= |
| 3544 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3545 | REQUIRED_PARAMETER, LayerName, |
| 3546 | "vkUpdateDescriptorSets: parameter pDescriptorWrites[%d].descriptorCount must be greater than 0", i); |
| 3547 | } |
| 3548 | |
| 3549 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 3550 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || |
| 3551 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || |
| 3552 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || |
| 3553 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)) { |
| 3554 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, |
| 3555 | // VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, |
| 3556 | // pImageInfo must be a pointer to an array of descriptorCount valid VkDescriptorImageInfo structures |
| 3557 | if (pDescriptorWrites[i].pImageInfo == nullptr) { |
| 3558 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3559 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 3560 | "vkUpdateDescriptorSets: if pDescriptorWrites[%d].descriptorType is " |
| 3561 | "VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, " |
| 3562 | "VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or " |
| 3563 | "VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, pDescriptorWrites[%d].pImageInfo must not be NULL", |
| 3564 | i, i); |
| 3565 | } else if (pDescriptorWrites[i].descriptorType != VK_DESCRIPTOR_TYPE_SAMPLER) { |
| 3566 | // If descriptorType is VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, |
| 3567 | // VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, the imageView and imageLayout |
| 3568 | // members of any given element of pImageInfo must be a valid VkImageView and VkImageLayout, respectively |
| 3569 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3570 | ++descriptor_index) { |
| 3571 | skip_call |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3572 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageView", |
| 3573 | ParameterName::IndexVector{i, descriptor_index}), |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3574 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageView); |
| 3575 | skip_call |= validate_ranged_enum(report_data, "vkUpdateDescriptorSets", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3576 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageLayout", |
| 3577 | ParameterName::IndexVector{i, descriptor_index}), |
| 3578 | "VkImageLayout", VK_IMAGE_LAYOUT_BEGIN_RANGE, VK_IMAGE_LAYOUT_END_RANGE, |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3579 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageLayout); |
| 3580 | } |
| 3581 | } |
| 3582 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 3583 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 3584 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || |
| 3585 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 3586 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 3587 | // VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, pBufferInfo must be a |
| 3588 | // pointer to an array of descriptorCount valid VkDescriptorBufferInfo structures |
| 3589 | if (pDescriptorWrites[i].pBufferInfo == nullptr) { |
| 3590 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3591 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 3592 | "vkUpdateDescriptorSets: if pDescriptorWrites[%d].descriptorType is " |
| 3593 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, " |
| 3594 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, " |
| 3595 | "pDescriptorWrites[%d].pBufferInfo must not be NULL", |
| 3596 | i, i); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3597 | } else { |
| 3598 | for (uint32_t descriptorIndex = 0; descriptorIndex < pDescriptorWrites[i].descriptorCount; ++descriptorIndex) { |
| 3599 | skip_call |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3600 | ParameterName("pDescriptorWrites[%i].pBufferInfo[%i].buffer", |
| 3601 | ParameterName::IndexVector{i, descriptorIndex}), |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3602 | pDescriptorWrites[i].pBufferInfo[descriptorIndex].buffer); |
| 3603 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3604 | } |
| 3605 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || |
| 3606 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { |
| 3607 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, |
| 3608 | // pTexelBufferView must be a pointer to an array of descriptorCount valid VkBufferView handles |
| 3609 | if (pDescriptorWrites[i].pTexelBufferView == nullptr) { |
| 3610 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3611 | __LINE__, REQUIRED_PARAMETER, LayerName, |
| 3612 | "vkUpdateDescriptorSets: if pDescriptorWrites[%d].descriptorType is " |
| 3613 | "VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, " |
| 3614 | "pDescriptorWrites[%d].pTexelBufferView must not be NULL", |
| 3615 | i, i); |
| 3616 | } else { |
| 3617 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3618 | ++descriptor_index) { |
| 3619 | skip_call |= validate_required_handle(report_data, "vkUpdateDescriptorSets", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 3620 | ParameterName("pDescriptorWrites[%i].pTexelBufferView[%i]", |
| 3621 | ParameterName::IndexVector{i, descriptor_index}), |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3622 | pDescriptorWrites[i].pTexelBufferView[descriptor_index]); |
| 3623 | } |
| 3624 | } |
| 3625 | } |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3626 | |
| 3627 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 3628 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)) { |
| 3629 | VkDeviceSize uniformAlignment = device_data->device_limits.minUniformBufferOffsetAlignment; |
| 3630 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 3631 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
| 3632 | if (vk_safe_modulo(pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment) != 0) { |
| 3633 | skip_call |= |
| 3634 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 3635 | VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, DEVICE_LIMIT, LayerName, |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3636 | "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 3637 | ") must be a multiple of device limit minUniformBufferOffsetAlignment 0x%" PRIxLEAST64, |
| 3638 | i, j, pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment); |
| 3639 | } |
| 3640 | } |
| 3641 | } |
| 3642 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 3643 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 3644 | VkDeviceSize storageAlignment = device_data->device_limits.minStorageBufferOffsetAlignment; |
| 3645 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 3646 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
| 3647 | if (vk_safe_modulo(pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment) != 0) { |
| 3648 | skip_call |= |
| 3649 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 3650 | VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, DEVICE_LIMIT, LayerName, |
Mark Lobodzinski | 1a34d7e | 2016-06-28 11:51:16 -0600 | [diff] [blame] | 3651 | "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 3652 | ") must be a multiple of device limit minStorageBufferOffsetAlignment 0x%" PRIxLEAST64, |
| 3653 | i, j, pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment); |
| 3654 | } |
| 3655 | } |
| 3656 | } |
| 3657 | } |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3658 | } |
| 3659 | } |
| 3660 | |
| 3661 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3662 | get_dispatch_table(pc_device_table_map, device) |
| 3663 | ->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3664 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3665 | } |
| 3666 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3667 | VKAPI_ATTR VkResult VKAPI_CALL CreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3668 | const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3669 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3670 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3671 | 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] | 3672 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3673 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3674 | skip_call |= parameter_validation_vkCreateFramebuffer(my_data->report_data, pCreateInfo, pAllocator, pFramebuffer); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3675 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3676 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3677 | result = get_dispatch_table(pc_device_table_map, device)->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer); |
| 3678 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3679 | validate_result(my_data->report_data, "vkCreateFramebuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3680 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3681 | |
| 3682 | return result; |
| 3683 | } |
| 3684 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3685 | VKAPI_ATTR void VKAPI_CALL DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator) { |
| 3686 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3687 | 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] | 3688 | assert(my_data != NULL); |
| 3689 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3690 | skip_call |= parameter_validation_vkDestroyFramebuffer(my_data->report_data, framebuffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3691 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3692 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3693 | get_dispatch_table(pc_device_table_map, device)->DestroyFramebuffer(device, framebuffer, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3694 | } |
| 3695 | } |
| 3696 | |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3697 | bool PreCreateRenderPass(layer_data *dev_data, const VkRenderPassCreateInfo *pCreateInfo) { |
| 3698 | bool skip_call = false; |
| 3699 | uint32_t max_color_attachments = dev_data->device_limits.maxColorAttachments; |
| 3700 | |
| 3701 | for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) { |
| 3702 | if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) { |
| 3703 | skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3704 | __LINE__, DEVICE_LIMIT, "DL", "Cannot create a render pass with %d color attachments. Max is %d.", |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3705 | pCreateInfo->pSubpasses[i].colorAttachmentCount, max_color_attachments); |
| 3706 | } |
| 3707 | } |
| 3708 | return skip_call; |
| 3709 | } |
| 3710 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3711 | VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3712 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3713 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3714 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3715 | 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] | 3716 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3717 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3718 | skip_call |= parameter_validation_vkCreateRenderPass(my_data->report_data, pCreateInfo, pAllocator, pRenderPass); |
| 3719 | skip_call |= PreCreateRenderPass(my_data, pCreateInfo); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3720 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3721 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3722 | result = get_dispatch_table(pc_device_table_map, device)->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass); |
| 3723 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3724 | validate_result(my_data->report_data, "vkCreateRenderPass", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3725 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3726 | |
| 3727 | return result; |
| 3728 | } |
| 3729 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3730 | VKAPI_ATTR void VKAPI_CALL DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator) { |
| 3731 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3732 | 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] | 3733 | assert(my_data != NULL); |
| 3734 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3735 | skip_call |= parameter_validation_vkDestroyRenderPass(my_data->report_data, renderPass, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3736 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3737 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3738 | get_dispatch_table(pc_device_table_map, device)->DestroyRenderPass(device, renderPass, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3739 | } |
| 3740 | } |
| 3741 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3742 | VKAPI_ATTR void VKAPI_CALL GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity) { |
| 3743 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3744 | 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] | 3745 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3746 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3747 | skip_call |= parameter_validation_vkGetRenderAreaGranularity(my_data->report_data, renderPass, pGranularity); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3748 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3749 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3750 | get_dispatch_table(pc_device_table_map, device)->GetRenderAreaGranularity(device, renderPass, pGranularity); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3751 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3752 | } |
| 3753 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3754 | VKAPI_ATTR VkResult VKAPI_CALL CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3755 | const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3756 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3757 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3758 | 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] | 3759 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3760 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3761 | skip_call |= |
Dustin Graves | de62853 | 2016-04-21 16:30:17 -0600 | [diff] [blame] | 3762 | validate_queue_family_index(my_data, "vkCreateCommandPool", "pCreateInfo->queueFamilyIndex", pCreateInfo->queueFamilyIndex); |
Mark Lobodzinski | f20f094 | 2016-03-22 10:07:26 -0600 | [diff] [blame] | 3763 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3764 | skip_call |= parameter_validation_vkCreateCommandPool(my_data->report_data, pCreateInfo, pAllocator, pCommandPool); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3765 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3766 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3767 | result = get_dispatch_table(pc_device_table_map, device)->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); |
| 3768 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3769 | validate_result(my_data->report_data, "vkCreateCommandPool", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3770 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3771 | |
| 3772 | return result; |
| 3773 | } |
| 3774 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3775 | VKAPI_ATTR void VKAPI_CALL DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator) { |
| 3776 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3777 | 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] | 3778 | assert(my_data != NULL); |
| 3779 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3780 | skip_call |= parameter_validation_vkDestroyCommandPool(my_data->report_data, commandPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3781 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3782 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3783 | get_dispatch_table(pc_device_table_map, device)->DestroyCommandPool(device, commandPool, pAllocator); |
Dustin Graves | 27a912a | 2016-03-07 17:52:14 -0700 | [diff] [blame] | 3784 | } |
| 3785 | } |
| 3786 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3787 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3788 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3789 | bool skip_call = false; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3790 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3791 | assert(my_data != NULL); |
| 3792 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3793 | skip_call |= parameter_validation_vkResetCommandPool(my_data->report_data, commandPool, flags); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3794 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3795 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 3796 | result = get_dispatch_table(pc_device_table_map, device)->ResetCommandPool(device, commandPool, flags); |
| 3797 | |
| 3798 | validate_result(my_data->report_data, "vkResetCommandPool", result); |
| 3799 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 3800 | |
| 3801 | return result; |
| 3802 | } |
| 3803 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3804 | VKAPI_ATTR VkResult VKAPI_CALL AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, |
| 3805 | VkCommandBuffer *pCommandBuffers) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3806 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3807 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3808 | 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] | 3809 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3810 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3811 | skip_call |= parameter_validation_vkAllocateCommandBuffers(my_data->report_data, pAllocateInfo, pCommandBuffers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3812 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3813 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3814 | result = get_dispatch_table(pc_device_table_map, device)->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers); |
| 3815 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3816 | validate_result(my_data->report_data, "vkAllocateCommandBuffers", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3817 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3818 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3819 | return result; |
| 3820 | } |
| 3821 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3822 | VKAPI_ATTR void VKAPI_CALL FreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3823 | const VkCommandBuffer *pCommandBuffers) { |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3824 | bool skip_call = false; |
| 3825 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3826 | assert(device_data != nullptr); |
| 3827 | debug_report_data *report_data = device_data->report_data; |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3828 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3829 | skip_call |= parameter_validation_vkFreeCommandBuffers(report_data, commandPool, commandBufferCount, pCommandBuffers); |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3830 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3831 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3832 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 3833 | // validate_array() |
| 3834 | skip_call |= validate_array(report_data, "vkFreeCommandBuffers", "commandBufferCount", "pCommandBuffers", commandBufferCount, |
| 3835 | pCommandBuffers, true, true); |
| 3836 | |
| 3837 | if (!skip_call) { |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3838 | get_dispatch_table(pc_device_table_map, device) |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3839 | ->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers); |
Dustin Graves | a2b2e46 | 2016-02-26 11:53:28 -0700 | [diff] [blame] | 3840 | } |
| 3841 | } |
| 3842 | |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3843 | bool PreBeginCommandBuffer(layer_data *dev_data, VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) { |
| 3844 | bool skip_call = false; |
| 3845 | layer_data *phy_dev_data = get_my_data_ptr(get_dispatch_key(dev_data->physical_device), layer_data_map); |
| 3846 | const VkCommandBufferInheritanceInfo *pInfo = pBeginInfo->pInheritanceInfo; |
| 3847 | |
| 3848 | if (pInfo != NULL) { |
| 3849 | if ((phy_dev_data->physical_device_features.inheritedQueries == VK_FALSE) && (pInfo->occlusionQueryEnable != VK_FALSE)) { |
| 3850 | skip_call |= |
| 3851 | log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 3852 | reinterpret_cast<uint64_t>(commandBuffer), __LINE__, DEVICE_FEATURE, LayerName, |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3853 | "Cannot set inherited occlusionQueryEnable in vkBeginCommandBuffer() when device does not support " |
| 3854 | "inheritedQueries."); |
| 3855 | } |
| 3856 | |
| 3857 | if ((phy_dev_data->physical_device_features.inheritedQueries != VK_FALSE) && (pInfo->occlusionQueryEnable != VK_FALSE) && |
| 3858 | (!validate_VkQueryControlFlagBits(VkQueryControlFlagBits(pInfo->queryFlags)))) { |
| 3859 | skip_call |= |
| 3860 | log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 3861 | reinterpret_cast<uint64_t>(commandBuffer), __LINE__, DEVICE_FEATURE, LayerName, |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3862 | "Cannot enable in occlusion queries in vkBeginCommandBuffer() and set queryFlags to %d which is not a " |
| 3863 | "valid combination of VkQueryControlFlagBits.", |
| 3864 | pInfo->queryFlags); |
| 3865 | } |
| 3866 | } |
| 3867 | return skip_call; |
| 3868 | } |
| 3869 | |
| 3870 | VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3871 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3872 | bool skip_call = false; |
| 3873 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3874 | assert(device_data != nullptr); |
| 3875 | debug_report_data *report_data = device_data->report_data; |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 3876 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3877 | skip_call |= parameter_validation_vkBeginCommandBuffer(report_data, pBeginInfo); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3878 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3879 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3880 | // TODO: pBeginInfo->pInheritanceInfo must not be NULL if commandBuffer is a secondary command buffer |
| 3881 | skip_call |= validate_struct_type(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo", |
| 3882 | "VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO", pBeginInfo->pInheritanceInfo, |
| 3883 | VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, false); |
| 3884 | |
| 3885 | if (pBeginInfo->pInheritanceInfo != NULL) { |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3886 | skip_call |= validate_struct_pnext(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->pNext", NULL, |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 3887 | pBeginInfo->pInheritanceInfo->pNext, 0, NULL, GeneratedHeaderVersion); |
Dustin Graves | 629259b | 2016-05-30 16:14:27 -0600 | [diff] [blame] | 3888 | |
| 3889 | skip_call |= validate_bool32(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->occlusionQueryEnable", |
| 3890 | pBeginInfo->pInheritanceInfo->occlusionQueryEnable); |
| 3891 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3892 | // TODO: This only needs to be validated when the inherited queries feature is enabled |
| 3893 | // skip_call |= validate_flags(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->queryFlags", |
| 3894 | // "VkQueryControlFlagBits", AllVkQueryControlFlagBits, pBeginInfo->pInheritanceInfo->queryFlags, false); |
| 3895 | |
| 3896 | // TODO: This must be 0 if the pipeline statistics queries feature is not enabled |
| 3897 | skip_call |= validate_flags(report_data, "vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->pipelineStatistics", |
| 3898 | "VkQueryPipelineStatisticFlagBits", AllVkQueryPipelineStatisticFlagBits, |
| 3899 | pBeginInfo->pInheritanceInfo->pipelineStatistics, false); |
| 3900 | } |
| 3901 | |
Mark Lobodzinski | 4dc6cb0 | 2016-06-28 11:23:08 -0600 | [diff] [blame] | 3902 | skip_call |= PreBeginCommandBuffer(device_data, commandBuffer, pBeginInfo); |
| 3903 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3904 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3905 | result = get_dispatch_table(pc_device_table_map, commandBuffer)->BeginCommandBuffer(commandBuffer, pBeginInfo); |
| 3906 | |
Dustin Graves | c900f57 | 2016-05-16 11:07:59 -0600 | [diff] [blame] | 3907 | validate_result(report_data, "vkBeginCommandBuffer", result); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3908 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3909 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3910 | return result; |
| 3911 | } |
| 3912 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 3913 | VKAPI_ATTR VkResult VKAPI_CALL EndCommandBuffer(VkCommandBuffer commandBuffer) { |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3914 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3915 | assert(my_data != NULL); |
| 3916 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 3917 | VkResult result = get_dispatch_table(pc_device_table_map, commandBuffer)->EndCommandBuffer(commandBuffer); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3918 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3919 | validate_result(my_data->report_data, "vkEndCommandBuffer", result); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3920 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3921 | return result; |
| 3922 | } |
| 3923 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3924 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) { |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 3925 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 3926 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3927 | assert(my_data != NULL); |
| 3928 | |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 3929 | bool skip_call = parameter_validation_vkResetCommandBuffer(my_data->report_data, flags); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3930 | |
Dustin Graves | 16d1897 | 2016-05-09 17:36:57 -0600 | [diff] [blame] | 3931 | if (!skip_call) { |
| 3932 | result = get_dispatch_table(pc_device_table_map, commandBuffer)->ResetCommandBuffer(commandBuffer, flags); |
| 3933 | |
| 3934 | validate_result(my_data->report_data, "vkResetCommandBuffer", result); |
| 3935 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3936 | |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 3937 | return result; |
| 3938 | } |
| 3939 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3940 | VKAPI_ATTR void VKAPI_CALL CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 3941 | VkPipeline pipeline) { |
| 3942 | bool skip_call = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3943 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3944 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3945 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3946 | skip_call |= parameter_validation_vkCmdBindPipeline(my_data->report_data, pipelineBindPoint, pipeline); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3947 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3948 | if (!skip_call) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 3949 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline); |
| 3950 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 3951 | } |
| 3952 | |
Mark Lobodzinski | 5a24296 | 2016-10-28 12:57:23 -0600 | [diff] [blame] | 3953 | bool preCmdSetViewport(debug_report_data *report_data, uint32_t viewport_count, const VkViewport *viewports) { |
| 3954 | bool skip = |
| 3955 | validate_array(report_data, "vkCmdSetViewport", "viewportCount", "pViewports", viewport_count, viewports, true, true); |
| 3956 | return skip; |
| 3957 | } |
| 3958 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3959 | VKAPI_ATTR void VKAPI_CALL CmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
| 3960 | const VkViewport *pViewports) { |
Mark Lobodzinski | b79b773 | 2016-10-28 12:59:47 -0600 | [diff] [blame] | 3961 | bool skip = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3962 | 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] | 3963 | assert(my_data != NULL); |
| 3964 | |
Mark Lobodzinski | b79b773 | 2016-10-28 12:59:47 -0600 | [diff] [blame] | 3965 | skip |= preCmdSetViewport(my_data->report_data, viewportCount, pViewports); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3966 | |
Mark Lobodzinski | b79b773 | 2016-10-28 12:59:47 -0600 | [diff] [blame] | 3967 | if (!skip) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3968 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 3969 | ->CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3970 | } |
Courtney Goeltzenleuchter | 078f817 | 2015-09-21 11:44:06 -0600 | [diff] [blame] | 3971 | } |
| 3972 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3973 | VKAPI_ATTR void VKAPI_CALL CmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, |
| 3974 | const VkRect2D *pScissors) { |
| 3975 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 3976 | 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] | 3977 | assert(my_data != NULL); |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 3978 | debug_report_data *report_data = my_data->report_data; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3979 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 3980 | skip_call |= parameter_validation_vkCmdSetScissor(my_data->report_data, firstScissor, scissorCount, pScissors); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 3981 | |
Mike Weiblen | a4742dc | 2016-10-31 11:05:56 -0600 | [diff] [blame] | 3982 | for (uint32_t scissorIndex = 0; scissorIndex < scissorCount; ++scissorIndex) { |
| 3983 | const VkRect2D &pScissor = pScissors[scissorIndex]; |
| 3984 | |
| 3985 | if (pScissor.offset.x < 0) { |
| 3986 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3987 | VALIDATION_ERROR_01489, LayerName, "vkCmdSetScissor %d: offset.x (%d) must not be negative. %s", |
| 3988 | scissorIndex, pScissor.offset.x, validation_error_map[VALIDATION_ERROR_01489]); |
| 3989 | } else if (static_cast<int32_t>(pScissor.extent.width) > (INT_MAX - pScissor.offset.x)) { |
| 3990 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3991 | VALIDATION_ERROR_01490, LayerName, |
| 3992 | "vkCmdSetScissor %d: adding offset.x (%d) and extent.width (%u) will overflow. %s", scissorIndex, |
| 3993 | pScissor.offset.x, pScissor.extent.width, validation_error_map[VALIDATION_ERROR_01490]); |
| 3994 | } |
| 3995 | |
| 3996 | if (pScissor.offset.y < 0) { |
| 3997 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 3998 | VALIDATION_ERROR_01489, LayerName, "vkCmdSetScissor %d: offset.y (%d) must not be negative. %s", |
| 3999 | scissorIndex, pScissor.offset.y, validation_error_map[VALIDATION_ERROR_01489]); |
| 4000 | } else if (static_cast<int32_t>(pScissor.extent.height) > (INT_MAX - pScissor.offset.y)) { |
| 4001 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 4002 | VALIDATION_ERROR_01491, LayerName, |
| 4003 | "vkCmdSetScissor %d: adding offset.y (%d) and extent.height (%u) will overflow. %s", scissorIndex, |
| 4004 | pScissor.offset.y, pScissor.extent.height, validation_error_map[VALIDATION_ERROR_01491]); |
| 4005 | } |
| 4006 | } |
| 4007 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4008 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4009 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors); |
| 4010 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4011 | } |
| 4012 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4013 | VKAPI_ATTR void VKAPI_CALL CmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4014 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetLineWidth(commandBuffer, lineWidth); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4015 | } |
| 4016 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4017 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, |
| 4018 | float depthBiasSlopeFactor) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4019 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4020 | ->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4021 | } |
| 4022 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4023 | VKAPI_ATTR void VKAPI_CALL CmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4024 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4025 | 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] | 4026 | assert(my_data != NULL); |
| 4027 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4028 | skip_call |= parameter_validation_vkCmdSetBlendConstants(my_data->report_data, blendConstants); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4029 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4030 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4031 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetBlendConstants(commandBuffer, blendConstants); |
| 4032 | } |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 4033 | } |
| 4034 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4035 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4036 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds); |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 4037 | } |
| 4038 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4039 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, |
| 4040 | uint32_t compareMask) { |
| 4041 | bool skip_call = false; |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4042 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4043 | assert(my_data != NULL); |
| 4044 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4045 | skip_call |= parameter_validation_vkCmdSetStencilCompareMask(my_data->report_data, faceMask, compareMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4046 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4047 | if (!skip_call) { |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4048 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask); |
| 4049 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4050 | } |
| 4051 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4052 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) { |
| 4053 | bool skip_call = false; |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4054 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4055 | assert(my_data != NULL); |
| 4056 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4057 | skip_call |= parameter_validation_vkCmdSetStencilWriteMask(my_data->report_data, faceMask, writeMask); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4058 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4059 | if (!skip_call) { |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4060 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask); |
| 4061 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4062 | } |
| 4063 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4064 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) { |
| 4065 | bool skip_call = false; |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4066 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4067 | assert(my_data != NULL); |
| 4068 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4069 | skip_call |= parameter_validation_vkCmdSetStencilReference(my_data->report_data, faceMask, reference); |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4070 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4071 | if (!skip_call) { |
Dustin Graves | 46948e6 | 2016-05-06 10:16:06 -0600 | [diff] [blame] | 4072 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetStencilReference(commandBuffer, faceMask, reference); |
| 4073 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4074 | } |
| 4075 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4076 | VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 4077 | VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, |
| 4078 | const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, |
| 4079 | const uint32_t *pDynamicOffsets) { |
| 4080 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4081 | 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] | 4082 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4083 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4084 | skip_call |= |
| 4085 | parameter_validation_vkCmdBindDescriptorSets(my_data->report_data, pipelineBindPoint, layout, firstSet, descriptorSetCount, |
| 4086 | pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4087 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4088 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4089 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4090 | ->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, |
| 4091 | dynamicOffsetCount, pDynamicOffsets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4092 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4093 | } |
| 4094 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4095 | VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 4096 | VkIndexType indexType) { |
| 4097 | bool skip_call = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4098 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4099 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4100 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4101 | skip_call |= parameter_validation_vkCmdBindIndexBuffer(my_data->report_data, buffer, offset, indexType); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4102 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4103 | if (!skip_call) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4104 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType); |
| 4105 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4106 | } |
| 4107 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4108 | VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, |
| 4109 | const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) { |
| 4110 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4111 | 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] | 4112 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4113 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4114 | skip_call |= parameter_validation_vkCmdBindVertexBuffers(my_data->report_data, firstBinding, bindingCount, pBuffers, pOffsets); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4115 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4116 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4117 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4118 | ->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4119 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4120 | } |
| 4121 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4122 | bool PreCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, |
| 4123 | uint32_t firstInstance) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4124 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4125 | if (vertexCount == 0) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4126 | // 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] | 4127 | // this an error or leave as is. |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4128 | log_msg(my_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4129 | REQUIRED_PARAMETER, LayerName, "vkCmdDraw parameter, uint32_t vertexCount, is 0"); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4130 | return false; |
| 4131 | } |
| 4132 | |
| 4133 | if (instanceCount == 0) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4134 | // 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] | 4135 | // this an error or leave as is. |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4136 | log_msg(my_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4137 | REQUIRED_PARAMETER, LayerName, "vkCmdDraw parameter, uint32_t instanceCount, is 0"); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4138 | return false; |
| 4139 | } |
| 4140 | |
| 4141 | return true; |
| 4142 | } |
| 4143 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4144 | VKAPI_ATTR void VKAPI_CALL CmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, |
| 4145 | uint32_t firstVertex, uint32_t firstInstance) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4146 | PreCmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
Michael Lentine | 55a913f | 2015-11-24 09:48:23 -0600 | [diff] [blame] | 4147 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4148 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4149 | ->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4150 | } |
| 4151 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4152 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, |
| 4153 | uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4154 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4155 | ->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4156 | } |
| 4157 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4158 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, |
| 4159 | uint32_t stride) { |
| 4160 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4161 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4162 | assert(my_data != NULL); |
| 4163 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4164 | skip_call |= parameter_validation_vkCmdDrawIndirect(my_data->report_data, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4165 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4166 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4167 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDrawIndirect(commandBuffer, buffer, offset, count, stride); |
| 4168 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4169 | } |
| 4170 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4171 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 4172 | uint32_t count, uint32_t stride) { |
| 4173 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4174 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4175 | assert(my_data != NULL); |
| 4176 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4177 | skip_call |= parameter_validation_vkCmdDrawIndexedIndirect(my_data->report_data, buffer, offset, count, stride); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4178 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4179 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4180 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4181 | ->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, count, stride); |
| 4182 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4183 | } |
| 4184 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4185 | VKAPI_ATTR void VKAPI_CALL CmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4186 | 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] | 4187 | } |
| 4188 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4189 | VKAPI_ATTR void VKAPI_CALL CmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) { |
| 4190 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4191 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4192 | assert(my_data != NULL); |
| 4193 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4194 | skip_call |= parameter_validation_vkCmdDispatchIndirect(my_data->report_data, buffer, offset); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4195 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4196 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4197 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDispatchIndirect(commandBuffer, buffer, offset); |
| 4198 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4199 | } |
| 4200 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4201 | VKAPI_ATTR void VKAPI_CALL CmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, |
| 4202 | uint32_t regionCount, const VkBufferCopy *pRegions) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4203 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4204 | 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] | 4205 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4206 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4207 | skip_call |= parameter_validation_vkCmdCopyBuffer(my_data->report_data, srcBuffer, dstBuffer, regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4208 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4209 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4210 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4211 | ->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4212 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4213 | } |
| 4214 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4215 | bool PreCmdCopyImage(VkCommandBuffer commandBuffer, const VkImageCopy *pRegions) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4216 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4217 | if (pRegions != nullptr) { |
| 4218 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4219 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4220 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4221 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4222 | "vkCmdCopyImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 4223 | return false; |
| 4224 | } |
| 4225 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4226 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4227 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4228 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4229 | "vkCmdCopyImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 4230 | return false; |
| 4231 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4232 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4233 | |
| 4234 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4235 | } |
| 4236 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4237 | VKAPI_ATTR void VKAPI_CALL CmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4238 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4239 | const VkImageCopy *pRegions) { |
| 4240 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4241 | 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] | 4242 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4243 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4244 | skip_call |= parameter_validation_vkCmdCopyImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
| 4245 | regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4246 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4247 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4248 | PreCmdCopyImage(commandBuffer, pRegions); |
| 4249 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4250 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4251 | ->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4252 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4253 | } |
| 4254 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4255 | bool PreCmdBlitImage(VkCommandBuffer commandBuffer, const VkImageBlit *pRegions) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4256 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4257 | if (pRegions != nullptr) { |
| 4258 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4259 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4260 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4261 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4262 | "vkCmdCopyImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 4263 | return false; |
| 4264 | } |
| 4265 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4266 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4267 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4268 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4269 | "vkCmdCopyImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 4270 | return false; |
| 4271 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4272 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4273 | |
| 4274 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4275 | } |
| 4276 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4277 | VKAPI_ATTR void VKAPI_CALL CmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4278 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4279 | const VkImageBlit *pRegions, VkFilter filter) { |
| 4280 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4281 | 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] | 4282 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4283 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4284 | skip_call |= parameter_validation_vkCmdBlitImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
| 4285 | regionCount, pRegions, filter); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4286 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4287 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4288 | PreCmdBlitImage(commandBuffer, pRegions); |
| 4289 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4290 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4291 | ->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4292 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4293 | } |
| 4294 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4295 | bool PreCmdCopyBufferToImage(VkCommandBuffer commandBuffer, const VkBufferImageCopy *pRegions) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4296 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4297 | if (pRegions != nullptr) { |
| 4298 | if ((pRegions->imageSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4299 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4300 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4301 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4302 | "vkCmdCopyBufferToImage parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
| 4303 | "enumerator"); |
| 4304 | return false; |
| 4305 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4306 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4307 | |
| 4308 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4309 | } |
| 4310 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4311 | VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, |
| 4312 | VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4313 | const VkBufferImageCopy *pRegions) { |
| 4314 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4315 | 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] | 4316 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4317 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4318 | skip_call |= parameter_validation_vkCmdCopyBufferToImage(my_data->report_data, srcBuffer, dstImage, dstImageLayout, regionCount, |
| 4319 | pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4320 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4321 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4322 | PreCmdCopyBufferToImage(commandBuffer, pRegions); |
| 4323 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4324 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4325 | ->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4326 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4327 | } |
| 4328 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4329 | bool PreCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, const VkBufferImageCopy *pRegions) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4330 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4331 | if (pRegions != nullptr) { |
| 4332 | if ((pRegions->imageSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4333 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4334 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4335 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4336 | "vkCmdCopyImageToBuffer parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
| 4337 | "enumerator"); |
| 4338 | return false; |
| 4339 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4340 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4341 | |
| 4342 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4343 | } |
| 4344 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4345 | VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4346 | VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions) { |
| 4347 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4348 | 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] | 4349 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4350 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4351 | skip_call |= parameter_validation_vkCmdCopyImageToBuffer(my_data->report_data, srcImage, srcImageLayout, dstBuffer, regionCount, |
| 4352 | pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4353 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4354 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4355 | PreCmdCopyImageToBuffer(commandBuffer, pRegions); |
| 4356 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4357 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4358 | ->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4359 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4360 | } |
| 4361 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4362 | VKAPI_ATTR void VKAPI_CALL CmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 4363 | VkDeviceSize dataSize, const uint32_t *pData) { |
| 4364 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4365 | 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] | 4366 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4367 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4368 | skip_call |= parameter_validation_vkCmdUpdateBuffer(my_data->report_data, dstBuffer, dstOffset, dataSize, pData); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4369 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4370 | if (dstOffset & 3) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4371 | skip_call |= log_msg( |
| 4372 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, INVALID_USAGE, |
| 4373 | LayerName, "CmdUpdateBuffer parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4", dstOffset); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4374 | } |
| 4375 | |
| 4376 | if ((dataSize <= 0) || (dataSize > 65536)) { |
| 4377 | skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4378 | INVALID_USAGE, LayerName, "CmdUpdateBuffer parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 |
| 4379 | "), must be greater than zero and less than or equal to 65536", |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4380 | dataSize); |
| 4381 | } else if (dataSize & 3) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4382 | skip_call |= log_msg( |
| 4383 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, INVALID_USAGE, |
| 4384 | LayerName, "CmdUpdateBuffer parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 "), is not a multiple of 4", dataSize); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4385 | } |
| 4386 | |
| 4387 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4388 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4389 | ->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4390 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4391 | } |
| 4392 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4393 | VKAPI_ATTR void VKAPI_CALL CmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 4394 | VkDeviceSize size, uint32_t data) { |
| 4395 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4396 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4397 | assert(my_data != NULL); |
| 4398 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4399 | skip_call |= parameter_validation_vkCmdFillBuffer(my_data->report_data, dstBuffer, dstOffset, size, data); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4400 | |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4401 | if (dstOffset & 3) { |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4402 | skip_call |= log_msg( |
| 4403 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, INVALID_USAGE, |
| 4404 | LayerName, "vkCmdFillBuffer parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4", dstOffset); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4405 | } |
| 4406 | |
| 4407 | if (size != VK_WHOLE_SIZE) { |
| 4408 | if (size <= 0) { |
| 4409 | skip_call |= log_msg( |
| 4410 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, INVALID_USAGE, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4411 | LayerName, "vkCmdFillBuffer parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), must be greater than zero", size); |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4412 | } else if (size & 3) { |
| 4413 | skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4414 | INVALID_USAGE, LayerName, |
Mark Lobodzinski | bbed437 | 2016-06-09 17:01:19 -0600 | [diff] [blame] | 4415 | "vkCmdFillBuffer parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), is not a multiple of 4", size); |
| 4416 | } |
| 4417 | } |
| 4418 | |
| 4419 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4420 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data); |
| 4421 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4422 | } |
| 4423 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4424 | VKAPI_ATTR void VKAPI_CALL CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 4425 | const VkClearColorValue *pColor, uint32_t rangeCount, |
| 4426 | const VkImageSubresourceRange *pRanges) { |
| 4427 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4428 | 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] | 4429 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4430 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4431 | skip_call |= parameter_validation_vkCmdClearColorImage(my_data->report_data, image, imageLayout, pColor, rangeCount, pRanges); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4432 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4433 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4434 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4435 | ->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4436 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4437 | } |
| 4438 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4439 | VKAPI_ATTR void VKAPI_CALL CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 4440 | const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, |
| 4441 | const VkImageSubresourceRange *pRanges) { |
| 4442 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4443 | 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] | 4444 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4445 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4446 | skip_call |= parameter_validation_vkCmdClearDepthStencilImage(my_data->report_data, image, imageLayout, pDepthStencil, |
| 4447 | rangeCount, pRanges); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4448 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4449 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4450 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4451 | ->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4452 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4453 | } |
| 4454 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4455 | VKAPI_ATTR void VKAPI_CALL CmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 4456 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
| 4457 | const VkClearRect *pRects) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4458 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4459 | 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] | 4460 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4461 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4462 | skip_call |= parameter_validation_vkCmdClearAttachments(my_data->report_data, attachmentCount, pAttachments, rectCount, pRects); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4463 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4464 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4465 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4466 | ->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4467 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4468 | } |
| 4469 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4470 | bool PreCmdResolveImage(VkCommandBuffer commandBuffer, const VkImageResolve *pRegions) { |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4471 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4472 | if (pRegions != nullptr) { |
| 4473 | if ((pRegions->srcSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4474 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 4475 | log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4476 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4477 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4478 | "vkCmdResolveImage parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 4479 | return false; |
| 4480 | } |
| 4481 | if ((pRegions->dstSubresource.aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | |
| 4482 | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT)) == 0) { |
| 4483 | log_msg( |
Chris Forbes | 0e0161a | 2016-11-02 16:21:28 +1300 | [diff] [blame] | 4484 | my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | bbe3d97 | 2016-06-29 10:53:51 -0600 | [diff] [blame] | 4485 | UNRECOGNIZED_VALUE, LayerName, |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4486 | "vkCmdResolveImage parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 4487 | return false; |
| 4488 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4489 | } |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4490 | |
| 4491 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4492 | } |
| 4493 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4494 | VKAPI_ATTR void VKAPI_CALL CmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 4495 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 4496 | const VkImageResolve *pRegions) { |
| 4497 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4498 | 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] | 4499 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4500 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4501 | skip_call |= parameter_validation_vkCmdResolveImage(my_data->report_data, srcImage, srcImageLayout, dstImage, dstImageLayout, |
| 4502 | regionCount, pRegions); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4503 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4504 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4505 | PreCmdResolveImage(commandBuffer, pRegions); |
| 4506 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4507 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4508 | ->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4509 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4510 | } |
| 4511 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4512 | VKAPI_ATTR void VKAPI_CALL CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
| 4513 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4514 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4515 | assert(my_data != NULL); |
| 4516 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4517 | skip_call |= parameter_validation_vkCmdSetEvent(my_data->report_data, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4518 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4519 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4520 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetEvent(commandBuffer, event, stageMask); |
| 4521 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4522 | } |
| 4523 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4524 | VKAPI_ATTR void VKAPI_CALL CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
| 4525 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4526 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4527 | assert(my_data != NULL); |
| 4528 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4529 | skip_call |= parameter_validation_vkCmdResetEvent(my_data->report_data, event, stageMask); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4530 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4531 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4532 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdResetEvent(commandBuffer, event, stageMask); |
| 4533 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4534 | } |
| 4535 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4536 | VKAPI_ATTR void VKAPI_CALL CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, |
| 4537 | VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, |
| 4538 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 4539 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 4540 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
| 4541 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4542 | 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] | 4543 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4544 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4545 | skip_call |= parameter_validation_vkCmdWaitEvents(my_data->report_data, eventCount, pEvents, srcStageMask, dstStageMask, |
| 4546 | memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, |
| 4547 | pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4548 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4549 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4550 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4551 | ->CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, |
| 4552 | bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4553 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4554 | } |
| 4555 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4556 | VKAPI_ATTR void VKAPI_CALL CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, |
| 4557 | VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, |
| 4558 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 4559 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 4560 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
| 4561 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4562 | 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] | 4563 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4564 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4565 | skip_call |= parameter_validation_vkCmdPipelineBarrier(my_data->report_data, srcStageMask, dstStageMask, dependencyFlags, |
| 4566 | memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, |
| 4567 | pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4568 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4569 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4570 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4571 | ->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, |
| 4572 | bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4573 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4574 | } |
| 4575 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4576 | VKAPI_ATTR void VKAPI_CALL CmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot, |
| 4577 | VkQueryControlFlags flags) { |
| 4578 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4579 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4580 | assert(my_data != NULL); |
| 4581 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4582 | skip_call |= parameter_validation_vkCmdBeginQuery(my_data->report_data, queryPool, slot, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4583 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4584 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4585 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBeginQuery(commandBuffer, queryPool, slot, flags); |
| 4586 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4587 | } |
| 4588 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4589 | VKAPI_ATTR void VKAPI_CALL CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4590 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4591 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4592 | assert(my_data != NULL); |
| 4593 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4594 | skip_call |= parameter_validation_vkCmdEndQuery(my_data->report_data, queryPool, slot); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4595 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4596 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4597 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdEndQuery(commandBuffer, queryPool, slot); |
| 4598 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4599 | } |
| 4600 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4601 | VKAPI_ATTR void VKAPI_CALL CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 4602 | uint32_t queryCount) { |
| 4603 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4604 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4605 | assert(my_data != NULL); |
| 4606 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4607 | skip_call |= parameter_validation_vkCmdResetQueryPool(my_data->report_data, queryPool, firstQuery, queryCount); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4608 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4609 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4610 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); |
| 4611 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4612 | } |
| 4613 | |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4614 | bool PostCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, |
| 4615 | uint32_t slot) { |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4616 | |
Chia-I Wu | 51ce5ea | 2015-10-26 19:40:27 +0800 | [diff] [blame] | 4617 | ValidateEnumerator(pipelineStage); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4618 | |
| 4619 | return true; |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4620 | } |
| 4621 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4622 | VKAPI_ATTR void VKAPI_CALL CmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, |
| 4623 | VkQueryPool queryPool, uint32_t query) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4624 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4625 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4626 | assert(my_data != NULL); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4627 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4628 | skip_call |= parameter_validation_vkCmdWriteTimestamp(my_data->report_data, pipelineStage, queryPool, query); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4629 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4630 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4631 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 4632 | |
| 4633 | PostCmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 4634 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4635 | } |
| 4636 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4637 | VKAPI_ATTR void VKAPI_CALL CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 4638 | uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 4639 | VkDeviceSize stride, VkQueryResultFlags flags) { |
| 4640 | bool skip_call = false; |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4641 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4642 | assert(my_data != NULL); |
| 4643 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4644 | skip_call |= parameter_validation_vkCmdCopyQueryPoolResults(my_data->report_data, queryPool, firstQuery, queryCount, dstBuffer, |
| 4645 | dstOffset, stride, flags); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4646 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4647 | if (!skip_call) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 4648 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4649 | ->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags); |
| 4650 | } |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4651 | } |
| 4652 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4653 | VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, |
| 4654 | uint32_t offset, uint32_t size, const void *pValues) { |
| 4655 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4656 | 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] | 4657 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4658 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4659 | skip_call |= parameter_validation_vkCmdPushConstants(my_data->report_data, layout, stageFlags, offset, size, pValues); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4660 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4661 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4662 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4663 | ->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4664 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4665 | } |
| 4666 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4667 | VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, |
| 4668 | VkSubpassContents contents) { |
| 4669 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4670 | 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] | 4671 | assert(my_data != NULL); |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4672 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4673 | skip_call |= parameter_validation_vkCmdBeginRenderPass(my_data->report_data, pRenderPassBegin, contents); |
Jeremy Hayes | 99a9632 | 2015-06-26 12:48:09 -0600 | [diff] [blame] | 4674 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4675 | if (!skip_call) { |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4676 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4677 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4678 | } |
| 4679 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4680 | VKAPI_ATTR void VKAPI_CALL CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4681 | bool skip_call = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4682 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4683 | assert(my_data != NULL); |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 4684 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4685 | skip_call |= parameter_validation_vkCmdNextSubpass(my_data->report_data, contents); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4686 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4687 | if (!skip_call) { |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 4688 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdNextSubpass(commandBuffer, contents); |
| 4689 | } |
Jeremy Hayes | f4b6f56 | 2015-07-29 11:23:46 -0600 | [diff] [blame] | 4690 | } |
| 4691 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 4692 | VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) { |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 4693 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdEndRenderPass(commandBuffer); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4694 | } |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 4695 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4696 | VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, |
| 4697 | const VkCommandBuffer *pCommandBuffers) { |
| 4698 | bool skip_call = false; |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4699 | 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] | 4700 | assert(my_data != NULL); |
Jeremy Hayes | 359eeb9 | 2015-07-09 17:11:25 -0600 | [diff] [blame] | 4701 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4702 | skip_call |= parameter_validation_vkCmdExecuteCommands(my_data->report_data, commandBufferCount, pCommandBuffers); |
Chia-I Wu | 0b50a1c | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 4703 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4704 | if (!skip_call) { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 4705 | get_dispatch_table(pc_device_table_map, commandBuffer) |
| 4706 | ->CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 4707 | } |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 4708 | } |
| 4709 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4710 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 4711 | return util_GetLayerProperties(1, &global_layer, pCount, pProperties); |
| 4712 | } |
| 4713 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4714 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 4715 | VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 4716 | return util_GetLayerProperties(1, &global_layer, pCount, pProperties); |
| 4717 | } |
| 4718 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4719 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 4720 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 4721 | if (pLayerName && !strcmp(pLayerName, global_layer.layerName)) |
| 4722 | return util_GetExtensionProperties(1, instance_extensions, pCount, pProperties); |
| 4723 | |
| 4724 | return VK_ERROR_LAYER_NOT_PRESENT; |
| 4725 | } |
| 4726 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4727 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, |
| 4728 | uint32_t *pCount, VkExtensionProperties *pProperties) { |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 4729 | /* parameter_validation does not have any physical device extensions */ |
Chia-I Wu | 76a3466 | 2016-05-16 07:34:09 +0800 | [diff] [blame] | 4730 | if (pLayerName && !strcmp(pLayerName, global_layer.layerName)) |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 4731 | return util_GetExtensionProperties(0, NULL, pCount, pProperties); |
Chia-I Wu | 76a3466 | 2016-05-16 07:34:09 +0800 | [diff] [blame] | 4732 | |
| 4733 | assert(physicalDevice); |
| 4734 | |
| 4735 | return get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4736 | ->EnumerateDeviceExtensionProperties(physicalDevice, NULL, pCount, pProperties); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 4737 | } |
| 4738 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4739 | // WSI Extension Functions |
| 4740 | |
| 4741 | VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4742 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4743 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4744 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4745 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 4746 | assert(my_data != NULL); |
| 4747 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4748 | skip_call |= parameter_validation_vkCreateSwapchainKHR(my_data->report_data, pCreateInfo, pAllocator, pSwapchain); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4749 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4750 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4751 | result = get_dispatch_table(pc_device_table_map, device)->CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); |
| 4752 | |
| 4753 | validate_result(my_data->report_data, "vkCreateSwapchainKHR", result); |
| 4754 | } |
| 4755 | |
| 4756 | return result; |
| 4757 | } |
| 4758 | |
| 4759 | VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4760 | VkImage *pSwapchainImages) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4761 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4762 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4763 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 4764 | assert(my_data != NULL); |
| 4765 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4766 | skip_call |= |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4767 | parameter_validation_vkGetSwapchainImagesKHR(my_data->report_data, swapchain, pSwapchainImageCount, pSwapchainImages); |
| 4768 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4769 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4770 | result = get_dispatch_table(pc_device_table_map, device) |
| 4771 | ->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); |
| 4772 | |
| 4773 | validate_result(my_data->report_data, "vkGetSwapchainImagesKHR", result); |
| 4774 | } |
| 4775 | |
| 4776 | return result; |
| 4777 | } |
| 4778 | |
| 4779 | VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4780 | VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4781 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4782 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4783 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 4784 | assert(my_data != NULL); |
| 4785 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4786 | skip_call |= |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4787 | parameter_validation_vkAcquireNextImageKHR(my_data->report_data, swapchain, timeout, semaphore, fence, pImageIndex); |
| 4788 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4789 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4790 | result = get_dispatch_table(pc_device_table_map, device) |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4791 | ->AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4792 | |
| 4793 | validate_result(my_data->report_data, "vkAcquireNextImageKHR", result); |
| 4794 | } |
| 4795 | |
| 4796 | return result; |
| 4797 | } |
| 4798 | |
| 4799 | VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { |
| 4800 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4801 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4802 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map); |
| 4803 | assert(my_data != NULL); |
| 4804 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4805 | skip_call |= parameter_validation_vkQueuePresentKHR(my_data->report_data, pPresentInfo); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4806 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4807 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4808 | result = get_dispatch_table(pc_device_table_map, queue)->QueuePresentKHR(queue, pPresentInfo); |
| 4809 | |
| 4810 | validate_result(my_data->report_data, "vkQueuePresentKHR", result); |
| 4811 | } |
| 4812 | |
| 4813 | return result; |
| 4814 | } |
| 4815 | |
| 4816 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, |
| 4817 | VkSurfaceKHR surface, VkBool32 *pSupported) { |
| 4818 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4819 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4820 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4821 | assert(my_data != NULL); |
| 4822 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4823 | skip_call |= |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4824 | parameter_validation_vkGetPhysicalDeviceSurfaceSupportKHR(my_data->report_data, queueFamilyIndex, surface, pSupported); |
| 4825 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4826 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4827 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4828 | ->GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported); |
| 4829 | |
| 4830 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceSupportKHR", result); |
| 4831 | } |
| 4832 | |
| 4833 | return result; |
| 4834 | } |
| 4835 | |
| 4836 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 4837 | VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { |
| 4838 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4839 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4840 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4841 | assert(my_data != NULL); |
| 4842 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4843 | skip_call |= |
| 4844 | parameter_validation_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(my_data->report_data, surface, pSurfaceCapabilities); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4845 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4846 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4847 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4848 | ->GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities); |
| 4849 | |
| 4850 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR", result); |
| 4851 | } |
| 4852 | |
| 4853 | return result; |
| 4854 | } |
| 4855 | |
| 4856 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 4857 | uint32_t *pSurfaceFormatCount, |
| 4858 | VkSurfaceFormatKHR *pSurfaceFormats) { |
| 4859 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4860 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4861 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4862 | assert(my_data != NULL); |
| 4863 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4864 | skip_call |= parameter_validation_vkGetPhysicalDeviceSurfaceFormatsKHR(my_data->report_data, surface, pSurfaceFormatCount, |
| 4865 | pSurfaceFormats); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4866 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4867 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4868 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4869 | ->GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats); |
| 4870 | |
| 4871 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfaceFormatsKHR", result); |
| 4872 | } |
| 4873 | |
| 4874 | return result; |
| 4875 | } |
| 4876 | |
| 4877 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 4878 | uint32_t *pPresentModeCount, |
| 4879 | VkPresentModeKHR *pPresentModes) { |
| 4880 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4881 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4882 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4883 | assert(my_data != NULL); |
| 4884 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4885 | skip_call |= parameter_validation_vkGetPhysicalDeviceSurfacePresentModesKHR(my_data->report_data, surface, pPresentModeCount, |
| 4886 | pPresentModes); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4887 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4888 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4889 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 4890 | ->GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes); |
| 4891 | |
| 4892 | validate_result(my_data->report_data, "vkGetPhysicalDeviceSurfacePresentModesKHR", result); |
| 4893 | } |
| 4894 | |
| 4895 | return result; |
| 4896 | } |
| 4897 | |
| 4898 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 4899 | VKAPI_ATTR VkResult VKAPI_CALL CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
| 4900 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 4901 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 4902 | |
| 4903 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 4904 | assert(my_data != NULL); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 4905 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4906 | |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 4907 | if (!instance_extension_map[get_dispatch_table(pc_instance_table_map, instance)].win32_enabled) { |
| 4908 | skip_call |= |
| 4909 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, |
| 4910 | reinterpret_cast<uint64_t>(instance), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
| 4911 | "vkCreateWin32SurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", |
| 4912 | VK_KHR_WIN32_SURFACE_EXTENSION_NAME); |
| 4913 | } |
| 4914 | |
| 4915 | skip_call |= parameter_validation_vkCreateWin32SurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4916 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4917 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4918 | result = |
| 4919 | get_dispatch_table(pc_instance_table_map, instance)->CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 4920 | } |
| 4921 | |
| 4922 | validate_result(my_data->report_data, "vkCreateWin32SurfaceKHR", result); |
| 4923 | |
| 4924 | return result; |
| 4925 | } |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 4926 | |
| 4927 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 4928 | uint32_t queueFamilyIndex) |
| 4929 | { |
| 4930 | VkBool32 result = false; |
| 4931 | |
| 4932 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4933 | assert(my_data != NULL); |
| 4934 | bool skip_call = false; |
| 4935 | |
| 4936 | if (!instance_extension_map[get_dispatch_table(pc_instance_table_map, physicalDevice)].win32_enabled) { |
| 4937 | skip_call |= |
| 4938 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, |
| 4939 | reinterpret_cast<uint64_t>(physicalDevice), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
| 4940 | "vkGetPhysicalDeviceWin32PresentationSupportKHR() called even though the %s extension was not enabled for this VkInstance.", |
| 4941 | VK_KHR_WIN32_SURFACE_EXTENSION_NAME); |
| 4942 | } |
| 4943 | |
| 4944 | skip_call |= parameter_validation_vkGetPhysicalDeviceWin32PresentationSupportKHR(physicalDevice, queueFamilyIndex); |
| 4945 | |
| 4946 | if (!skip_call) { |
| 4947 | result = get_dispatch_table(pc_instance_table_map, physicalDevice)->GetPhysicalDeviceWin32PresentationSupportKHR( |
| 4948 | physicalDevice, queueFamilyIndex); |
| 4949 | } |
| 4950 | |
| 4951 | return result; |
| 4952 | } |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4953 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4954 | |
| 4955 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 4956 | VKAPI_ATTR VkResult VKAPI_CALL CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, |
| 4957 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 4958 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 4959 | |
| 4960 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 4961 | assert(my_data != NULL); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 4962 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4963 | |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 4964 | if (!instance_extension_map[get_dispatch_table(pc_instance_table_map, instance)].xcb_enabled) { |
| 4965 | skip_call |= |
| 4966 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, |
| 4967 | reinterpret_cast<uint64_t>(instance), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
| 4968 | "vkCreateXcbSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", |
| 4969 | VK_KHR_XCB_SURFACE_EXTENSION_NAME); |
| 4970 | } |
| 4971 | |
| 4972 | skip_call |= parameter_validation_vkCreateXcbSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4973 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4974 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4975 | result = |
| 4976 | get_dispatch_table(pc_instance_table_map, instance)->CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 4977 | } |
| 4978 | |
| 4979 | validate_result(my_data->report_data, "vkCreateXcbSurfaceKHR", result); |
| 4980 | |
| 4981 | return result; |
| 4982 | } |
| 4983 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 4984 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 4985 | uint32_t queueFamilyIndex, xcb_connection_t *connection, |
| 4986 | xcb_visualid_t visual_id) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4987 | VkBool32 result = false; |
| 4988 | |
| 4989 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4990 | assert(my_data != NULL); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 4991 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 4992 | |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 4993 | if (!instance_extension_map[get_dispatch_table(pc_instance_table_map, physicalDevice)].xcb_enabled) { |
| 4994 | skip_call |= |
| 4995 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, |
| 4996 | reinterpret_cast<uint64_t>(physicalDevice), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
| 4997 | "vkGetPhysicalDeviceXcbPresentationSupportKHR() called even though the %s extension was not enabled for this VkInstance.", |
| 4998 | VK_KHR_XCB_SURFACE_EXTENSION_NAME); |
| 4999 | } |
| 5000 | |
| 5001 | skip_call |= parameter_validation_vkGetPhysicalDeviceXcbPresentationSupportKHR(my_data->report_data, queueFamilyIndex, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5002 | connection, visual_id); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5003 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5004 | if (!skip_call) { |
| 5005 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 5006 | ->GetPhysicalDeviceXcbPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection, visual_id); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5007 | } |
| 5008 | |
| 5009 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5010 | } |
| 5011 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 5012 | |
| 5013 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 5014 | VKAPI_ATTR VkResult VKAPI_CALL CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5015 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5016 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5017 | |
| 5018 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 5019 | assert(my_data != NULL); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5020 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5021 | |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5022 | if (!instance_extension_map[get_dispatch_table(pc_instance_table_map, instance)].xlib_enabled) { |
| 5023 | skip_call |= |
| 5024 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, |
| 5025 | reinterpret_cast<uint64_t>(instance), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
| 5026 | "vkCreateXlibSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", |
| 5027 | VK_KHR_XLIB_SURFACE_EXTENSION_NAME); |
| 5028 | } |
| 5029 | |
| 5030 | skip_call |= parameter_validation_vkCreateXlibSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5031 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5032 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5033 | result = |
| 5034 | get_dispatch_table(pc_instance_table_map, instance)->CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 5035 | } |
| 5036 | |
| 5037 | validate_result(my_data->report_data, "vkCreateXlibSurfaceKHR", result); |
| 5038 | |
| 5039 | return result; |
| 5040 | } |
| 5041 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5042 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5043 | uint32_t queueFamilyIndex, Display *dpy, |
| 5044 | VisualID visualID) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5045 | VkBool32 result = false; |
| 5046 | |
| 5047 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5048 | assert(my_data != NULL); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5049 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5050 | |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5051 | if (!instance_extension_map[get_dispatch_table(pc_instance_table_map, physicalDevice)].xlib_enabled) { |
| 5052 | skip_call |= |
| 5053 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, |
| 5054 | reinterpret_cast<uint64_t>(physicalDevice), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
| 5055 | "vkGetPhysicalDeviceXlibPresentationSupportKHR() called even though the %s extension was not enabled for this VkInstance.", |
| 5056 | VK_KHR_XLIB_SURFACE_EXTENSION_NAME); |
| 5057 | } |
| 5058 | |
| 5059 | skip_call |= parameter_validation_vkGetPhysicalDeviceXlibPresentationSupportKHR(my_data->report_data, queueFamilyIndex, dpy, visualID); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5060 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5061 | if (!skip_call) { |
| 5062 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 5063 | ->GetPhysicalDeviceXlibPresentationSupportKHR(physicalDevice, queueFamilyIndex, dpy, visualID); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5064 | } |
Karl Schultz | 3a41cae | 2016-09-02 10:17:05 -0600 | [diff] [blame] | 5065 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5066 | } |
| 5067 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 5068 | |
| 5069 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 5070 | VKAPI_ATTR VkResult VKAPI_CALL CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5071 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5072 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5073 | |
| 5074 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 5075 | assert(my_data != NULL); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5076 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5077 | |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5078 | if (!instance_extension_map[get_dispatch_table(pc_instance_table_map, instance)].mir_enabled) { |
| 5079 | skip_call |= |
| 5080 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, |
| 5081 | reinterpret_cast<uint64_t>(instance), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
| 5082 | "vkCreateMirSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", |
| 5083 | VK_KHR_MIR_SURFACE_EXTENSION_NAME); |
| 5084 | } |
| 5085 | |
| 5086 | skip_call |= parameter_validation_vkCreateMirSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5087 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5088 | if (!skip_call) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5089 | result = |
| 5090 | get_dispatch_table(pc_instance_table_map, instance)->CreateMirSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 5091 | } |
| 5092 | |
| 5093 | validate_result(my_data->report_data, "vkCreateMirSurfaceKHR", result); |
| 5094 | |
| 5095 | return result; |
| 5096 | } |
| 5097 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5098 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5099 | uint32_t queueFamilyIndex, MirConnection *connection) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5100 | VkBool32 result = false; |
| 5101 | |
| 5102 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5103 | assert(my_data != NULL); |
| 5104 | |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5105 | bool skip_call = false; |
| 5106 | |
| 5107 | if (!instance_extension_map[get_dispatch_table(pc_instance_table_map, physicalDevice)].mir_enabled) { |
| 5108 | skip_call |= |
| 5109 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, |
| 5110 | reinterpret_cast<uint64_t>(physicalDevice), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
| 5111 | "vkGetPhysicalDeviceMirPresentationSupportKHR() called even though the %s extension was not enabled for this VkInstance.", |
| 5112 | VK_KHR_MIR_SURFACE_EXTENSION_NAME); |
| 5113 | } |
| 5114 | skip_call |= parameter_validation_vkGetPhysicalDeviceMirPresentationSupportKHR(my_data->report_data, queueFamilyIndex, connection); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5115 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5116 | if (!skip_call) { |
| 5117 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 5118 | ->GetPhysicalDeviceMirPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5119 | } |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5120 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5121 | } |
| 5122 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 5123 | |
| 5124 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 5125 | VKAPI_ATTR VkResult VKAPI_CALL CreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5126 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5127 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5128 | |
| 5129 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 5130 | assert(my_data != NULL); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5131 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5132 | |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5133 | if (!instance_extension_map[get_dispatch_table(pc_instance_table_map, instance)].wayland_enabled) { |
| 5134 | skip_call |= |
| 5135 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, |
| 5136 | reinterpret_cast<uint64_t>(instance), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
| 5137 | "vkCreateWaylandSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", |
| 5138 | VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); |
| 5139 | } |
| 5140 | skip_call |= parameter_validation_vkCreateWaylandSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5141 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5142 | if (!skip_call) { |
| 5143 | result = get_dispatch_table(pc_instance_table_map, instance) |
| 5144 | ->CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5145 | } |
| 5146 | |
| 5147 | validate_result(my_data->report_data, "vkCreateWaylandSurfaceKHR", result); |
| 5148 | |
| 5149 | return result; |
| 5150 | } |
| 5151 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5152 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 5153 | uint32_t queueFamilyIndex, |
| 5154 | struct wl_display *display) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5155 | VkBool32 result = false; |
| 5156 | |
| 5157 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5158 | assert(my_data != NULL); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5159 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5160 | |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5161 | if (!instance_extension_map[get_dispatch_table(pc_instance_table_map, physicalDevice)].wayland_enabled) { |
| 5162 | skip_call |= |
| 5163 | log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, |
| 5164 | reinterpret_cast<uint64_t>(physicalDevice), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
| 5165 | "vkGetPhysicalDeviceWaylandPresentationSupportKHR() called even though the %s extension was not enabled for this VkInstance.", |
| 5166 | VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); |
| 5167 | } |
| 5168 | skip_call |= |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5169 | parameter_validation_vkGetPhysicalDeviceWaylandPresentationSupportKHR(my_data->report_data, queueFamilyIndex, display); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5170 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5171 | if (!skip_call) { |
| 5172 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 5173 | ->GetPhysicalDeviceWaylandPresentationSupportKHR(physicalDevice, queueFamilyIndex, display); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5174 | } |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5175 | |
| 5176 | return result; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5177 | } |
| 5178 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 5179 | |
| 5180 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 5181 | VKAPI_ATTR VkResult VKAPI_CALL CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5182 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5183 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5184 | |
| 5185 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 5186 | assert(my_data != NULL); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5187 | bool skip_call = false; |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5188 | |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5189 | if (!instance_extension_map[get_dispatch_table(pc_instance_table_map, instance)].android_enabled) { |
| 5190 | skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, |
| 5191 | reinterpret_cast<uint64_t>(instance), __LINE__, EXTENSION_NOT_ENABLED, LayerName, |
| 5192 | "vkCreateAndroidSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", |
| 5193 | VK_KHR_ANDROID_SURFACE_EXTENSION_NAME); |
| 5194 | } |
| 5195 | |
| 5196 | skip_call |= parameter_validation_vkCreateAndroidSurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5197 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5198 | if (!skip_call) { |
| 5199 | result = get_dispatch_table(pc_instance_table_map, instance) |
| 5200 | ->CreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5201 | } |
| 5202 | |
| 5203 | validate_result(my_data->report_data, "vkCreateAndroidSurfaceKHR", result); |
| 5204 | |
| 5205 | return result; |
| 5206 | } |
| 5207 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 5208 | |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5209 | VKAPI_ATTR VkResult VKAPI_CALL CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, |
| 5210 | const VkSwapchainCreateInfoKHR *pCreateInfos, |
| 5211 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) { |
| 5212 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5213 | bool skip_call = false; |
| 5214 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 5215 | assert(my_data != NULL); |
| 5216 | |
| 5217 | skip_call |= parameter_validation_vkCreateSharedSwapchainsKHR(my_data->report_data, swapchainCount, pCreateInfos, pAllocator, |
| 5218 | pSwapchains); |
| 5219 | |
| 5220 | if (!skip_call) { |
| 5221 | result = get_dispatch_table(pc_device_table_map, device) |
| 5222 | ->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); |
| 5223 | |
| 5224 | validate_result(my_data->report_data, "vkCreateSharedSwapchainsKHR", result); |
| 5225 | } |
| 5226 | |
| 5227 | return result; |
| 5228 | } |
| 5229 | |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 5230 | // VK_EXT_debug_marker Extension |
| 5231 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT(VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { |
| 5232 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5233 | bool skip_call = false; |
| 5234 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 5235 | assert(my_data != NULL); |
| 5236 | |
| 5237 | skip_call |= parameter_validation_vkDebugMarkerSetObjectTagEXT(my_data->report_data, pTagInfo); |
| 5238 | |
| 5239 | if (!skip_call) { |
| 5240 | result = get_dispatch_table(pc_device_table_map, device)->DebugMarkerSetObjectTagEXT(device, pTagInfo); |
| 5241 | |
| 5242 | validate_result(my_data->report_data, "vkDebugMarkerSetObjectTagEXT", result); |
| 5243 | } |
| 5244 | |
| 5245 | return result; |
| 5246 | } |
| 5247 | |
| 5248 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT(VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { |
| 5249 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5250 | bool skip_call = false; |
| 5251 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 5252 | assert(my_data != NULL); |
| 5253 | |
| 5254 | skip_call |= parameter_validation_vkDebugMarkerSetObjectNameEXT(my_data->report_data, pNameInfo); |
| 5255 | |
| 5256 | if (!skip_call) { |
| 5257 | VkResult result = get_dispatch_table(pc_device_table_map, device)->DebugMarkerSetObjectNameEXT(device, pNameInfo); |
| 5258 | |
| 5259 | validate_result(my_data->report_data, "vkDebugMarkerSetObjectNameEXT", result); |
| 5260 | } |
| 5261 | |
| 5262 | return result; |
| 5263 | } |
| 5264 | |
| 5265 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
| 5266 | bool skip_call = false; |
| 5267 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5268 | assert(my_data != NULL); |
| 5269 | |
| 5270 | skip_call |= parameter_validation_vkCmdDebugMarkerBeginEXT(my_data->report_data, pMarkerInfo); |
| 5271 | |
| 5272 | if (!skip_call) { |
| 5273 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo); |
| 5274 | } |
| 5275 | } |
| 5276 | |
| 5277 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
| 5278 | bool skip_call = false; |
| 5279 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5280 | assert(my_data != NULL); |
| 5281 | |
| 5282 | skip_call |= parameter_validation_vkCmdDebugMarkerInsertEXT(my_data->report_data, pMarkerInfo); |
| 5283 | |
| 5284 | if (!skip_call) { |
| 5285 | get_dispatch_table(pc_device_table_map, commandBuffer)->CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo); |
| 5286 | } |
| 5287 | } |
| 5288 | |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 5289 | // VK_NV_external_memory_capabilities Extension |
| 5290 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceExternalImageFormatPropertiesNV( |
| 5291 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, |
| 5292 | VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, |
| 5293 | VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) { |
| 5294 | |
| 5295 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5296 | bool skip_call = false; |
| 5297 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5298 | assert(my_data != NULL); |
| 5299 | |
| 5300 | skip_call |= parameter_validation_vkGetPhysicalDeviceExternalImageFormatPropertiesNV( |
| 5301 | my_data->report_data, format, type, tiling, usage, flags, externalHandleType, pExternalImageFormatProperties); |
| 5302 | |
| 5303 | if (!skip_call) { |
| 5304 | result = get_dispatch_table(pc_instance_table_map, physicalDevice) |
| 5305 | ->GetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice, format, type, tiling, usage, flags, |
| 5306 | externalHandleType, pExternalImageFormatProperties); |
| 5307 | |
| 5308 | validate_result(my_data->report_data, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV", result); |
| 5309 | } |
| 5310 | |
| 5311 | return result; |
| 5312 | } |
| 5313 | |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 5314 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 5315 | // VK_NV_external_memory_win32 Extension |
| 5316 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleNV(VkDevice device, VkDeviceMemory memory, |
| 5317 | VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE *pHandle) { |
| 5318 | |
| 5319 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 5320 | bool skip_call = false; |
| 5321 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 5322 | assert(my_data != NULL); |
| 5323 | |
| 5324 | skip_call |= parameter_validation_vkGetMemoryWin32HandleNV(my_data->report_data, memory, handleType, pHandle); |
| 5325 | |
| 5326 | if (!skip_call) { |
| 5327 | result = get_dispatch_table(pc_device_table_map, device)->GetMemoryWin32HandleNV(device, memory, handleType, pHandle); |
| 5328 | } |
| 5329 | |
| 5330 | return result; |
| 5331 | } |
| 5332 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 5333 | |
| 5334 | |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 5335 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5336 | static PFN_vkVoidFunction intercept_core_instance_command(const char *name); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5337 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5338 | static PFN_vkVoidFunction intercept_core_device_command(const char *name); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5339 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5340 | static PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkDevice device); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5341 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5342 | static PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkInstance instance); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5343 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5344 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) { |
Chia-I Wu | f9b0138 | 2016-05-16 07:37:41 +0800 | [diff] [blame] | 5345 | assert(device); |
| 5346 | |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 5347 | layer_data *data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 5348 | |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 5349 | if (validate_string(data->report_data, "vkGetDeviceProcAddr", "funcName", funcName)) { |
Mark Lobodzinski | 9a1c7b7 | 2016-01-12 11:52:05 -0700 | [diff] [blame] | 5350 | return NULL; |
| 5351 | } |
| 5352 | |
Chia-I Wu | f9b0138 | 2016-05-16 07:37:41 +0800 | [diff] [blame] | 5353 | PFN_vkVoidFunction proc = intercept_core_device_command(funcName); |
| 5354 | if (proc) |
| 5355 | return proc; |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 5356 | |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5357 | proc = InterceptWsiEnabledCommand(funcName, device); |
| 5358 | if (proc) |
| 5359 | return proc; |
| 5360 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 5361 | if (get_dispatch_table(pc_device_table_map, device)->GetDeviceProcAddr == NULL) |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 5362 | return NULL; |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 5363 | return get_dispatch_table(pc_device_table_map, device)->GetDeviceProcAddr(device, funcName); |
Jeremy Hayes | a8b1a8d | 2015-04-06 13:46:11 -0600 | [diff] [blame] | 5364 | } |
| 5365 | |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5366 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char *funcName) { |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5367 | PFN_vkVoidFunction proc = intercept_core_instance_command(funcName); |
Chia-I Wu | 02f01a3 | 2016-05-16 07:45:43 +0800 | [diff] [blame] | 5368 | if (!proc) |
| 5369 | proc = intercept_core_device_command(funcName); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5370 | |
| 5371 | if (!proc) |
| 5372 | proc = InterceptWsiEnabledCommand(funcName, VkDevice(VK_NULL_HANDLE)); |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5373 | |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5374 | if (proc) |
| 5375 | return proc; |
Courtney Goeltzenleuchter | 500b89b | 2015-06-01 14:45:27 -0600 | [diff] [blame] | 5376 | |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5377 | assert(instance); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 5378 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 5379 | 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] | 5380 | |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5381 | proc = debug_report_get_instance_proc_addr(data->report_data, funcName); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5382 | if (!proc) |
| 5383 | proc = InterceptWsiEnabledCommand(funcName, instance); |
| 5384 | |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5385 | if (proc) |
| 5386 | return proc; |
Courtney Goeltzenleuchter | 500b89b | 2015-06-01 14:45:27 -0600 | [diff] [blame] | 5387 | |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 5388 | if (get_dispatch_table(pc_instance_table_map, instance)->GetInstanceProcAddr == NULL) |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 5389 | return NULL; |
Mark Lobodzinski | 1ed594e | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 5390 | return get_dispatch_table(pc_instance_table_map, instance)->GetInstanceProcAddr(instance, funcName); |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 5391 | } |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5392 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5393 | static PFN_vkVoidFunction intercept_core_instance_command(const char *name) { |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5394 | static const struct { |
| 5395 | const char *name; |
| 5396 | PFN_vkVoidFunction proc; |
| 5397 | } core_instance_commands[] = { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5398 | {"vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetInstanceProcAddr)}, |
| 5399 | {"vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(CreateInstance)}, |
| 5400 | {"vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(DestroyInstance)}, |
| 5401 | {"vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(CreateDevice)}, |
| 5402 | {"vkEnumeratePhysicalDevices", reinterpret_cast<PFN_vkVoidFunction>(EnumeratePhysicalDevices)}, |
| 5403 | {"vkGetPhysicalDeviceProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceProperties)}, |
| 5404 | {"vkGetPhysicalDeviceFeatures", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceFeatures)}, |
| 5405 | {"vkGetPhysicalDeviceFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceFormatProperties)}, |
| 5406 | {"vkGetPhysicalDeviceImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceImageFormatProperties)}, |
| 5407 | {"vkGetPhysicalDeviceSparseImageFormatProperties", |
| 5408 | reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSparseImageFormatProperties)}, |
| 5409 | {"vkGetPhysicalDeviceQueueFamilyProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceQueueFamilyProperties)}, |
| 5410 | {"vkGetPhysicalDeviceMemoryProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceMemoryProperties)}, |
| 5411 | {"vkEnumerateInstanceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceLayerProperties)}, |
| 5412 | {"vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceLayerProperties)}, |
| 5413 | {"vkEnumerateInstanceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceExtensionProperties)}, |
| 5414 | {"vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceExtensionProperties)}, |
Mark Lobodzinski | b3c6828 | 2016-09-28 14:04:29 -0600 | [diff] [blame] | 5415 | {"vkGetPhysicalDeviceExternalImageFormatPropertiesNV", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceExternalImageFormatPropertiesNV) }, |
Chia-I Wu | 617f2a4 | 2016-05-16 07:41:17 +0800 | [diff] [blame] | 5416 | }; |
| 5417 | |
| 5418 | for (size_t i = 0; i < ARRAY_SIZE(core_instance_commands); i++) { |
| 5419 | if (!strcmp(core_instance_commands[i].name, name)) |
| 5420 | return core_instance_commands[i].proc; |
| 5421 | } |
| 5422 | |
| 5423 | return nullptr; |
| 5424 | } |
| 5425 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5426 | static PFN_vkVoidFunction intercept_core_device_command(const char *name) { |
Chia-I Wu | f9b0138 | 2016-05-16 07:37:41 +0800 | [diff] [blame] | 5427 | static const struct { |
| 5428 | const char *name; |
| 5429 | PFN_vkVoidFunction proc; |
| 5430 | } core_device_commands[] = { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5431 | {"vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr)}, |
| 5432 | {"vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice)}, |
| 5433 | {"vkGetDeviceQueue", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceQueue)}, |
| 5434 | {"vkQueueSubmit", reinterpret_cast<PFN_vkVoidFunction>(QueueSubmit)}, |
| 5435 | {"vkQueueWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(QueueWaitIdle)}, |
| 5436 | {"vkDeviceWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(DeviceWaitIdle)}, |
| 5437 | {"vkAllocateMemory", reinterpret_cast<PFN_vkVoidFunction>(AllocateMemory)}, |
| 5438 | {"vkFreeMemory", reinterpret_cast<PFN_vkVoidFunction>(FreeMemory)}, |
| 5439 | {"vkMapMemory", reinterpret_cast<PFN_vkVoidFunction>(MapMemory)}, |
| 5440 | {"vkUnmapMemory", reinterpret_cast<PFN_vkVoidFunction>(UnmapMemory)}, |
| 5441 | {"vkFlushMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(FlushMappedMemoryRanges)}, |
| 5442 | {"vkInvalidateMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(InvalidateMappedMemoryRanges)}, |
| 5443 | {"vkGetDeviceMemoryCommitment", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceMemoryCommitment)}, |
| 5444 | {"vkBindBufferMemory", reinterpret_cast<PFN_vkVoidFunction>(BindBufferMemory)}, |
| 5445 | {"vkBindImageMemory", reinterpret_cast<PFN_vkVoidFunction>(BindImageMemory)}, |
| 5446 | {"vkCreateFence", reinterpret_cast<PFN_vkVoidFunction>(CreateFence)}, |
| 5447 | {"vkDestroyFence", reinterpret_cast<PFN_vkVoidFunction>(DestroyFence)}, |
| 5448 | {"vkResetFences", reinterpret_cast<PFN_vkVoidFunction>(ResetFences)}, |
| 5449 | {"vkGetFenceStatus", reinterpret_cast<PFN_vkVoidFunction>(GetFenceStatus)}, |
| 5450 | {"vkWaitForFences", reinterpret_cast<PFN_vkVoidFunction>(WaitForFences)}, |
| 5451 | {"vkCreateSemaphore", reinterpret_cast<PFN_vkVoidFunction>(CreateSemaphore)}, |
| 5452 | {"vkDestroySemaphore", reinterpret_cast<PFN_vkVoidFunction>(DestroySemaphore)}, |
| 5453 | {"vkCreateEvent", reinterpret_cast<PFN_vkVoidFunction>(CreateEvent)}, |
| 5454 | {"vkDestroyEvent", reinterpret_cast<PFN_vkVoidFunction>(DestroyEvent)}, |
| 5455 | {"vkGetEventStatus", reinterpret_cast<PFN_vkVoidFunction>(GetEventStatus)}, |
| 5456 | {"vkSetEvent", reinterpret_cast<PFN_vkVoidFunction>(SetEvent)}, |
| 5457 | {"vkResetEvent", reinterpret_cast<PFN_vkVoidFunction>(ResetEvent)}, |
| 5458 | {"vkCreateQueryPool", reinterpret_cast<PFN_vkVoidFunction>(CreateQueryPool)}, |
| 5459 | {"vkDestroyQueryPool", reinterpret_cast<PFN_vkVoidFunction>(DestroyQueryPool)}, |
| 5460 | {"vkGetQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(GetQueryPoolResults)}, |
| 5461 | {"vkCreateBuffer", reinterpret_cast<PFN_vkVoidFunction>(CreateBuffer)}, |
| 5462 | {"vkDestroyBuffer", reinterpret_cast<PFN_vkVoidFunction>(DestroyBuffer)}, |
| 5463 | {"vkCreateBufferView", reinterpret_cast<PFN_vkVoidFunction>(CreateBufferView)}, |
| 5464 | {"vkDestroyBufferView", reinterpret_cast<PFN_vkVoidFunction>(DestroyBufferView)}, |
| 5465 | {"vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(CreateImage)}, |
| 5466 | {"vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(DestroyImage)}, |
| 5467 | {"vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(GetImageSubresourceLayout)}, |
| 5468 | {"vkCreateImageView", reinterpret_cast<PFN_vkVoidFunction>(CreateImageView)}, |
| 5469 | {"vkDestroyImageView", reinterpret_cast<PFN_vkVoidFunction>(DestroyImageView)}, |
| 5470 | {"vkCreateShaderModule", reinterpret_cast<PFN_vkVoidFunction>(CreateShaderModule)}, |
| 5471 | {"vkDestroyShaderModule", reinterpret_cast<PFN_vkVoidFunction>(DestroyShaderModule)}, |
| 5472 | {"vkCreatePipelineCache", reinterpret_cast<PFN_vkVoidFunction>(CreatePipelineCache)}, |
| 5473 | {"vkDestroyPipelineCache", reinterpret_cast<PFN_vkVoidFunction>(DestroyPipelineCache)}, |
| 5474 | {"vkGetPipelineCacheData", reinterpret_cast<PFN_vkVoidFunction>(GetPipelineCacheData)}, |
| 5475 | {"vkMergePipelineCaches", reinterpret_cast<PFN_vkVoidFunction>(MergePipelineCaches)}, |
| 5476 | {"vkCreateGraphicsPipelines", reinterpret_cast<PFN_vkVoidFunction>(CreateGraphicsPipelines)}, |
| 5477 | {"vkCreateComputePipelines", reinterpret_cast<PFN_vkVoidFunction>(CreateComputePipelines)}, |
| 5478 | {"vkDestroyPipeline", reinterpret_cast<PFN_vkVoidFunction>(DestroyPipeline)}, |
| 5479 | {"vkCreatePipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(CreatePipelineLayout)}, |
| 5480 | {"vkDestroyPipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(DestroyPipelineLayout)}, |
| 5481 | {"vkCreateSampler", reinterpret_cast<PFN_vkVoidFunction>(CreateSampler)}, |
| 5482 | {"vkDestroySampler", reinterpret_cast<PFN_vkVoidFunction>(DestroySampler)}, |
| 5483 | {"vkCreateDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(CreateDescriptorSetLayout)}, |
| 5484 | {"vkDestroyDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(DestroyDescriptorSetLayout)}, |
| 5485 | {"vkCreateDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(CreateDescriptorPool)}, |
| 5486 | {"vkDestroyDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(DestroyDescriptorPool)}, |
| 5487 | {"vkResetDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(ResetDescriptorPool)}, |
| 5488 | {"vkAllocateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(AllocateDescriptorSets)}, |
| 5489 | {"vkFreeDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(FreeDescriptorSets)}, |
| 5490 | {"vkUpdateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(UpdateDescriptorSets)}, |
| 5491 | {"vkCmdSetViewport", reinterpret_cast<PFN_vkVoidFunction>(CmdSetViewport)}, |
| 5492 | {"vkCmdSetScissor", reinterpret_cast<PFN_vkVoidFunction>(CmdSetScissor)}, |
| 5493 | {"vkCmdSetLineWidth", reinterpret_cast<PFN_vkVoidFunction>(CmdSetLineWidth)}, |
| 5494 | {"vkCmdSetDepthBias", reinterpret_cast<PFN_vkVoidFunction>(CmdSetDepthBias)}, |
| 5495 | {"vkCmdSetBlendConstants", reinterpret_cast<PFN_vkVoidFunction>(CmdSetBlendConstants)}, |
| 5496 | {"vkCmdSetDepthBounds", reinterpret_cast<PFN_vkVoidFunction>(CmdSetDepthBounds)}, |
| 5497 | {"vkCmdSetStencilCompareMask", reinterpret_cast<PFN_vkVoidFunction>(CmdSetStencilCompareMask)}, |
| 5498 | {"vkCmdSetStencilWriteMask", reinterpret_cast<PFN_vkVoidFunction>(CmdSetStencilWriteMask)}, |
| 5499 | {"vkCmdSetStencilReference", reinterpret_cast<PFN_vkVoidFunction>(CmdSetStencilReference)}, |
| 5500 | {"vkAllocateCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(AllocateCommandBuffers)}, |
| 5501 | {"vkFreeCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(FreeCommandBuffers)}, |
| 5502 | {"vkBeginCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(BeginCommandBuffer)}, |
| 5503 | {"vkEndCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(EndCommandBuffer)}, |
| 5504 | {"vkResetCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(ResetCommandBuffer)}, |
| 5505 | {"vkCmdBindPipeline", reinterpret_cast<PFN_vkVoidFunction>(CmdBindPipeline)}, |
| 5506 | {"vkCmdBindDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(CmdBindDescriptorSets)}, |
| 5507 | {"vkCmdBindVertexBuffers", reinterpret_cast<PFN_vkVoidFunction>(CmdBindVertexBuffers)}, |
| 5508 | {"vkCmdBindIndexBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdBindIndexBuffer)}, |
| 5509 | {"vkCmdDraw", reinterpret_cast<PFN_vkVoidFunction>(CmdDraw)}, |
| 5510 | {"vkCmdDrawIndexed", reinterpret_cast<PFN_vkVoidFunction>(CmdDrawIndexed)}, |
| 5511 | {"vkCmdDrawIndirect", reinterpret_cast<PFN_vkVoidFunction>(CmdDrawIndirect)}, |
| 5512 | {"vkCmdDrawIndexedIndirect", reinterpret_cast<PFN_vkVoidFunction>(CmdDrawIndexedIndirect)}, |
| 5513 | {"vkCmdDispatch", reinterpret_cast<PFN_vkVoidFunction>(CmdDispatch)}, |
| 5514 | {"vkCmdDispatchIndirect", reinterpret_cast<PFN_vkVoidFunction>(CmdDispatchIndirect)}, |
| 5515 | {"vkCmdCopyBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyBuffer)}, |
| 5516 | {"vkCmdCopyImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImage)}, |
| 5517 | {"vkCmdBlitImage", reinterpret_cast<PFN_vkVoidFunction>(CmdBlitImage)}, |
| 5518 | {"vkCmdCopyBufferToImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyBufferToImage)}, |
| 5519 | {"vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImageToBuffer)}, |
| 5520 | {"vkCmdUpdateBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdUpdateBuffer)}, |
| 5521 | {"vkCmdFillBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdFillBuffer)}, |
| 5522 | {"vkCmdClearColorImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearColorImage)}, |
| 5523 | {"vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearDepthStencilImage)}, |
| 5524 | {"vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(CmdClearAttachments)}, |
| 5525 | {"vkCmdResolveImage", reinterpret_cast<PFN_vkVoidFunction>(CmdResolveImage)}, |
| 5526 | {"vkCmdSetEvent", reinterpret_cast<PFN_vkVoidFunction>(CmdSetEvent)}, |
| 5527 | {"vkCmdResetEvent", reinterpret_cast<PFN_vkVoidFunction>(CmdResetEvent)}, |
| 5528 | {"vkCmdWaitEvents", reinterpret_cast<PFN_vkVoidFunction>(CmdWaitEvents)}, |
| 5529 | {"vkCmdPipelineBarrier", reinterpret_cast<PFN_vkVoidFunction>(CmdPipelineBarrier)}, |
| 5530 | {"vkCmdBeginQuery", reinterpret_cast<PFN_vkVoidFunction>(CmdBeginQuery)}, |
| 5531 | {"vkCmdEndQuery", reinterpret_cast<PFN_vkVoidFunction>(CmdEndQuery)}, |
| 5532 | {"vkCmdResetQueryPool", reinterpret_cast<PFN_vkVoidFunction>(CmdResetQueryPool)}, |
| 5533 | {"vkCmdWriteTimestamp", reinterpret_cast<PFN_vkVoidFunction>(CmdWriteTimestamp)}, |
| 5534 | {"vkCmdCopyQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyQueryPoolResults)}, |
| 5535 | {"vkCmdPushConstants", reinterpret_cast<PFN_vkVoidFunction>(CmdPushConstants)}, |
| 5536 | {"vkCreateFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(CreateFramebuffer)}, |
| 5537 | {"vkDestroyFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(DestroyFramebuffer)}, |
| 5538 | {"vkCreateRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CreateRenderPass)}, |
| 5539 | {"vkDestroyRenderPass", reinterpret_cast<PFN_vkVoidFunction>(DestroyRenderPass)}, |
| 5540 | {"vkGetRenderAreaGranularity", reinterpret_cast<PFN_vkVoidFunction>(GetRenderAreaGranularity)}, |
| 5541 | {"vkCreateCommandPool", reinterpret_cast<PFN_vkVoidFunction>(CreateCommandPool)}, |
| 5542 | {"vkDestroyCommandPool", reinterpret_cast<PFN_vkVoidFunction>(DestroyCommandPool)}, |
| 5543 | {"vkResetCommandPool", reinterpret_cast<PFN_vkVoidFunction>(ResetCommandPool)}, |
| 5544 | {"vkCmdBeginRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CmdBeginRenderPass)}, |
| 5545 | {"vkCmdNextSubpass", reinterpret_cast<PFN_vkVoidFunction>(CmdNextSubpass)}, |
| 5546 | {"vkCmdExecuteCommands", reinterpret_cast<PFN_vkVoidFunction>(CmdExecuteCommands)}, |
| 5547 | {"vkCmdEndRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CmdEndRenderPass)}, |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 5548 | {"vkDebugMarkerSetObjectTagEXT", reinterpret_cast<PFN_vkVoidFunction>(DebugMarkerSetObjectTagEXT) }, |
| 5549 | {"vkDebugMarkerSetObjectNameEXT", reinterpret_cast<PFN_vkVoidFunction>(DebugMarkerSetObjectNameEXT) }, |
| 5550 | {"vkCmdDebugMarkerBeginEXT", reinterpret_cast<PFN_vkVoidFunction>(CmdDebugMarkerBeginEXT) }, |
| 5551 | {"vkCmdDebugMarkerInsertEXT", reinterpret_cast<PFN_vkVoidFunction>(CmdDebugMarkerInsertEXT) }, |
Mark Lobodzinski | d5c4e62 | 2016-09-29 15:01:28 -0600 | [diff] [blame] | 5552 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 5553 | {"vkGetMemoryWin32HandleNV", reinterpret_cast<PFN_vkVoidFunction>(GetMemoryWin32HandleNV) }, |
| 5554 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | 620a913 | 2016-09-28 13:51:51 -0600 | [diff] [blame] | 5555 | }; |
| 5556 | |
Chia-I Wu | f9b0138 | 2016-05-16 07:37:41 +0800 | [diff] [blame] | 5557 | |
| 5558 | for (size_t i = 0; i < ARRAY_SIZE(core_device_commands); i++) { |
| 5559 | if (!strcmp(core_device_commands[i].name, name)) |
| 5560 | return core_device_commands[i].proc; |
| 5561 | } |
| 5562 | |
| 5563 | return nullptr; |
| 5564 | } |
| 5565 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5566 | static PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkDevice device) { |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5567 | static const struct { |
| 5568 | const char *name; |
| 5569 | PFN_vkVoidFunction proc; |
| 5570 | } wsi_device_commands[] = { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5571 | {"vkCreateSwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateSwapchainKHR)}, |
| 5572 | {"vkGetSwapchainImagesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetSwapchainImagesKHR)}, |
| 5573 | {"vkAcquireNextImageKHR", reinterpret_cast<PFN_vkVoidFunction>(AcquireNextImageKHR)}, |
| 5574 | {"vkQueuePresentKHR", reinterpret_cast<PFN_vkVoidFunction>(QueuePresentKHR)}, |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5575 | }; |
| 5576 | |
| 5577 | if (device) { |
| 5578 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5579 | |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 5580 | if (device_data->wsi_enabled) { |
| 5581 | for (size_t i = 0; i < ARRAY_SIZE(wsi_device_commands); i++) { |
| 5582 | if (!strcmp(wsi_device_commands[i].name, name)) |
| 5583 | return wsi_device_commands[i].proc; |
| 5584 | } |
| 5585 | } |
| 5586 | |
| 5587 | if (device_data->wsi_display_swapchain_enabled) { |
| 5588 | if (!strcmp("vkCreateSharedSwapchainsKHR", name)) { |
| 5589 | return reinterpret_cast<PFN_vkVoidFunction>(CreateSharedSwapchainsKHR); |
| 5590 | } |
| 5591 | } |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5592 | } |
| 5593 | |
| 5594 | return nullptr; |
| 5595 | } |
| 5596 | |
| 5597 | static PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkInstance instance) { |
| 5598 | static const struct { |
| 5599 | const char *name; |
| 5600 | PFN_vkVoidFunction proc; |
| 5601 | } wsi_instance_commands[] = { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5602 | {"vkGetPhysicalDeviceSurfaceSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceSupportKHR)}, |
| 5603 | {"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", |
| 5604 | reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceCapabilitiesKHR)}, |
| 5605 | {"vkGetPhysicalDeviceSurfaceFormatsKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceFormatsKHR)}, |
| 5606 | {"vkGetPhysicalDeviceSurfacePresentModesKHR", |
| 5607 | reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfacePresentModesKHR)}, |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5608 | }; |
| 5609 | |
| 5610 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5611 | if (instance_extension_map[pTable].wsi_enabled) { |
| 5612 | for (size_t i = 0; i < ARRAY_SIZE(wsi_instance_commands); i++) { |
| 5613 | if (!strcmp(wsi_instance_commands[i].name, name)) |
| 5614 | return wsi_instance_commands[i].proc; |
| 5615 | } |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5616 | } |
| 5617 | |
| 5618 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5619 | if (!strcmp("vkCreateWin32SurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5620 | return reinterpret_cast<PFN_vkVoidFunction>(CreateWin32SurfaceKHR); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5621 | if (!strcmp("vkGetPhysicalDeviceWin32PresentationSupportKHR", name)) |
| 5622 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceWin32PresentationSupportKHR); |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5623 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 5624 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5625 | if (!strcmp("vkCreateXcbSurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5626 | return reinterpret_cast<PFN_vkVoidFunction>(CreateXcbSurfaceKHR); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5627 | if (!strcmp("vkGetPhysicalDeviceXcbPresentationSupportKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5628 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXcbPresentationSupportKHR); |
| 5629 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 5630 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5631 | if (!strcmp("vkCreateXlibSurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5632 | return reinterpret_cast<PFN_vkVoidFunction>(CreateXlibSurfaceKHR); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5633 | if (!strcmp("vkGetPhysicalDeviceXlibPresentationSupportKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5634 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXlibPresentationSupportKHR); |
| 5635 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 5636 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5637 | if (!strcmp("vkCreateMirSurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5638 | return reinterpret_cast<PFN_vkVoidFunction>(CreateMirSurfaceKHR); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5639 | if (!strcmp("vkGetPhysicalDeviceMirPresentationSupportKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5640 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceMirPresentationSupportKHR); |
| 5641 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 5642 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5643 | if (!strcmp("vkCreateWaylandSurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5644 | return reinterpret_cast<PFN_vkVoidFunction>(CreateWaylandSurfaceKHR); |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5645 | if (!strcmp("vkGetPhysicalDeviceWaylandPresentationSupportKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5646 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceWaylandPresentationSupportKHR); |
| 5647 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 5648 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Chris Forbes | 9a083b9 | 2016-11-02 16:58:15 +1300 | [diff] [blame^] | 5649 | if (!strcmp("vkCreateAndroidSurfaceKHR", name)) |
Mark Lobodzinski | af00fa8 | 2016-08-09 10:44:38 -0600 | [diff] [blame] | 5650 | return reinterpret_cast<PFN_vkVoidFunction>(CreateAndroidSurfaceKHR); |
| 5651 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 5652 | |
| 5653 | return nullptr; |
| 5654 | } |
| 5655 | |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5656 | } // namespace parameter_validation |
| 5657 | |
| 5658 | // vk_layer_logging.h expects these to be defined |
| 5659 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5660 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(VkInstance instance, |
| 5661 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 5662 | const VkAllocationCallbacks *pAllocator, |
| 5663 | VkDebugReportCallbackEXT *pMsgCallback) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5664 | return parameter_validation::CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5665 | } |
| 5666 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5667 | VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, |
| 5668 | const VkAllocationCallbacks *pAllocator) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5669 | parameter_validation::DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5670 | } |
| 5671 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5672 | VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 5673 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 5674 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5675 | parameter_validation::DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5676 | } |
| 5677 | |
| 5678 | // loader-layer interface v0 |
| 5679 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5680 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 5681 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5682 | return parameter_validation::EnumerateInstanceExtensionProperties(pLayerName, pCount, pProperties); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5683 | } |
| 5684 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5685 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pCount, |
| 5686 | VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5687 | return parameter_validation::EnumerateInstanceLayerProperties(pCount, pProperties); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5688 | } |
| 5689 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 5690 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 5691 | VkLayerProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5692 | // the layer command handles VK_NULL_HANDLE just fine internally |
| 5693 | assert(physicalDevice == VK_NULL_HANDLE); |
| 5694 | return parameter_validation::EnumerateDeviceLayerProperties(VK_NULL_HANDLE, pCount, pProperties); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5695 | } |
| 5696 | |
| 5697 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, |
| 5698 | const char *pLayerName, uint32_t *pCount, |
| 5699 | VkExtensionProperties *pProperties) { |
Chia-I Wu | b02600c | 2016-05-20 07:11:22 +0800 | [diff] [blame] | 5700 | // the layer command handles VK_NULL_HANDLE just fine internally |
| 5701 | assert(physicalDevice == VK_NULL_HANDLE); |
Chia-I Wu | 76a3466 | 2016-05-16 07:34:09 +0800 | [diff] [blame] | 5702 | return parameter_validation::EnumerateDeviceExtensionProperties(VK_NULL_HANDLE, pLayerName, pCount, pProperties); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5703 | } |
| 5704 | |
| 5705 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice dev, const char *funcName) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5706 | return parameter_validation::GetDeviceProcAddr(dev, funcName); |
Chia-I Wu | 1a6b193 | 2016-05-13 14:07:36 +0800 | [diff] [blame] | 5707 | } |
| 5708 | |
| 5709 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *funcName) { |
Chia-I Wu | 01ca237 | 2016-05-13 14:37:49 +0800 | [diff] [blame] | 5710 | return parameter_validation::GetInstanceProcAddr(instance, funcName); |
Chia-I Wu | 99f701c | 2016-05-13 14:06:08 +0800 | [diff] [blame] | 5711 | } |