Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1 | /* |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2 | * Vulkan |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2014 LunarG, Inc. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included |
| 14 | * in all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
| 23 | */ |
| 24 | |
| 25 | #include <stdio.h> |
| 26 | #include <stdlib.h> |
| 27 | #include <string.h> |
| 28 | #include <unordered_map> |
| 29 | |
Tobin Ehlis | b835d1b | 2015-07-03 10:34:49 -0600 | [diff] [blame] | 30 | #include "vk_loader_platform.h" |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 31 | #include "vk_dispatch_table_helper.h" |
| 32 | #include "vk_struct_string_helper_cpp.h" |
Tony Barbour | 18f7155 | 2015-04-22 11:36:22 -0600 | [diff] [blame] | 33 | #if defined(__GNUC__) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 34 | #pragma GCC diagnostic ignored "-Wwrite-strings" |
Tony Barbour | 18f7155 | 2015-04-22 11:36:22 -0600 | [diff] [blame] | 35 | #endif |
Tony Barbour | 18f7155 | 2015-04-22 11:36:22 -0600 | [diff] [blame] | 36 | #if defined(__GNUC__) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 37 | #pragma GCC diagnostic warning "-Wwrite-strings" |
Tony Barbour | 18f7155 | 2015-04-22 11:36:22 -0600 | [diff] [blame] | 38 | #endif |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 39 | #include "vk_struct_size_helper.h" |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 40 | #include "draw_state.h" |
Tobin Ehlis | a0cb02e | 2015-07-03 10:15:26 -0600 | [diff] [blame] | 41 | #include "vk_layer_config.h" |
Jon Ashburn | e68a9ff | 2015-05-25 14:11:37 -0600 | [diff] [blame] | 42 | #include "vk_debug_marker_layer.h" |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 43 | // The following is #included again to catch certain OS-specific functions |
| 44 | // being used: |
Tobin Ehlis | b835d1b | 2015-07-03 10:34:49 -0600 | [diff] [blame] | 45 | #include "vk_loader_platform.h" |
Tobin Ehlis | a0cb02e | 2015-07-03 10:15:26 -0600 | [diff] [blame] | 46 | #include "vk_layer_msg.h" |
| 47 | #include "vk_layer_table.h" |
| 48 | #include "vk_layer_debug_marker_table.h" |
| 49 | #include "vk_layer_data.h" |
| 50 | #include "vk_layer_logging.h" |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 51 | #include "vk_layer_extension_utils.h" |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 52 | |
Tobin Ehlis | c16c3e9 | 2015-06-16 09:04:30 -0600 | [diff] [blame] | 53 | typedef struct _layer_data { |
| 54 | debug_report_data *report_data; |
| 55 | // TODO: put instance data here |
| 56 | VkDbgMsgCallback logging_callback; |
| 57 | } layer_data; |
| 58 | |
| 59 | static std::unordered_map<void *, layer_data *> layer_data_map; |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 60 | static device_table_map draw_state_device_table_map; |
| 61 | static instance_table_map draw_state_instance_table_map; |
| 62 | |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 63 | unordered_map<uint64_t, SAMPLER_NODE*> sampleMap; |
| 64 | unordered_map<uint64_t, VkImageViewCreateInfo> imageMap; |
| 65 | unordered_map<uint64_t, VkAttachmentViewCreateInfo> viewMap; |
| 66 | unordered_map<uint64_t, BUFFER_NODE*> bufferMap; |
| 67 | unordered_map<uint64_t, VkDynamicViewportStateCreateInfo> dynamicVpStateMap; |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 68 | unordered_map<uint64_t, VkDynamicLineWidthStateCreateInfo> dynamicLineWidthStateMap; |
| 69 | unordered_map<uint64_t, VkDynamicDepthBiasStateCreateInfo> dynamicDepthBiasStateMap; |
| 70 | unordered_map<uint64_t, VkDynamicBlendStateCreateInfo> dynamicBlendStateMap; |
| 71 | unordered_map<uint64_t, VkDynamicDepthBoundsStateCreateInfo> dynamicDepthBoundsStateMap; |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 72 | unordered_map<uint64_t, std::pair<VkDynamicStencilStateCreateInfo, VkDynamicStencilStateCreateInfo>> dynamicStencilStateMap; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 73 | unordered_map<uint64_t, PIPELINE_NODE*> pipelineMap; |
| 74 | unordered_map<uint64_t, POOL_NODE*> poolMap; |
| 75 | unordered_map<uint64_t, SET_NODE*> setMap; |
| 76 | unordered_map<uint64_t, LAYOUT_NODE*> layoutMap; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 77 | // Map for layout chains |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 78 | unordered_map<void*, GLOBAL_CB_NODE*> cmdBufferMap; |
| 79 | unordered_map<uint64_t, VkRenderPassCreateInfo*> renderPassMap; |
| 80 | unordered_map<uint64_t, VkFramebufferCreateInfo*> frameBufferMap; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 81 | |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 82 | struct devExts { |
| 83 | bool debug_marker_enabled; |
| 84 | }; |
| 85 | |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 86 | static std::unordered_map<void *, struct devExts> deviceExtMap; |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 87 | |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 88 | static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(g_initOnce); |
Jon Ashburn | 8c5cbcf | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 89 | |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 90 | // TODO : This can be much smarter, using separate locks for separate global data |
| 91 | static int globalLockInitialized = 0; |
| 92 | static loader_platform_thread_mutex globalLock; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 93 | #define MAX_TID 513 |
| 94 | static loader_platform_thread_id g_tidMapping[MAX_TID] = {0}; |
| 95 | static uint32_t g_maxTID = 0; |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 96 | |
| 97 | template layer_data *get_my_data_ptr<layer_data>( |
| 98 | void *data_key, |
| 99 | std::unordered_map<void *, layer_data *> &data_map); |
| 100 | |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 101 | debug_report_data *mdd(void* object) |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 102 | { |
| 103 | dispatch_key key = get_dispatch_key(object); |
| 104 | layer_data *my_data = get_my_data_ptr(key, layer_data_map); |
| 105 | #if DISPATCH_MAP_DEBUG |
| 106 | fprintf(stderr, "MDD: map: %p, object: %p, key: %p, data: %p\n", &layer_data_map, object, key, my_data); |
| 107 | #endif |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 108 | return my_data->report_data; |
| 109 | } |
| 110 | |
| 111 | debug_report_data *mid(VkInstance object) |
| 112 | { |
| 113 | dispatch_key key = get_dispatch_key(object); |
| 114 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(object), layer_data_map); |
| 115 | #if DISPATCH_MAP_DEBUG |
| 116 | fprintf(stderr, "MID: map: %p, object: %p, key: %p, data: %p\n", &layer_data_map, object, key, my_data); |
| 117 | #endif |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 118 | return my_data->report_data; |
| 119 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 120 | // Map actual TID to an index value and return that index |
| 121 | // This keeps TIDs in range from 0-MAX_TID and simplifies compares between runs |
| 122 | static uint32_t getTIDIndex() { |
| 123 | loader_platform_thread_id tid = loader_platform_get_thread_id(); |
| 124 | for (uint32_t i = 0; i < g_maxTID; i++) { |
| 125 | if (tid == g_tidMapping[i]) |
| 126 | return i; |
| 127 | } |
| 128 | // Don't yet have mapping, set it and return newly set index |
| 129 | uint32_t retVal = (uint32_t) g_maxTID; |
| 130 | g_tidMapping[g_maxTID++] = tid; |
| 131 | assert(g_maxTID < MAX_TID); |
| 132 | return retVal; |
| 133 | } |
| 134 | // Return a string representation of CMD_TYPE enum |
| 135 | static string cmdTypeToString(CMD_TYPE cmd) |
| 136 | { |
| 137 | switch (cmd) |
| 138 | { |
| 139 | case CMD_BINDPIPELINE: |
| 140 | return "CMD_BINDPIPELINE"; |
| 141 | case CMD_BINDPIPELINEDELTA: |
| 142 | return "CMD_BINDPIPELINEDELTA"; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 143 | case CMD_BINDDYNAMICVIEWPORTSTATE: |
| 144 | return "CMD_BINDDYNAMICVIEWPORTSTATE"; |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 145 | case CMD_BINDDYNAMICLINEWIDTHSTATE: |
| 146 | return "CMD_BINDDYNAMICLINEWIDTHSTATE"; |
| 147 | case CMD_BINDDYNAMICDEPTHBIASSTATE: |
| 148 | return "CMD_BINDDYNAMICDEPTHBIASSTATE"; |
| 149 | case CMD_BINDDYNAMICBLENDSTATE: |
| 150 | return "CMD_BINDDYNAMICBLENDSTATE"; |
| 151 | case CMD_BINDDYNAMICDEPTHBOUNDSSTATE: |
| 152 | return "CMD_BINDDYNAMICDEPTHBOUNDSSTATE"; |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 153 | case CMD_BINDDYNAMICSTENCILSTATE: |
| 154 | return "CMD_BINDDYNAMICSTENCILSTATE"; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 155 | case CMD_BINDDESCRIPTORSETS: |
| 156 | return "CMD_BINDDESCRIPTORSETS"; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 157 | case CMD_BINDINDEXBUFFER: |
| 158 | return "CMD_BINDINDEXBUFFER"; |
| 159 | case CMD_BINDVERTEXBUFFER: |
| 160 | return "CMD_BINDVERTEXBUFFER"; |
| 161 | case CMD_DRAW: |
| 162 | return "CMD_DRAW"; |
| 163 | case CMD_DRAWINDEXED: |
| 164 | return "CMD_DRAWINDEXED"; |
| 165 | case CMD_DRAWINDIRECT: |
| 166 | return "CMD_DRAWINDIRECT"; |
| 167 | case CMD_DRAWINDEXEDINDIRECT: |
| 168 | return "CMD_DRAWINDEXEDINDIRECT"; |
| 169 | case CMD_DISPATCH: |
| 170 | return "CMD_DISPATCH"; |
| 171 | case CMD_DISPATCHINDIRECT: |
| 172 | return "CMD_DISPATCHINDIRECT"; |
| 173 | case CMD_COPYBUFFER: |
| 174 | return "CMD_COPYBUFFER"; |
| 175 | case CMD_COPYIMAGE: |
| 176 | return "CMD_COPYIMAGE"; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 177 | case CMD_BLITIMAGE: |
| 178 | return "CMD_BLITIMAGE"; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 179 | case CMD_COPYBUFFERTOIMAGE: |
| 180 | return "CMD_COPYBUFFERTOIMAGE"; |
| 181 | case CMD_COPYIMAGETOBUFFER: |
| 182 | return "CMD_COPYIMAGETOBUFFER"; |
| 183 | case CMD_CLONEIMAGEDATA: |
| 184 | return "CMD_CLONEIMAGEDATA"; |
| 185 | case CMD_UPDATEBUFFER: |
| 186 | return "CMD_UPDATEBUFFER"; |
| 187 | case CMD_FILLBUFFER: |
| 188 | return "CMD_FILLBUFFER"; |
| 189 | case CMD_CLEARCOLORIMAGE: |
| 190 | return "CMD_CLEARCOLORIMAGE"; |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 191 | case CMD_CLEARCOLORATTACHMENT: |
| 192 | return "CMD_CLEARCOLORATTACHMENT"; |
| 193 | case CMD_CLEARDEPTHSTENCILIMAGE: |
| 194 | return "CMD_CLEARDEPTHSTENCILIMAGE"; |
| 195 | case CMD_CLEARDEPTHSTENCILATTACHMENT: |
| 196 | return "CMD_CLEARDEPTHSTENCILATTACHMENT"; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 197 | case CMD_RESOLVEIMAGE: |
| 198 | return "CMD_RESOLVEIMAGE"; |
| 199 | case CMD_SETEVENT: |
| 200 | return "CMD_SETEVENT"; |
| 201 | case CMD_RESETEVENT: |
| 202 | return "CMD_RESETEVENT"; |
| 203 | case CMD_WAITEVENTS: |
| 204 | return "CMD_WAITEVENTS"; |
| 205 | case CMD_PIPELINEBARRIER: |
| 206 | return "CMD_PIPELINEBARRIER"; |
| 207 | case CMD_BEGINQUERY: |
| 208 | return "CMD_BEGINQUERY"; |
| 209 | case CMD_ENDQUERY: |
| 210 | return "CMD_ENDQUERY"; |
| 211 | case CMD_RESETQUERYPOOL: |
| 212 | return "CMD_RESETQUERYPOOL"; |
| 213 | case CMD_WRITETIMESTAMP: |
| 214 | return "CMD_WRITETIMESTAMP"; |
| 215 | case CMD_INITATOMICCOUNTERS: |
| 216 | return "CMD_INITATOMICCOUNTERS"; |
| 217 | case CMD_LOADATOMICCOUNTERS: |
| 218 | return "CMD_LOADATOMICCOUNTERS"; |
| 219 | case CMD_SAVEATOMICCOUNTERS: |
| 220 | return "CMD_SAVEATOMICCOUNTERS"; |
| 221 | case CMD_BEGINRENDERPASS: |
| 222 | return "CMD_BEGINRENDERPASS"; |
| 223 | case CMD_ENDRENDERPASS: |
| 224 | return "CMD_ENDRENDERPASS"; |
| 225 | case CMD_DBGMARKERBEGIN: |
| 226 | return "CMD_DBGMARKERBEGIN"; |
| 227 | case CMD_DBGMARKEREND: |
| 228 | return "CMD_DBGMARKEREND"; |
| 229 | default: |
| 230 | return "UNKNOWN"; |
| 231 | } |
| 232 | } |
| 233 | // Block of code at start here for managing/tracking Pipeline state that this layer cares about |
| 234 | // Just track 2 shaders for now |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 235 | #define VK_NUM_GRAPHICS_SHADERS VK_SHADER_STAGE_COMPUTE |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 236 | #define MAX_SLOTS 2048 |
| 237 | #define NUM_COMMAND_BUFFERS_TO_DISPLAY 10 |
| 238 | |
| 239 | static uint64_t g_drawCount[NUM_DRAW_TYPES] = {0, 0, 0, 0}; |
| 240 | |
| 241 | // TODO : Should be tracking lastBound per cmdBuffer and when draws occur, report based on that cmd buffer lastBound |
| 242 | // Then need to synchronize the accesses based on cmd buffer so that if I'm reading state on one cmd buffer, updates |
| 243 | // to that same cmd buffer by separate thread are not changing state from underneath us |
| 244 | // Track the last cmd buffer touched by this thread |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 245 | static VkCmdBuffer g_lastCmdBuffer[MAX_TID] = {NULL}; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 246 | // Track the last group of CBs touched for displaying to dot file |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 247 | static GLOBAL_CB_NODE* g_pLastTouchedCB[NUM_COMMAND_BUFFERS_TO_DISPLAY] = {NULL}; |
| 248 | static uint32_t g_lastTouchedCBIndex = 0; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 249 | // Track the last global DrawState of interest touched by any thread |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 250 | static GLOBAL_CB_NODE* g_lastGlobalCB = NULL; |
| 251 | static PIPELINE_NODE* g_lastBoundPipeline = NULL; |
| 252 | static uint64_t g_lastBoundDynamicState[VK_NUM_STATE_BIND_POINT] = {0}; |
Dana Jansens | c73ff98 | 2015-07-30 13:22:15 -0700 | [diff] [blame] | 253 | static VkDescriptorSet g_lastBoundDescriptorSet = VK_NULL_HANDLE; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 254 | #define MAX_BINDING 0xFFFFFFFF // Default vtxBinding value in CB Node to identify if no vtxBinding set |
| 255 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 256 | //static DYNAMIC_STATE_NODE* g_pDynamicStateHead[VK_NUM_STATE_BIND_POINT] = {0}; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 257 | |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 258 | // Free all allocated nodes for Dynamic State objs |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 259 | static void deleteDynamicState() |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 260 | { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 261 | for (auto ii=dynamicVpStateMap.begin(); ii!=dynamicVpStateMap.end(); ++ii) { |
| 262 | delete[] (*ii).second.pScissors; |
| 263 | delete[] (*ii).second.pViewports; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 264 | } |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 265 | dynamicVpStateMap.clear(); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 266 | dynamicLineWidthStateMap.clear(); |
| 267 | dynamicDepthBiasStateMap.clear(); |
| 268 | dynamicBlendStateMap.clear(); |
| 269 | dynamicDepthBoundsStateMap.clear(); |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 270 | dynamicStencilStateMap.clear(); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 271 | } |
| 272 | // Free all sampler nodes |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 273 | static void deleteSamplers() |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 274 | { |
David Pinedo | d8f83d8 | 2015-04-27 16:36:17 -0600 | [diff] [blame] | 275 | if (sampleMap.size() <= 0) |
| 276 | return; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 277 | for (auto ii=sampleMap.begin(); ii!=sampleMap.end(); ++ii) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 278 | delete (*ii).second; |
| 279 | } |
Jon Ashburn | 25012f7 | 2015-06-15 10:58:28 -0600 | [diff] [blame] | 280 | sampleMap.clear(); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 281 | } |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 282 | static VkImageViewCreateInfo* getImageViewCreateInfo(VkImageView view) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 283 | { |
| 284 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 285 | if (imageMap.find(view.handle) == imageMap.end()) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 286 | loader_platform_thread_unlock_mutex(&globalLock); |
| 287 | return NULL; |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 288 | } else { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 289 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 290 | return &imageMap[view.handle]; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 291 | } |
| 292 | } |
| 293 | // Free all image nodes |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 294 | static void deleteImages() |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 295 | { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 296 | if (imageMap.size() <= 0) |
David Pinedo | d8f83d8 | 2015-04-27 16:36:17 -0600 | [diff] [blame] | 297 | return; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 298 | imageMap.clear(); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 299 | } |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 300 | static VkBufferViewCreateInfo* getBufferViewCreateInfo(VkBufferView view) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 301 | { |
| 302 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 303 | if (bufferMap.find(view.handle) == bufferMap.end()) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 304 | loader_platform_thread_unlock_mutex(&globalLock); |
| 305 | return NULL; |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 306 | } else { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 307 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 308 | return &bufferMap[view.handle]->createInfo; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 309 | } |
| 310 | } |
| 311 | // Free all buffer nodes |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 312 | static void deleteBuffers() |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 313 | { |
David Pinedo | d8f83d8 | 2015-04-27 16:36:17 -0600 | [diff] [blame] | 314 | if (bufferMap.size() <= 0) |
| 315 | return; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 316 | for (auto ii=bufferMap.begin(); ii!=bufferMap.end(); ++ii) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 317 | delete (*ii).second; |
| 318 | } |
Jon Ashburn | 25012f7 | 2015-06-15 10:58:28 -0600 | [diff] [blame] | 319 | bufferMap.clear(); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 320 | } |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 321 | static GLOBAL_CB_NODE* getCBNode(VkCmdBuffer cb); |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 322 | // Update global ptrs to reflect that specified cmdBuffer has been used |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 323 | static void updateCBTracking(VkCmdBuffer cb) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 324 | { |
| 325 | g_lastCmdBuffer[getTIDIndex()] = cb; |
| 326 | GLOBAL_CB_NODE* pCB = getCBNode(cb); |
| 327 | loader_platform_thread_lock_mutex(&globalLock); |
| 328 | g_lastGlobalCB = pCB; |
| 329 | // TODO : This is a dumb algorithm. Need smart LRU that drops off oldest |
| 330 | for (uint32_t i = 0; i < NUM_COMMAND_BUFFERS_TO_DISPLAY; i++) { |
| 331 | if (g_pLastTouchedCB[i] == pCB) { |
| 332 | loader_platform_thread_unlock_mutex(&globalLock); |
| 333 | return; |
| 334 | } |
| 335 | } |
| 336 | g_pLastTouchedCB[g_lastTouchedCBIndex++] = pCB; |
| 337 | g_lastTouchedCBIndex = g_lastTouchedCBIndex % NUM_COMMAND_BUFFERS_TO_DISPLAY; |
| 338 | loader_platform_thread_unlock_mutex(&globalLock); |
| 339 | } |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 340 | static VkBool32 hasDrawCmd(GLOBAL_CB_NODE* pCB) |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 341 | { |
| 342 | for (uint32_t i=0; i<NUM_DRAW_TYPES; i++) { |
| 343 | if (pCB->drawCount[i]) |
| 344 | return VK_TRUE; |
| 345 | } |
| 346 | return VK_FALSE; |
| 347 | } |
Tobin Ehlis | e382c5a | 2015-06-10 12:57:07 -0600 | [diff] [blame] | 348 | // Check object status for selected flag state |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 349 | static VkBool32 validate_status(GLOBAL_CB_NODE* pNode, CBStatusFlags enable_mask, CBStatusFlags status_mask, CBStatusFlags status_flag, VkFlags msg_flags, DRAW_STATE_ERROR error_code, const char* fail_msg) |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 350 | { |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 351 | // If non-zero enable mask is present, check it against status but if enable_mask |
| 352 | // is 0 then no enable required so we should always just check status |
| 353 | if ((!enable_mask) || (enable_mask & pNode->status)) { |
| 354 | if ((pNode->status & status_mask) != status_flag) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 355 | // TODO : How to pass dispatchable objects as srcObject? Here src obj should be cmd buffer |
| 356 | log_msg(mdd(pNode->cmdBuffer), msg_flags, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, error_code, "DS", |
| 357 | "CB object %#" PRIxLEAST64 ": %s", reinterpret_cast<VkUintPtrLeast64>(pNode->cmdBuffer), fail_msg); |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 358 | return VK_FALSE; |
Tobin Ehlis | e382c5a | 2015-06-10 12:57:07 -0600 | [diff] [blame] | 359 | } |
Tobin Ehlis | e382c5a | 2015-06-10 12:57:07 -0600 | [diff] [blame] | 360 | } |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 361 | return VK_TRUE; |
Tobin Ehlis | e382c5a | 2015-06-10 12:57:07 -0600 | [diff] [blame] | 362 | } |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 363 | // For given dynamic state handle and type, return CreateInfo for that Dynamic State |
| 364 | static void* getDynamicStateCreateInfo(const uint64_t handle, const DYNAMIC_STATE_BIND_POINT type) |
| 365 | { |
| 366 | switch (type) { |
| 367 | case VK_STATE_BIND_POINT_VIEWPORT: |
| 368 | return (void*)&dynamicVpStateMap[handle]; |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 369 | case VK_STATE_BIND_POINT_LINE_WIDTH: |
| 370 | return (void*)&dynamicLineWidthStateMap[handle]; |
| 371 | case VK_STATE_BIND_POINT_DEPTH_BIAS: |
| 372 | return (void*)&dynamicDepthBiasStateMap[handle]; |
| 373 | case VK_STATE_BIND_POINT_BLEND: |
| 374 | return (void*)&dynamicBlendStateMap[handle]; |
| 375 | case VK_STATE_BIND_POINT_DEPTH_BOUNDS: |
| 376 | return (void*)&dynamicDepthBoundsStateMap[handle]; |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 377 | case VK_STATE_BIND_POINT_STENCIL: |
| 378 | return (void*)&dynamicStencilStateMap[handle]; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 379 | default: |
| 380 | return NULL; |
| 381 | } |
| 382 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 383 | // Print the last bound dynamic state |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 384 | static void printDynamicState(const VkCmdBuffer cb) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 385 | { |
| 386 | GLOBAL_CB_NODE* pCB = getCBNode(cb); |
| 387 | if (pCB) { |
| 388 | loader_platform_thread_lock_mutex(&globalLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 389 | for (uint32_t i = 0; i < VK_NUM_STATE_BIND_POINT; i++) { |
Mark Lobodzinski | 31422ee | 2015-08-11 15:44:15 -0600 | [diff] [blame] | 390 | if (pCB->lastBoundDynamicState[i]) { |
| 391 | void* pDynStateCI = getDynamicStateCreateInfo(pCB->lastBoundDynamicState[i], (DYNAMIC_STATE_BIND_POINT)i); |
| 392 | if (pDynStateCI) { |
| 393 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, dynamicStateBindPointToObjType((DYNAMIC_STATE_BIND_POINT)i), pCB->lastBoundDynamicState[i], 0, DRAWSTATE_NONE, "DS", |
| 394 | "Reporting CreateInfo for currently bound %s object %#" PRIxLEAST64, string_DYNAMIC_STATE_BIND_POINT((DYNAMIC_STATE_BIND_POINT)i).c_str(), pCB->lastBoundDynamicState[i]); |
| 395 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, dynamicStateBindPointToObjType((DYNAMIC_STATE_BIND_POINT)i), pCB->lastBoundDynamicState[i], 0, DRAWSTATE_NONE, "DS", |
| 396 | dynamic_display(pDynStateCI, " ").c_str()); |
| 397 | } else { |
| 398 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
| 399 | "No dynamic state of type %s bound", string_DYNAMIC_STATE_BIND_POINT((DYNAMIC_STATE_BIND_POINT)i).c_str()); |
| 400 | } |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 401 | } else { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 402 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
| 403 | "No dynamic state of type %s bound", string_DYNAMIC_STATE_BIND_POINT((DYNAMIC_STATE_BIND_POINT)i).c_str()); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 404 | } |
| 405 | } |
| 406 | loader_platform_thread_unlock_mutex(&globalLock); |
| 407 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 408 | } |
| 409 | // Retrieve pipeline node ptr for given pipeline object |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 410 | static PIPELINE_NODE* getPipeline(VkPipeline pipeline) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 411 | { |
| 412 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 413 | if (pipelineMap.find(pipeline.handle) == pipelineMap.end()) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 414 | loader_platform_thread_unlock_mutex(&globalLock); |
| 415 | return NULL; |
| 416 | } |
| 417 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 418 | return pipelineMap[pipeline.handle]; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 419 | } |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 420 | // Validate state stored as flags at time of draw call |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 421 | static VkBool32 validate_draw_state_flags(GLOBAL_CB_NODE* pCB, VkBool32 indexedDraw) { |
| 422 | VkBool32 result; |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 423 | result = validate_status(pCB, CBSTATUS_NONE, CBSTATUS_VIEWPORT_BOUND, CBSTATUS_VIEWPORT_BOUND, VK_DBG_REPORT_ERROR_BIT, DRAWSTATE_VIEWPORT_NOT_BOUND, "Viewport object not bound to this command buffer"); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 424 | result &= validate_status(pCB, CBSTATUS_NONE, CBSTATUS_LINE_WIDTH_BOUND, CBSTATUS_LINE_WIDTH_BOUND, VK_DBG_REPORT_ERROR_BIT, DRAWSTATE_LINE_WIDTH_NOT_BOUND, "Line width object not bound to this command buffer"); |
| 425 | result &= validate_status(pCB, CBSTATUS_NONE, CBSTATUS_DEPTH_BIAS_BOUND, CBSTATUS_DEPTH_BIAS_BOUND, VK_DBG_REPORT_ERROR_BIT, DRAWSTATE_DEPTH_BIAS_NOT_BOUND, "Depth bias object not bound to this command buffer"); |
| 426 | result &= validate_status(pCB, CBSTATUS_COLOR_BLEND_WRITE_ENABLE, CBSTATUS_BLEND_BOUND, CBSTATUS_BLEND_BOUND, VK_DBG_REPORT_ERROR_BIT, DRAWSTATE_BLEND_NOT_BOUND, "Blend object not bound to this command buffer"); |
| 427 | result &= validate_status(pCB, CBSTATUS_DEPTH_WRITE_ENABLE, CBSTATUS_DEPTH_BOUNDS_BOUND, CBSTATUS_DEPTH_BOUNDS_BOUND, VK_DBG_REPORT_ERROR_BIT, DRAWSTATE_DEPTH_BOUNDS_NOT_BOUND, "Depth bounds object not bound to this command buffer"); |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 428 | result &= validate_status(pCB, CBSTATUS_STENCIL_TEST_ENABLE, CBSTATUS_STENCIL_BOUND, CBSTATUS_STENCIL_BOUND, VK_DBG_REPORT_ERROR_BIT, DRAWSTATE_STENCIL_NOT_BOUND, "Stencil object not bound to this command buffer"); |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 429 | if (indexedDraw) |
| 430 | result &= validate_status(pCB, CBSTATUS_NONE, CBSTATUS_INDEX_BUFFER_BOUND, CBSTATUS_INDEX_BUFFER_BOUND, VK_DBG_REPORT_ERROR_BIT, DRAWSTATE_INDEX_BUFFER_NOT_BOUND, "Index buffer object not bound to this command buffer when Index Draw attempted"); |
| 431 | return result; |
| 432 | } |
| 433 | // Validate overall state at the time of a draw call |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 434 | static VkBool32 validate_draw_state(GLOBAL_CB_NODE* pCB, VkBool32 indexedDraw) { |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 435 | // First check flag states |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 436 | VkBool32 result = validate_draw_state_flags(pCB, indexedDraw); |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 437 | PIPELINE_NODE* pPipe = getPipeline(pCB->lastBoundPipeline); |
| 438 | // Now complete other state checks |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 439 | if (pPipe && (pCB->lastBoundPipelineLayout != pPipe->graphicsPipelineCI.layout)) { |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 440 | result = VK_FALSE; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 441 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PIPELINE_LAYOUT, pCB->lastBoundPipelineLayout.handle, 0, DRAWSTATE_PIPELINE_LAYOUT_MISMATCH, "DS", |
Mark Lobodzinski | 735e4b3 | 2015-08-04 10:54:43 -0600 | [diff] [blame] | 442 | "Pipeline layout from last vkCmdBindDescriptorSets() (%#" PRIxLEAST64 ") does not match PSO Pipeline layout (%#" PRIxLEAST64 ") ", pCB->lastBoundPipelineLayout.handle, pPipe->graphicsPipelineCI.layout.handle); |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 443 | } |
Tobin Ehlis | d1fe4ec | 2015-06-23 11:22:55 -0600 | [diff] [blame] | 444 | if (!pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 445 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Tobin Ehlis | d1fe4ec | 2015-06-23 11:22:55 -0600 | [diff] [blame] | 446 | "Draw cmd issued without an active RenderPass. vkCmdDraw*() must only be called within a RenderPass."); |
| 447 | } |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 448 | return result; |
| 449 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 450 | // For given sampler, return a ptr to its Create Info struct, or NULL if sampler not found |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 451 | static VkSamplerCreateInfo* getSamplerCreateInfo(const VkSampler sampler) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 452 | { |
| 453 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 454 | if (sampleMap.find(sampler.handle) == sampleMap.end()) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 455 | loader_platform_thread_unlock_mutex(&globalLock); |
| 456 | return NULL; |
| 457 | } |
| 458 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 459 | return &sampleMap[sampler.handle]->createInfo; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 460 | } |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 461 | // Verify that create state for a pipeline is valid |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 462 | static VkBool32 verifyPipelineCreateState(const VkDevice device, const PIPELINE_NODE* pPipeline) |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 463 | { |
| 464 | // VS is required |
| 465 | if (!(pPipeline->active_shaders & VK_SHADER_STAGE_VERTEX_BIT)) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 466 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, "DS", |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 467 | "Invalid Pipeline CreateInfo State: Vtx Shader required"); |
| 468 | return VK_FALSE; |
| 469 | } |
| 470 | // Either both or neither TC/TE shaders should be defined |
| 471 | if (((pPipeline->active_shaders & VK_SHADER_STAGE_TESS_CONTROL_BIT) == 0) != |
| 472 | ((pPipeline->active_shaders & VK_SHADER_STAGE_TESS_EVALUATION_BIT) == 0) ) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 473 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, "DS", |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 474 | "Invalid Pipeline CreateInfo State: TE and TC shaders must be included or excluded as a pair"); |
| 475 | return VK_FALSE; |
| 476 | } |
| 477 | // Compute shaders should be specified independent of Gfx shaders |
| 478 | if ((pPipeline->active_shaders & VK_SHADER_STAGE_COMPUTE_BIT) && |
| 479 | (pPipeline->active_shaders & (VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_TESS_CONTROL_BIT | |
| 480 | VK_SHADER_STAGE_TESS_EVALUATION_BIT | VK_SHADER_STAGE_GEOMETRY_BIT | |
| 481 | VK_SHADER_STAGE_FRAGMENT_BIT))) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 482 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, "DS", |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 483 | "Invalid Pipeline CreateInfo State: Do not specify Compute Shader for Gfx Pipeline"); |
| 484 | return VK_FALSE; |
| 485 | } |
| 486 | // VK_PRIMITIVE_TOPOLOGY_PATCH primitive topology is only valid for tessellation pipelines. |
| 487 | // Mismatching primitive topology and tessellation fails graphics pipeline creation. |
| 488 | if (pPipeline->active_shaders & (VK_SHADER_STAGE_TESS_CONTROL_BIT | VK_SHADER_STAGE_TESS_EVALUATION_BIT) && |
| 489 | (pPipeline->iaStateCI.topology != VK_PRIMITIVE_TOPOLOGY_PATCH)) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 490 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, "DS", |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 491 | "Invalid Pipeline CreateInfo State: VK_PRIMITIVE_TOPOLOGY_PATCH must be set as IA topology for tessellation pipelines"); |
| 492 | return VK_FALSE; |
| 493 | } |
| 494 | if ((pPipeline->iaStateCI.topology == VK_PRIMITIVE_TOPOLOGY_PATCH) && |
| 495 | (~pPipeline->active_shaders & VK_SHADER_STAGE_TESS_CONTROL_BIT)) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 496 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, "DS", |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 497 | "Invalid Pipeline CreateInfo State: VK_PRIMITIVE_TOPOLOGY_PATCH primitive topology is only valid for tessellation pipelines"); |
| 498 | return VK_FALSE; |
| 499 | } |
| 500 | return VK_TRUE; |
| 501 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 502 | // Init the pipeline mapping info based on pipeline create info LL tree |
| 503 | // Threading note : Calls to this function should wrapped in mutex |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 504 | static PIPELINE_NODE* initPipeline(const VkGraphicsPipelineCreateInfo* pCreateInfo, PIPELINE_NODE* pBasePipeline) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 505 | { |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 506 | PIPELINE_NODE* pPipeline = new PIPELINE_NODE; |
| 507 | if (pBasePipeline) { |
| 508 | memcpy((void*)pPipeline, (void*)pBasePipeline, sizeof(PIPELINE_NODE)); |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 509 | } else { |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 510 | memset((void*)pPipeline, 0, sizeof(PIPELINE_NODE)); |
| 511 | } |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 512 | // First init create info |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 513 | // TODO : Validate that no create info is incorrectly replicated |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 514 | memcpy(&pPipeline->graphicsPipelineCI, pCreateInfo, sizeof(VkGraphicsPipelineCreateInfo)); |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 515 | |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 516 | size_t bufferSize = 0; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 517 | const VkPipelineVertexInputStateCreateInfo* pVICI = NULL; |
Tobin Ehlis | 5a65cca | 2015-07-13 13:14:24 -0600 | [diff] [blame] | 518 | const VkPipelineColorBlendStateCreateInfo* pCBCI = NULL; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 519 | |
| 520 | for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) { |
| 521 | const VkPipelineShaderStageCreateInfo *pPSSCI = &pCreateInfo->pStages[i]; |
| 522 | |
| 523 | switch (pPSSCI->stage) { |
| 524 | case VK_SHADER_STAGE_VERTEX: |
| 525 | memcpy(&pPipeline->vsCI, pPSSCI, sizeof(VkPipelineShaderStageCreateInfo)); |
| 526 | pPipeline->active_shaders |= VK_SHADER_STAGE_VERTEX_BIT; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 527 | break; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 528 | case VK_SHADER_STAGE_TESS_CONTROL: |
| 529 | memcpy(&pPipeline->tcsCI, pPSSCI, sizeof(VkPipelineShaderStageCreateInfo)); |
| 530 | pPipeline->active_shaders |= VK_SHADER_STAGE_TESS_CONTROL_BIT; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 531 | break; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 532 | case VK_SHADER_STAGE_TESS_EVALUATION: |
| 533 | memcpy(&pPipeline->tesCI, pPSSCI, sizeof(VkPipelineShaderStageCreateInfo)); |
| 534 | pPipeline->active_shaders |= VK_SHADER_STAGE_TESS_EVALUATION_BIT; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 535 | break; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 536 | case VK_SHADER_STAGE_GEOMETRY: |
| 537 | memcpy(&pPipeline->gsCI, pPSSCI, sizeof(VkPipelineShaderStageCreateInfo)); |
| 538 | pPipeline->active_shaders |= VK_SHADER_STAGE_GEOMETRY_BIT; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 539 | break; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 540 | case VK_SHADER_STAGE_FRAGMENT: |
| 541 | memcpy(&pPipeline->fsCI, pPSSCI, sizeof(VkPipelineShaderStageCreateInfo)); |
| 542 | pPipeline->active_shaders |= VK_SHADER_STAGE_FRAGMENT_BIT; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 543 | break; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 544 | case VK_SHADER_STAGE_COMPUTE: |
| 545 | // TODO : Flag error, CS is specified through VkComputePipelineCreateInfo |
| 546 | pPipeline->active_shaders |= VK_SHADER_STAGE_COMPUTE_BIT; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 547 | break; |
| 548 | default: |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 549 | // TODO : Flag error |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 550 | break; |
| 551 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 552 | } |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 553 | |
| 554 | if (pCreateInfo->pVertexInputState != NULL) { |
| 555 | memcpy((void*)&pPipeline->vertexInputCI, pCreateInfo->pVertexInputState , sizeof(VkPipelineVertexInputStateCreateInfo)); |
| 556 | // Copy embedded ptrs |
| 557 | pVICI = pCreateInfo->pVertexInputState; |
| 558 | pPipeline->vtxBindingCount = pVICI->bindingCount; |
| 559 | if (pPipeline->vtxBindingCount) { |
| 560 | pPipeline->pVertexBindingDescriptions = new VkVertexInputBindingDescription[pPipeline->vtxBindingCount]; |
| 561 | bufferSize = pPipeline->vtxBindingCount * sizeof(VkVertexInputBindingDescription); |
| 562 | memcpy((void*)pPipeline->pVertexBindingDescriptions, pVICI->pVertexBindingDescriptions, bufferSize); |
| 563 | } |
| 564 | pPipeline->vtxAttributeCount = pVICI->attributeCount; |
| 565 | if (pPipeline->vtxAttributeCount) { |
| 566 | pPipeline->pVertexAttributeDescriptions = new VkVertexInputAttributeDescription[pPipeline->vtxAttributeCount]; |
| 567 | bufferSize = pPipeline->vtxAttributeCount * sizeof(VkVertexInputAttributeDescription); |
| 568 | memcpy((void*)pPipeline->pVertexAttributeDescriptions, pVICI->pVertexAttributeDescriptions, bufferSize); |
| 569 | } |
| 570 | pPipeline->graphicsPipelineCI.pVertexInputState = &pPipeline->vertexInputCI; |
| 571 | } |
Tony Barbour | dd6e32e | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 572 | if (pCreateInfo->pInputAssemblyState != NULL) { |
| 573 | memcpy((void*)&pPipeline->iaStateCI, pCreateInfo->pInputAssemblyState, sizeof(VkPipelineInputAssemblyStateCreateInfo)); |
| 574 | pPipeline->graphicsPipelineCI.pInputAssemblyState = &pPipeline->iaStateCI; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 575 | } |
Tony Barbour | dd6e32e | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 576 | if (pCreateInfo->pTessellationState != NULL) { |
| 577 | memcpy((void*)&pPipeline->tessStateCI, pCreateInfo->pTessellationState, sizeof(VkPipelineTessellationStateCreateInfo)); |
| 578 | pPipeline->graphicsPipelineCI.pTessellationState = &pPipeline->tessStateCI; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 579 | } |
Tony Barbour | dd6e32e | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 580 | if (pCreateInfo->pViewportState != NULL) { |
| 581 | memcpy((void*)&pPipeline->vpStateCI, pCreateInfo->pViewportState, sizeof(VkPipelineViewportStateCreateInfo)); |
| 582 | pPipeline->graphicsPipelineCI.pViewportState = &pPipeline->vpStateCI; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 583 | } |
Tony Barbour | dd6e32e | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 584 | if (pCreateInfo->pRasterState != NULL) { |
| 585 | memcpy((void*)&pPipeline->rsStateCI, pCreateInfo->pRasterState, sizeof(VkPipelineRasterStateCreateInfo)); |
| 586 | pPipeline->graphicsPipelineCI.pRasterState = &pPipeline->rsStateCI; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 587 | } |
Tony Barbour | dd6e32e | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 588 | if (pCreateInfo->pMultisampleState != NULL) { |
| 589 | memcpy((void*)&pPipeline->msStateCI, pCreateInfo->pMultisampleState, sizeof(VkPipelineMultisampleStateCreateInfo)); |
| 590 | pPipeline->graphicsPipelineCI.pMultisampleState = &pPipeline->msStateCI; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 591 | } |
Tony Barbour | dd6e32e | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 592 | if (pCreateInfo->pColorBlendState != NULL) { |
| 593 | memcpy((void*)&pPipeline->cbStateCI, pCreateInfo->pColorBlendState, sizeof(VkPipelineColorBlendStateCreateInfo)); |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 594 | // Copy embedded ptrs |
Tony Barbour | dd6e32e | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 595 | pCBCI = pCreateInfo->pColorBlendState; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 596 | pPipeline->attachmentCount = pCBCI->attachmentCount; |
| 597 | if (pPipeline->attachmentCount) { |
Tony Barbour | dd6e32e | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 598 | pPipeline->pAttachments = new VkPipelineColorBlendAttachmentState[pPipeline->attachmentCount]; |
| 599 | bufferSize = pPipeline->attachmentCount * sizeof(VkPipelineColorBlendAttachmentState); |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 600 | memcpy((void*)pPipeline->pAttachments, pCBCI->pAttachments, bufferSize); |
| 601 | } |
Tony Barbour | dd6e32e | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 602 | pPipeline->graphicsPipelineCI.pColorBlendState = &pPipeline->cbStateCI; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 603 | } |
Tony Barbour | dd6e32e | 2015-07-10 15:29:03 -0600 | [diff] [blame] | 604 | if (pCreateInfo->pDepthStencilState != NULL) { |
| 605 | memcpy((void*)&pPipeline->dsStateCI, pCreateInfo->pDepthStencilState, sizeof(VkPipelineDepthStencilStateCreateInfo)); |
| 606 | pPipeline->graphicsPipelineCI.pDepthStencilState = &pPipeline->dsStateCI; |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 607 | } |
| 608 | |
| 609 | // Copy over GraphicsPipelineCreateInfo structure embedded pointers |
| 610 | if (pCreateInfo->stageCount != 0) { |
| 611 | pPipeline->graphicsPipelineCI.pStages = new VkPipelineShaderStageCreateInfo[pCreateInfo->stageCount]; |
| 612 | bufferSize = pCreateInfo->stageCount * sizeof(VkPipelineShaderStageCreateInfo); |
| 613 | memcpy((void*)pPipeline->graphicsPipelineCI.pStages, pCreateInfo->pStages, bufferSize); |
| 614 | } |
| 615 | |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 616 | return pPipeline; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 617 | } |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 618 | |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 619 | // Free the Pipeline nodes |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 620 | static void deletePipelines() |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 621 | { |
David Pinedo | d8f83d8 | 2015-04-27 16:36:17 -0600 | [diff] [blame] | 622 | if (pipelineMap.size() <= 0) |
| 623 | return; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 624 | for (auto ii=pipelineMap.begin(); ii!=pipelineMap.end(); ++ii) { |
Mark Lobodzinski | d5732f3 | 2015-06-23 15:11:57 -0600 | [diff] [blame] | 625 | if ((*ii).second->graphicsPipelineCI.stageCount != 0) { |
| 626 | delete[] (*ii).second->graphicsPipelineCI.pStages; |
| 627 | } |
Tobin Ehlis | f313c8b | 2015-04-01 11:59:08 -0600 | [diff] [blame] | 628 | if ((*ii).second->pVertexBindingDescriptions) { |
| 629 | delete[] (*ii).second->pVertexBindingDescriptions; |
| 630 | } |
| 631 | if ((*ii).second->pVertexAttributeDescriptions) { |
| 632 | delete[] (*ii).second->pVertexAttributeDescriptions; |
| 633 | } |
| 634 | if ((*ii).second->pAttachments) { |
| 635 | delete[] (*ii).second->pAttachments; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 636 | } |
| 637 | delete (*ii).second; |
| 638 | } |
Jon Ashburn | 25012f7 | 2015-06-15 10:58:28 -0600 | [diff] [blame] | 639 | pipelineMap.clear(); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 640 | } |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 641 | // For given pipeline, return number of MSAA samples, or one if MSAA disabled |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 642 | static uint32_t getNumSamples(const VkPipeline pipeline) |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 643 | { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 644 | PIPELINE_NODE* pPipe = pipelineMap[pipeline.handle]; |
Tobin Ehlis | 577188e | 2015-07-13 14:51:15 -0600 | [diff] [blame] | 645 | if (VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO == pPipe->msStateCI.sType) { |
| 646 | return pPipe->msStateCI.rasterSamples; |
| 647 | } |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 648 | return 1; |
| 649 | } |
| 650 | // Validate state related to the PSO |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 651 | static void validatePipelineState(const GLOBAL_CB_NODE* pCB, const VkPipelineBindPoint pipelineBindPoint, const VkPipeline pipeline) |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 652 | { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 653 | if (VK_PIPELINE_BIND_POINT_GRAPHICS == pipelineBindPoint) { |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 654 | // Verify that any MSAA request in PSO matches sample# in bound FB |
| 655 | uint32_t psoNumSamples = getNumSamples(pipeline); |
| 656 | if (pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 657 | const VkRenderPassCreateInfo* pRPCI = renderPassMap[pCB->activeRenderPass.handle]; |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 658 | const VkSubpassDescription* pSD = &pRPCI->pSubpasses[pCB->activeSubpass]; |
| 659 | int subpassNumSamples = 0; |
| 660 | uint32_t i; |
| 661 | |
| 662 | for (i = 0; i < pSD->colorCount; i++) { |
| 663 | uint32_t samples; |
| 664 | |
Cody Northrop | a505dda | 2015-08-04 11:16:41 -0600 | [diff] [blame] | 665 | if (pSD->pColorAttachments[i].attachment == VK_ATTACHMENT_UNUSED) |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 666 | continue; |
| 667 | |
Cody Northrop | a505dda | 2015-08-04 11:16:41 -0600 | [diff] [blame] | 668 | samples = pRPCI->pAttachments[pSD->pColorAttachments[i].attachment].samples; |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 669 | if (subpassNumSamples == 0) { |
| 670 | subpassNumSamples = samples; |
| 671 | } else if (subpassNumSamples != samples) { |
| 672 | subpassNumSamples = -1; |
| 673 | break; |
| 674 | } |
| 675 | } |
| 676 | if (pSD->depthStencilAttachment.attachment != VK_ATTACHMENT_UNUSED) { |
| 677 | const uint32_t samples = pRPCI->pAttachments[pSD->depthStencilAttachment.attachment].samples; |
| 678 | if (subpassNumSamples == 0) |
| 679 | subpassNumSamples = samples; |
| 680 | else if (subpassNumSamples != samples) |
| 681 | subpassNumSamples = -1; |
| 682 | } |
| 683 | |
| 684 | if (psoNumSamples != subpassNumSamples) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 685 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PIPELINE, pipeline.handle, 0, DRAWSTATE_NUM_SAMPLES_MISMATCH, "DS", |
| 686 | "Num samples mismatch! Binding PSO (%#" PRIxLEAST64 ") with %u samples while current RenderPass (%#" PRIxLEAST64 ") w/ %u samples!", pipeline.handle, psoNumSamples, pCB->activeRenderPass.handle, subpassNumSamples); |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 687 | } |
| 688 | } else { |
| 689 | // TODO : I believe it's an error if we reach this point and don't have an activeRenderPass |
| 690 | // Verify and flag error as appropriate |
| 691 | } |
| 692 | // TODO : Add more checks here |
| 693 | } else { |
| 694 | // TODO : Validate non-gfx pipeline updates |
| 695 | } |
| 696 | } |
| 697 | |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 698 | // Block of code at start here specifically for managing/tracking DSs |
| 699 | |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 700 | // Return Pool node ptr for specified pool or else NULL |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 701 | static POOL_NODE* getPoolNode(VkDescriptorPool pool) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 702 | { |
| 703 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 704 | if (poolMap.find(pool.handle) == poolMap.end()) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 705 | loader_platform_thread_unlock_mutex(&globalLock); |
| 706 | return NULL; |
| 707 | } |
| 708 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 709 | return poolMap[pool.handle]; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 710 | } |
| 711 | // Return Set node ptr for specified set or else NULL |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 712 | static SET_NODE* getSetNode(VkDescriptorSet set) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 713 | { |
| 714 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 715 | if (setMap.find(set.handle) == setMap.end()) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 716 | loader_platform_thread_unlock_mutex(&globalLock); |
| 717 | return NULL; |
| 718 | } |
| 719 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 720 | return setMap[set.handle]; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 721 | } |
| 722 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 723 | static LAYOUT_NODE* getLayoutNode(const VkDescriptorSetLayout layout) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 724 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 725 | if (layoutMap.find(layout.handle) == layoutMap.end()) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 726 | loader_platform_thread_unlock_mutex(&globalLock); |
| 727 | return NULL; |
| 728 | } |
| 729 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 730 | return layoutMap[layout.handle]; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 731 | } |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 732 | // Return 1 if update struct is of valid type, 0 otherwise |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 733 | static VkBool32 validUpdateStruct(const VkDevice device, const GENERIC_HEADER* pUpdateStruct) |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 734 | { |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 735 | switch (pUpdateStruct->sType) |
| 736 | { |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 737 | case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET: |
| 738 | case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET: |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 739 | return 1; |
| 740 | default: |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 741 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_UPDATE_STRUCT, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 742 | "Unexpected UPDATE struct of type %s (value %u) in vkUpdateDescriptors() struct tree", string_VkStructureType(pUpdateStruct->sType), pUpdateStruct->sType); |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 743 | return 0; |
| 744 | } |
| 745 | } |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 746 | // For given update struct, return binding |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 747 | static uint32_t getUpdateBinding(const VkDevice device, const GENERIC_HEADER* pUpdateStruct) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 748 | { |
| 749 | switch (pUpdateStruct->sType) |
| 750 | { |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 751 | case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET: |
| 752 | return ((VkWriteDescriptorSet*)pUpdateStruct)->destBinding; |
| 753 | case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET: |
| 754 | return ((VkCopyDescriptorSet*)pUpdateStruct)->destBinding; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 755 | default: |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 756 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_UPDATE_STRUCT, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 757 | "Unexpected UPDATE struct of type %s (value %u) in vkUpdateDescriptors() struct tree", string_VkStructureType(pUpdateStruct->sType), pUpdateStruct->sType); |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 758 | return 0xFFFFFFFF; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 759 | } |
| 760 | } |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 761 | // Return count for given update struct |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 762 | static uint32_t getUpdateArrayIndex(const VkDevice device, const GENERIC_HEADER* pUpdateStruct) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 763 | { |
| 764 | switch (pUpdateStruct->sType) |
| 765 | { |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 766 | case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET: |
| 767 | return ((VkWriteDescriptorSet*)pUpdateStruct)->destArrayElement; |
| 768 | case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET: |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 769 | // TODO : Need to understand this case better and make sure code is correct |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 770 | return ((VkCopyDescriptorSet*)pUpdateStruct)->destArrayElement; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 771 | default: |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 772 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_UPDATE_STRUCT, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 773 | "Unexpected UPDATE struct of type %s (value %u) in vkUpdateDescriptors() struct tree", string_VkStructureType(pUpdateStruct->sType), pUpdateStruct->sType); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 774 | return 0; |
| 775 | } |
| 776 | } |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 777 | // Return count for given update struct |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 778 | static uint32_t getUpdateCount(const VkDevice device, const GENERIC_HEADER* pUpdateStruct) |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 779 | { |
| 780 | switch (pUpdateStruct->sType) |
| 781 | { |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 782 | case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET: |
| 783 | return ((VkWriteDescriptorSet*)pUpdateStruct)->count; |
| 784 | case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET: |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 785 | // TODO : Need to understand this case better and make sure code is correct |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 786 | return ((VkCopyDescriptorSet*)pUpdateStruct)->count; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 787 | default: |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 788 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_UPDATE_STRUCT, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 789 | "Unexpected UPDATE struct of type %s (value %u) in vkUpdateDescriptors() struct tree", string_VkStructureType(pUpdateStruct->sType), pUpdateStruct->sType); |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 790 | return 0; |
| 791 | } |
| 792 | } |
| 793 | // For given Layout Node and binding, return index where that binding begins |
| 794 | static uint32_t getBindingStartIndex(const LAYOUT_NODE* pLayout, const uint32_t binding) |
| 795 | { |
| 796 | uint32_t offsetIndex = 0; |
| 797 | for (uint32_t i = 0; i<binding; i++) { |
Chia-I Wu | 712bb5d | 2015-05-25 16:22:52 +0800 | [diff] [blame] | 798 | offsetIndex += pLayout->createInfo.pBinding[i].arraySize; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 799 | } |
| 800 | return offsetIndex; |
| 801 | } |
| 802 | // For given layout node and binding, return last index that is updated |
| 803 | static uint32_t getBindingEndIndex(const LAYOUT_NODE* pLayout, const uint32_t binding) |
| 804 | { |
| 805 | uint32_t offsetIndex = 0; |
| 806 | for (uint32_t i = 0; i<=binding; i++) { |
Chia-I Wu | 712bb5d | 2015-05-25 16:22:52 +0800 | [diff] [blame] | 807 | offsetIndex += pLayout->createInfo.pBinding[i].arraySize; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 808 | } |
| 809 | return offsetIndex-1; |
| 810 | } |
| 811 | // For given layout and update, return the first overall index of the layout that is update |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 812 | static uint32_t getUpdateStartIndex(const VkDevice device, const LAYOUT_NODE* pLayout, const GENERIC_HEADER* pUpdateStruct) |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 813 | { |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 814 | return (getBindingStartIndex(pLayout, getUpdateBinding(device, pUpdateStruct))+getUpdateArrayIndex(device, pUpdateStruct)); |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 815 | } |
| 816 | // For given layout and update, return the last overall index of the layout that is update |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 817 | static uint32_t getUpdateEndIndex(const VkDevice device, const LAYOUT_NODE* pLayout, const GENERIC_HEADER* pUpdateStruct) |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 818 | { |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 819 | return (getBindingStartIndex(pLayout, getUpdateBinding(device, pUpdateStruct))+getUpdateArrayIndex(device, pUpdateStruct)+getUpdateCount(device, pUpdateStruct)-1); |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 820 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 821 | // Verify that the descriptor type in the update struct matches what's expected by the layout |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 822 | static VkBool32 validateUpdateType(const VkDevice device, const LAYOUT_NODE* pLayout, const GENERIC_HEADER* pUpdateStruct) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 823 | { |
| 824 | // First get actual type of update |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 825 | VkDescriptorType actualType; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 826 | uint32_t i = 0; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 827 | switch (pUpdateStruct->sType) |
| 828 | { |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 829 | case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET: |
| 830 | actualType = ((VkWriteDescriptorSet*)pUpdateStruct)->descriptorType; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 831 | break; |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 832 | case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET: |
| 833 | /* no need to validate */ |
| 834 | return 1; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 835 | break; |
| 836 | default: |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 837 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_UPDATE_STRUCT, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 838 | "Unexpected UPDATE struct of type %s (value %u) in vkUpdateDescriptors() struct tree", string_VkStructureType(pUpdateStruct->sType), pUpdateStruct->sType); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 839 | return 0; |
| 840 | } |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 841 | for (i = getUpdateStartIndex(device, pLayout, pUpdateStruct); i <= getUpdateEndIndex(device, pLayout, pUpdateStruct); i++) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 842 | if (pLayout->pTypes[i] != actualType) |
| 843 | return 0; |
| 844 | } |
| 845 | return 1; |
| 846 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 847 | // Determine the update type, allocate a new struct of that type, shadow the given pUpdate |
| 848 | // struct into the new struct and return ptr to shadow struct cast as GENERIC_HEADER |
| 849 | // NOTE : Calls to this function should be wrapped in mutex |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 850 | static GENERIC_HEADER* shadowUpdateNode(const VkDevice device, GENERIC_HEADER* pUpdate) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 851 | { |
| 852 | GENERIC_HEADER* pNewNode = NULL; |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 853 | VkWriteDescriptorSet* pWDS = NULL; |
| 854 | VkCopyDescriptorSet* pCDS = NULL; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 855 | size_t array_size = 0; |
| 856 | size_t base_array_size = 0; |
| 857 | size_t total_array_size = 0; |
| 858 | size_t baseBuffAddr = 0; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 859 | switch (pUpdate->sType) |
| 860 | { |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 861 | case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET: |
| 862 | pWDS = new VkWriteDescriptorSet; |
| 863 | pNewNode = (GENERIC_HEADER*)pWDS; |
| 864 | memcpy(pWDS, pUpdate, sizeof(VkWriteDescriptorSet)); |
| 865 | pWDS->pDescriptors = new VkDescriptorInfo[pWDS->count]; |
| 866 | array_size = sizeof(VkDescriptorInfo) * pWDS->count; |
| 867 | memcpy((void*)pWDS->pDescriptors, ((VkWriteDescriptorSet*)pUpdate)->pDescriptors, array_size); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 868 | break; |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 869 | case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET: |
| 870 | pCDS = new VkCopyDescriptorSet; |
| 871 | pUpdate = (GENERIC_HEADER*)pCDS; |
| 872 | memcpy(pCDS, pUpdate, sizeof(VkCopyDescriptorSet)); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 873 | break; |
| 874 | default: |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 875 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_UPDATE_STRUCT, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 876 | "Unexpected UPDATE struct of type %s (value %u) in vkUpdateDescriptors() struct tree", string_VkStructureType(pUpdate->sType), pUpdate->sType); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 877 | return NULL; |
| 878 | } |
| 879 | // Make sure that pNext for the end of shadow copy is NULL |
| 880 | pNewNode->pNext = NULL; |
| 881 | return pNewNode; |
| 882 | } |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 883 | // update DS mappings based on ppUpdateArray |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 884 | static VkBool32 dsUpdate(VkDevice device, VkStructureType type, uint32_t updateCount, const void* pUpdateArray) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 885 | { |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 886 | const VkWriteDescriptorSet *pWDS = NULL; |
| 887 | const VkCopyDescriptorSet *pCDS = NULL; |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 888 | VkBool32 result = 1; |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 889 | |
| 890 | if (type == VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET) |
| 891 | pWDS = (const VkWriteDescriptorSet *) pUpdateArray; |
| 892 | else |
| 893 | pCDS = (const VkCopyDescriptorSet *) pUpdateArray; |
| 894 | |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 895 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 896 | LAYOUT_NODE* pLayout = NULL; |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 897 | VkDescriptorSetLayoutCreateInfo* pLayoutCI = NULL; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 898 | // TODO : If pCIList is NULL, flag error |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 899 | // Perform all updates |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 900 | for (uint32_t i = 0; i < updateCount; i++) { |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 901 | VkDescriptorSet ds = (pWDS) ? pWDS->destSet : pCDS->destSet; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 902 | SET_NODE* pSet = setMap[ds.handle]; // getSetNode() without locking |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 903 | g_lastBoundDescriptorSet = pSet->set; |
| 904 | GENERIC_HEADER* pUpdate = (pWDS) ? (GENERIC_HEADER*) &pWDS[i] : (GENERIC_HEADER*) &pCDS[i]; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 905 | pLayout = pSet->pLayout; |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 906 | // First verify valid update struct |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 907 | if (!validUpdateStruct(device, pUpdate)) { |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 908 | result = 0; |
| 909 | break; |
| 910 | } |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 911 | // Make sure that binding is within bounds |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 912 | if (pLayout->createInfo.count < getUpdateBinding(device, pUpdate)) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 913 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET, ds.handle, 0, DRAWSTATE_INVALID_UPDATE_INDEX, "DS", |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 914 | "Descriptor Set %p does not have binding to match update binding %u for update type %s!", ds, getUpdateBinding(device, pUpdate), string_VkStructureType(pUpdate->sType)); |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 915 | result = 0; |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 916 | } else { |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 917 | // Next verify that update falls within size of given binding |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 918 | if (getBindingEndIndex(pLayout, getUpdateBinding(device, pUpdate)) < getUpdateEndIndex(device, pLayout, pUpdate)) { |
Tony Barbour | 3b4732f | 2015-07-13 13:37:24 -0600 | [diff] [blame] | 919 | // TODO : Keep count of layout CI structs and size this string dynamically based on that count |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 920 | pLayoutCI = &pLayout->createInfo; |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 921 | string DSstr = vk_print_vkdescriptorsetlayoutcreateinfo(pLayoutCI, "{DS} "); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 922 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET, ds.handle, 0, DRAWSTATE_DESCRIPTOR_UPDATE_OUT_OF_BOUNDS, "DS", |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 923 | "Descriptor update type of %s is out of bounds for matching binding %u in Layout w/ CI:\n%s!", string_VkStructureType(pUpdate->sType), getUpdateBinding(device, pUpdate), DSstr.c_str()); |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 924 | result = 0; |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 925 | } else { // TODO : should we skip update on a type mismatch or force it? |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 926 | // Layout bindings match w/ update ok, now verify that update is of the right type |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 927 | if (!validateUpdateType(device, pLayout, pUpdate)) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 928 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET, ds.handle, 0, DRAWSTATE_DESCRIPTOR_TYPE_MISMATCH, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 929 | "Descriptor update type of %s does not match overlapping binding type!", string_VkStructureType(pUpdate->sType)); |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 930 | result = 0; |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 931 | } else { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 932 | // Save the update info |
| 933 | // TODO : Info message that update successful |
| 934 | // Create new update struct for this set's shadow copy |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 935 | GENERIC_HEADER* pNewNode = shadowUpdateNode(device, pUpdate); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 936 | if (NULL == pNewNode) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 937 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET, ds.handle, 0, DRAWSTATE_OUT_OF_MEMORY, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 938 | "Out of memory while attempting to allocate UPDATE struct in vkUpdateDescriptors()"); |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 939 | result = 0; |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 940 | } else { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 941 | // Insert shadow node into LL of updates for this set |
| 942 | pNewNode->pNext = pSet->pUpdateStructs; |
| 943 | pSet->pUpdateStructs = pNewNode; |
| 944 | // Now update appropriate descriptor(s) to point to new Update node |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 945 | for (uint32_t j = getUpdateStartIndex(device, pLayout, pUpdate); j <= getUpdateEndIndex(device, pLayout, pUpdate); j++) { |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 946 | assert(j<pSet->descriptorCount); |
| 947 | pSet->ppDescriptors[j] = pNewNode; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 948 | } |
| 949 | } |
| 950 | } |
| 951 | } |
| 952 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 953 | } |
| 954 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 955 | return result; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 956 | } |
| 957 | // Free the shadowed update node for this Set |
| 958 | // NOTE : Calls to this function should be wrapped in mutex |
| 959 | static void freeShadowUpdateTree(SET_NODE* pSet) |
| 960 | { |
| 961 | GENERIC_HEADER* pShadowUpdate = pSet->pUpdateStructs; |
| 962 | pSet->pUpdateStructs = NULL; |
| 963 | GENERIC_HEADER* pFreeUpdate = pShadowUpdate; |
| 964 | // Clear the descriptor mappings as they will now be invalid |
| 965 | memset(pSet->ppDescriptors, 0, pSet->descriptorCount*sizeof(GENERIC_HEADER*)); |
| 966 | while(pShadowUpdate) { |
| 967 | pFreeUpdate = pShadowUpdate; |
| 968 | pShadowUpdate = (GENERIC_HEADER*)pShadowUpdate->pNext; |
| 969 | uint32_t index = 0; |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 970 | VkWriteDescriptorSet * pWDS = NULL; |
| 971 | VkCopyDescriptorSet * pCDS = NULL; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 972 | void** ppToFree = NULL; |
| 973 | switch (pFreeUpdate->sType) |
| 974 | { |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 975 | case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET: |
| 976 | pWDS = (VkWriteDescriptorSet*)pFreeUpdate; |
| 977 | if (pWDS->pDescriptors) |
| 978 | delete[] pWDS->pDescriptors; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 979 | break; |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 980 | case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET: |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 981 | break; |
| 982 | default: |
| 983 | assert(0); |
| 984 | break; |
| 985 | } |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 986 | delete pFreeUpdate; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 987 | } |
| 988 | } |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 989 | // Free all DS Pools including their Sets & related sub-structs |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 990 | // NOTE : Calls to this function should be wrapped in mutex |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 991 | static void deletePools() |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 992 | { |
David Pinedo | d8f83d8 | 2015-04-27 16:36:17 -0600 | [diff] [blame] | 993 | if (poolMap.size() <= 0) |
| 994 | return; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 995 | for (auto ii=poolMap.begin(); ii!=poolMap.end(); ++ii) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 996 | SET_NODE* pSet = (*ii).second->pSets; |
| 997 | SET_NODE* pFreeSet = pSet; |
| 998 | while (pSet) { |
| 999 | pFreeSet = pSet; |
| 1000 | pSet = pSet->pNext; |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 1001 | // Freeing layouts handled in deleteLayouts() function |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1002 | // Free Update shadow struct tree |
| 1003 | freeShadowUpdateTree(pFreeSet); |
| 1004 | if (pFreeSet->ppDescriptors) { |
Chris Forbes | 0203879 | 2015-06-04 10:49:27 +1200 | [diff] [blame] | 1005 | delete[] pFreeSet->ppDescriptors; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1006 | } |
| 1007 | delete pFreeSet; |
| 1008 | } |
| 1009 | if ((*ii).second->createInfo.pTypeCount) { |
Chris Forbes | 0203879 | 2015-06-04 10:49:27 +1200 | [diff] [blame] | 1010 | delete[] (*ii).second->createInfo.pTypeCount; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1011 | } |
| 1012 | delete (*ii).second; |
| 1013 | } |
Jon Ashburn | 25012f7 | 2015-06-15 10:58:28 -0600 | [diff] [blame] | 1014 | poolMap.clear(); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1015 | } |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 1016 | // WARN : Once deleteLayouts() called, any layout ptrs in Pool/Set data structure will be invalid |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1017 | // NOTE : Calls to this function should be wrapped in mutex |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 1018 | static void deleteLayouts() |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1019 | { |
David Pinedo | d8f83d8 | 2015-04-27 16:36:17 -0600 | [diff] [blame] | 1020 | if (layoutMap.size() <= 0) |
| 1021 | return; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1022 | for (auto ii=layoutMap.begin(); ii!=layoutMap.end(); ++ii) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1023 | LAYOUT_NODE* pLayout = (*ii).second; |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 1024 | if (pLayout->createInfo.pBinding) { |
| 1025 | for (uint32_t i=0; i<pLayout->createInfo.count; i++) { |
| 1026 | if (pLayout->createInfo.pBinding[i].pImmutableSamplers) |
| 1027 | delete[] pLayout->createInfo.pBinding[i].pImmutableSamplers; |
| 1028 | } |
| 1029 | delete[] pLayout->createInfo.pBinding; |
| 1030 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1031 | if (pLayout->pTypes) { |
Chris Forbes | 0203879 | 2015-06-04 10:49:27 +1200 | [diff] [blame] | 1032 | delete[] pLayout->pTypes; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1033 | } |
| 1034 | delete pLayout; |
| 1035 | } |
Jon Ashburn | 25012f7 | 2015-06-15 10:58:28 -0600 | [diff] [blame] | 1036 | layoutMap.clear(); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1037 | } |
| 1038 | // Currently clearing a set is removing all previous updates to that set |
| 1039 | // TODO : Validate if this is correct clearing behavior |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1040 | static void clearDescriptorSet(VkDescriptorSet set) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1041 | { |
| 1042 | SET_NODE* pSet = getSetNode(set); |
| 1043 | if (!pSet) { |
| 1044 | // TODO : Return error |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1045 | } else { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1046 | loader_platform_thread_lock_mutex(&globalLock); |
| 1047 | freeShadowUpdateTree(pSet); |
| 1048 | loader_platform_thread_unlock_mutex(&globalLock); |
| 1049 | } |
| 1050 | } |
| 1051 | |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1052 | static void clearDescriptorPool(VkDevice device, VkDescriptorPool pool) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1053 | { |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1054 | POOL_NODE* pPool = getPoolNode(pool); |
| 1055 | if (!pPool) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1056 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DESCRIPTOR_POOL, pool.handle, 0, DRAWSTATE_INVALID_POOL, "DS", |
| 1057 | "Unable to find pool node for pool %#" PRIxLEAST64 " specified in vkResetDescriptorPool() call", pool.handle); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1058 | } else { |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1059 | // For every set off of this pool, clear it |
| 1060 | SET_NODE* pSet = pPool->pSets; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1061 | while (pSet) { |
| 1062 | clearDescriptorSet(pSet->set); |
| 1063 | } |
| 1064 | } |
| 1065 | } |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1066 | // For given CB object, fetch associated CB Node from map |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1067 | static GLOBAL_CB_NODE* getCBNode(VkCmdBuffer cb) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1068 | { |
| 1069 | loader_platform_thread_lock_mutex(&globalLock); |
| 1070 | if (cmdBufferMap.find(cb) == cmdBufferMap.end()) { |
| 1071 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1072 | // TODO : How to pass cb as srcObj here? |
| 1073 | log_msg(mdd(cb), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_INVALID_CMD_BUFFER, "DS", |
| 1074 | "Attempt to use CmdBuffer %#" PRIxLEAST64 " that doesn't exist!", reinterpret_cast<VkUintPtrLeast64>(cb)); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1075 | return NULL; |
| 1076 | } |
| 1077 | loader_platform_thread_unlock_mutex(&globalLock); |
| 1078 | return cmdBufferMap[cb]; |
| 1079 | } |
| 1080 | // Free all CB Nodes |
| 1081 | // NOTE : Calls to this function should be wrapped in mutex |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 1082 | static void deleteCmdBuffers() |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1083 | { |
David Pinedo | d8f83d8 | 2015-04-27 16:36:17 -0600 | [diff] [blame] | 1084 | if (cmdBufferMap.size() <= 0) |
| 1085 | return; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1086 | for (auto ii=cmdBufferMap.begin(); ii!=cmdBufferMap.end(); ++ii) { |
Courtney Goeltzenleuchter | ea3117c | 2015-04-27 15:04:43 -0600 | [diff] [blame] | 1087 | vector<CMD_NODE*> cmd_node_list = (*ii).second->pCmds; |
| 1088 | while (!cmd_node_list.empty()) { |
| 1089 | CMD_NODE* cmd_node = cmd_node_list.back(); |
| 1090 | delete cmd_node; |
| 1091 | cmd_node_list.pop_back(); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1092 | } |
| 1093 | delete (*ii).second; |
| 1094 | } |
Jon Ashburn | 25012f7 | 2015-06-15 10:58:28 -0600 | [diff] [blame] | 1095 | cmdBufferMap.clear(); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1096 | } |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 1097 | static void report_error_no_cb_begin(const VkCmdBuffer cb, const char* caller_name) |
| 1098 | { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1099 | // TODO : How to pass cb as srcObj here? |
| 1100 | log_msg(mdd(cb), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_NO_BEGIN_CMD_BUFFER, "DS", |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 1101 | "You must call vkBeginCommandBuffer() before this call to %s", (void*)caller_name); |
| 1102 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1103 | static void addCmd(GLOBAL_CB_NODE* pCB, const CMD_TYPE cmd) |
| 1104 | { |
| 1105 | CMD_NODE* pCmd = new CMD_NODE; |
| 1106 | if (pCmd) { |
| 1107 | // init cmd node and append to end of cmd LL |
| 1108 | memset(pCmd, 0, sizeof(CMD_NODE)); |
| 1109 | pCmd->cmdNumber = ++pCB->numCmds; |
| 1110 | pCmd->type = cmd; |
| 1111 | pCB->pCmds.push_back(pCmd); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1112 | } else { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1113 | // TODO : How to pass cb as srcObj here? |
| 1114 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_OUT_OF_MEMORY, "DS", |
| 1115 | "Out of memory while attempting to allocate new CMD_NODE for cmdBuffer %#" PRIxLEAST64, reinterpret_cast<VkUintPtrLeast64>(pCB->cmdBuffer)); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1116 | } |
| 1117 | } |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1118 | static void resetCB(const VkCmdBuffer cb) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1119 | { |
| 1120 | GLOBAL_CB_NODE* pCB = getCBNode(cb); |
| 1121 | if (pCB) { |
Courtney Goeltzenleuchter | 3597a20 | 2015-04-27 17:16:56 -0600 | [diff] [blame] | 1122 | vector<CMD_NODE*> cmd_list = pCB->pCmds; |
| 1123 | while (!cmd_list.empty()) { |
| 1124 | delete cmd_list.back(); |
| 1125 | cmd_list.pop_back(); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1126 | } |
Courtney Goeltzenleuchter | 3597a20 | 2015-04-27 17:16:56 -0600 | [diff] [blame] | 1127 | pCB->pCmds.clear(); |
Tobin Ehlis | 59278bf | 2015-08-18 07:10:58 -0600 | [diff] [blame] | 1128 | // Reset CB state (need to save createInfo) |
| 1129 | VkCmdBufferCreateInfo saveCBCI = pCB->createInfo; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1130 | memset(pCB, 0, sizeof(GLOBAL_CB_NODE)); |
| 1131 | pCB->cmdBuffer = cb; |
Tobin Ehlis | 59278bf | 2015-08-18 07:10:58 -0600 | [diff] [blame] | 1132 | pCB->createInfo = saveCBCI; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1133 | pCB->lastVtxBinding = MAX_BINDING; |
| 1134 | } |
| 1135 | } |
Tobin Ehlis | e382c5a | 2015-06-10 12:57:07 -0600 | [diff] [blame] | 1136 | // Set PSO-related status bits for CB |
| 1137 | static void set_cb_pso_status(GLOBAL_CB_NODE* pCB, const PIPELINE_NODE* pPipe) |
| 1138 | { |
| 1139 | for (uint32_t i = 0; i < pPipe->cbStateCI.attachmentCount; i++) { |
| 1140 | if (0 != pPipe->pAttachments[i].channelWriteMask) { |
| 1141 | pCB->status |= CBSTATUS_COLOR_BLEND_WRITE_ENABLE; |
| 1142 | } |
| 1143 | } |
| 1144 | if (pPipe->dsStateCI.depthWriteEnable) { |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 1145 | pCB->status |= CBSTATUS_DEPTH_WRITE_ENABLE; |
| 1146 | } |
| 1147 | |
| 1148 | if (pPipe->dsStateCI.stencilTestEnable) { |
| 1149 | pCB->status |= CBSTATUS_STENCIL_TEST_ENABLE; |
Tobin Ehlis | e382c5a | 2015-06-10 12:57:07 -0600 | [diff] [blame] | 1150 | } |
| 1151 | } |
| 1152 | // Set dyn-state related status bits for an object node |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1153 | static void set_cb_dyn_status(GLOBAL_CB_NODE* pNode, DYNAMIC_STATE_BIND_POINT stateBindPoint) { |
Tobin Ehlis | e382c5a | 2015-06-10 12:57:07 -0600 | [diff] [blame] | 1154 | if (stateBindPoint == VK_STATE_BIND_POINT_VIEWPORT) { |
| 1155 | pNode->status |= CBSTATUS_VIEWPORT_BOUND; |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1156 | } else if (stateBindPoint == VK_STATE_BIND_POINT_LINE_WIDTH) { |
| 1157 | pNode->status |= CBSTATUS_LINE_WIDTH_BOUND; |
| 1158 | } else if (stateBindPoint == VK_STATE_BIND_POINT_DEPTH_BIAS) { |
| 1159 | pNode->status |= CBSTATUS_DEPTH_BIAS_BOUND; |
| 1160 | } else if (stateBindPoint == VK_STATE_BIND_POINT_BLEND) { |
| 1161 | pNode->status |= CBSTATUS_BLEND_BOUND; |
| 1162 | } else if (stateBindPoint == VK_STATE_BIND_POINT_DEPTH_BOUNDS) { |
| 1163 | pNode->status |= CBSTATUS_DEPTH_BOUNDS_BOUND; |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 1164 | } else if (stateBindPoint == VK_STATE_BIND_POINT_STENCIL) { |
| 1165 | pNode->status |= CBSTATUS_STENCIL_BOUND; |
Tobin Ehlis | e382c5a | 2015-06-10 12:57:07 -0600 | [diff] [blame] | 1166 | } |
| 1167 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1168 | // Print the last bound Gfx Pipeline |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1169 | static void printPipeline(const VkCmdBuffer cb) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1170 | { |
| 1171 | GLOBAL_CB_NODE* pCB = getCBNode(cb); |
| 1172 | if (pCB) { |
| 1173 | PIPELINE_NODE *pPipeTrav = getPipeline(pCB->lastBoundPipeline); |
| 1174 | if (!pPipeTrav) { |
| 1175 | // nothing to print |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1176 | } else { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1177 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1178 | vk_print_vkgraphicspipelinecreateinfo(&pPipeTrav->graphicsPipelineCI, "{DS}").c_str()); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1179 | } |
| 1180 | } |
| 1181 | } |
Tobin Ehlis | c4bdde1 | 2015-05-27 14:30:06 -0600 | [diff] [blame] | 1182 | // Verify bound Pipeline State Object |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 1183 | static bool validateBoundPipeline(const VkCmdBuffer cb) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1184 | { |
| 1185 | GLOBAL_CB_NODE* pCB = getCBNode(cb); |
| 1186 | if (pCB && pCB->lastBoundPipeline) { |
| 1187 | // First verify that we have a Node for bound pipeline |
| 1188 | PIPELINE_NODE *pPipeTrav = getPipeline(pCB->lastBoundPipeline); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1189 | if (!pPipeTrav) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1190 | log_msg(mdd(cb), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_PIPELINE_BOUND, "DS", |
| 1191 | "Can't find last bound Pipeline %#" PRIxLEAST64 "!", pCB->lastBoundPipeline.handle); |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 1192 | return false; |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1193 | } else { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1194 | // Verify Vtx binding |
| 1195 | if (MAX_BINDING != pCB->lastVtxBinding) { |
| 1196 | if (pCB->lastVtxBinding >= pPipeTrav->vtxBindingCount) { |
| 1197 | if (0 == pPipeTrav->vtxBindingCount) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1198 | log_msg(mdd(cb), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1199 | "Vtx Buffer Index %u was bound, but no vtx buffers are attached to PSO.", pCB->lastVtxBinding); |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 1200 | return false; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1201 | } |
| 1202 | else { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1203 | log_msg(mdd(cb), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1204 | "Vtx binding Index of %u exceeds PSO pVertexBindingDescriptions max array index of %u.", pCB->lastVtxBinding, (pPipeTrav->vtxBindingCount - 1)); |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 1205 | return false; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1206 | } |
| 1207 | } |
| 1208 | else { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1209 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1210 | vk_print_vkvertexinputbindingdescription(&pPipeTrav->pVertexBindingDescriptions[pCB->lastVtxBinding], "{DS}INFO : ").c_str()); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1211 | } |
| 1212 | } |
| 1213 | } |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 1214 | return true; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1215 | } |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 1216 | return false; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1217 | } |
| 1218 | // Print details of DS config to stdout |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1219 | static void printDSConfig(const VkCmdBuffer cb) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1220 | { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1221 | char ds_config_str[1024*256] = {0}; // TODO : Currently making this buffer HUGE w/o overrun protection. Need to be smarter, start smaller, and grow as needed. |
| 1222 | GLOBAL_CB_NODE* pCB = getCBNode(cb); |
Tobin Ehlis | 93f89e8 | 2015-06-09 08:39:32 -0600 | [diff] [blame] | 1223 | if (pCB && pCB->lastBoundDescriptorSet) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1224 | SET_NODE* pSet = getSetNode(pCB->lastBoundDescriptorSet); |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1225 | POOL_NODE* pPool = getPoolNode(pSet->pool); |
| 1226 | // Print out pool details |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1227 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
| 1228 | "Details for pool %#" PRIxLEAST64 ".", pPool->pool.handle); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1229 | string poolStr = vk_print_vkdescriptorpoolcreateinfo(&pPool->createInfo, " "); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1230 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1231 | "%s", poolStr.c_str()); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1232 | // Print out set details |
| 1233 | char prefix[10]; |
| 1234 | uint32_t index = 0; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1235 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
| 1236 | "Details for descriptor set %#" PRIxLEAST64 ".", pSet->set.handle); |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1237 | LAYOUT_NODE* pLayout = pSet->pLayout; |
| 1238 | // Print layout details |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1239 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
| 1240 | "Layout #%u, (object %#" PRIxLEAST64 ") for DS %#" PRIxLEAST64 ".", index+1, (void*)pLayout->layout.handle, (void*)pSet->set.handle); |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1241 | sprintf(prefix, " [L%u] ", index); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1242 | string DSLstr = vk_print_vkdescriptorsetlayoutcreateinfo(&pLayout->createInfo, prefix).c_str(); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1243 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1244 | "%s", DSLstr.c_str()); |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1245 | index++; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1246 | GENERIC_HEADER* pUpdate = pSet->pUpdateStructs; |
| 1247 | if (pUpdate) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1248 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
| 1249 | "Update Chain [UC] for descriptor set %#" PRIxLEAST64 ":", pSet->set.handle); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1250 | sprintf(prefix, " [UC] "); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1251 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1252 | dynamic_display(pUpdate, prefix).c_str()); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1253 | // TODO : If there is a "view" associated with this update, print CI for that view |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1254 | } else { |
Tobin Ehlis | bf081f3 | 2015-06-15 08:41:17 -0600 | [diff] [blame] | 1255 | if (0 != pSet->descriptorCount) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1256 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
| 1257 | "No Update Chain for descriptor set %#" PRIxLEAST64 " which has %u descriptors (vkUpdateDescriptors has not been called)", pSet->set.handle, pSet->descriptorCount); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1258 | } else { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1259 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
| 1260 | "FYI: No descriptors in descriptor set %#" PRIxLEAST64 ".", pSet->set.handle); |
Tobin Ehlis | bf081f3 | 2015-06-15 08:41:17 -0600 | [diff] [blame] | 1261 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1262 | } |
| 1263 | } |
| 1264 | } |
| 1265 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1266 | static void printCB(const VkCmdBuffer cb) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1267 | { |
| 1268 | GLOBAL_CB_NODE* pCB = getCBNode(cb); |
David Pinedo | d8f83d8 | 2015-04-27 16:36:17 -0600 | [diff] [blame] | 1269 | if (pCB && pCB->pCmds.size() > 0) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1270 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NONE, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1271 | "Cmds in CB %p", (void*)cb); |
Courtney Goeltzenleuchter | ba348a9 | 2015-04-27 11:16:35 -0600 | [diff] [blame] | 1272 | vector<CMD_NODE*> pCmds = pCB->pCmds; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1273 | for (auto ii=pCmds.begin(); ii!=pCmds.end(); ++ii) { |
| 1274 | // TODO : Need to pass cb as srcObj here |
| 1275 | log_msg(mdd(cb), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_NONE, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1276 | " CMD#%lu: %s", (*ii)->cmdNumber, cmdTypeToString((*ii)->type).c_str()); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1277 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1278 | } else { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1279 | // Nothing to print |
| 1280 | } |
| 1281 | } |
| 1282 | |
| 1283 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1284 | static void synchAndPrintDSConfig(const VkCmdBuffer cb) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1285 | { |
Mike Stroyan | ba35e35 | 2015-08-12 17:11:28 -0600 | [diff] [blame] | 1286 | if (!(mdd(cb)->active_flags & VK_DBG_REPORT_INFO_BIT)) { |
| 1287 | return; |
| 1288 | } |
Mark Lobodzinski | 3f41c7c | 2015-08-07 17:11:09 -0600 | [diff] [blame] | 1289 | printDSConfig(cb); |
| 1290 | printPipeline(cb); |
| 1291 | printDynamicState(cb); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1292 | } |
| 1293 | |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1294 | static void init_draw_state(layer_data *my_data) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1295 | { |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1296 | uint32_t report_flags = 0; |
| 1297 | uint32_t debug_action = 0; |
| 1298 | FILE *log_output = NULL; |
| 1299 | const char *option_str; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1300 | // initialize DrawState options |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1301 | report_flags = getLayerOptionFlags("DrawStateReportFlags", 0); |
| 1302 | getLayerOptionEnum("DrawStateDebugAction", (uint32_t *) &debug_action); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1303 | |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1304 | if (debug_action & VK_DBG_LAYER_ACTION_LOG_MSG) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1305 | { |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1306 | option_str = getLayerOption("DrawStateLogFilename"); |
| 1307 | if (option_str) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1308 | { |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1309 | log_output = fopen(option_str, "w"); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1310 | } |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1311 | if (log_output == NULL) |
| 1312 | log_output = stdout; |
| 1313 | |
| 1314 | layer_create_msg_callback(my_data->report_data, report_flags, log_callback, (void *) log_output, &my_data->logging_callback); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1315 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1316 | |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1317 | if (!globalLockInitialized) |
| 1318 | { |
| 1319 | // TODO/TBD: Need to delete this mutex sometime. How??? One |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1320 | // suggestion is to call this during vkCreateInstance(), and then we |
| 1321 | // can clean it up during vkDestroyInstance(). However, that requires |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1322 | // that the layer have per-instance locks. We need to come back and |
| 1323 | // address this soon. |
| 1324 | loader_platform_thread_create_mutex(&globalLock); |
| 1325 | globalLockInitialized = 1; |
| 1326 | } |
| 1327 | } |
| 1328 | |
Courtney Goeltzenleuchter | abc035e | 2015-06-01 14:29:58 -0600 | [diff] [blame] | 1329 | VK_LAYER_EXPORT VkResult VKAPI vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, VkInstance* pInstance) |
| 1330 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 1331 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(draw_state_instance_table_map,*pInstance); |
Courtney Goeltzenleuchter | abc035e | 2015-06-01 14:29:58 -0600 | [diff] [blame] | 1332 | VkResult result = pTable->CreateInstance(pCreateInfo, pInstance); |
| 1333 | |
| 1334 | if (result == VK_SUCCESS) { |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1335 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map); |
| 1336 | my_data->report_data = debug_report_create_instance( |
| 1337 | pTable, |
| 1338 | *pInstance, |
| 1339 | pCreateInfo->extensionCount, |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 1340 | pCreateInfo->ppEnabledExtensionNames); |
Courtney Goeltzenleuchter | d02a964 | 2015-06-08 14:58:39 -0600 | [diff] [blame] | 1341 | |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1342 | init_draw_state(my_data); |
Courtney Goeltzenleuchter | abc035e | 2015-06-01 14:29:58 -0600 | [diff] [blame] | 1343 | } |
| 1344 | return result; |
| 1345 | } |
| 1346 | |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 1347 | /* hook DestroyInstance to remove tableInstanceMap entry */ |
| 1348 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyInstance(VkInstance instance) |
| 1349 | { |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1350 | dispatch_key key = get_dispatch_key(instance); |
| 1351 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(draw_state_instance_table_map, instance); |
| 1352 | VkResult res = pTable->DestroyInstance(instance); |
| 1353 | |
| 1354 | // Clean up logging callback, if any |
| 1355 | layer_data *my_data = get_my_data_ptr(key, layer_data_map); |
| 1356 | if (my_data->logging_callback) { |
| 1357 | layer_destroy_msg_callback(my_data->report_data, my_data->logging_callback); |
| 1358 | } |
| 1359 | |
Courtney Goeltzenleuchter | ee4027d | 2015-06-28 13:01:17 -0600 | [diff] [blame] | 1360 | layer_debug_report_destroy_instance(my_data->report_data); |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1361 | layer_data_map.erase(pTable); |
| 1362 | |
| 1363 | draw_state_instance_table_map.erase(key); |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 1364 | return res; |
| 1365 | } |
| 1366 | |
Jon Ashburn | e68a9ff | 2015-05-25 14:11:37 -0600 | [diff] [blame] | 1367 | static void createDeviceRegisterExtensions(const VkDeviceCreateInfo* pCreateInfo, VkDevice device) |
| 1368 | { |
Tony Barbour | 3b4732f | 2015-07-13 13:37:24 -0600 | [diff] [blame] | 1369 | uint32_t i; |
Jon Ashburn | 747f2b6 | 2015-06-18 15:02:58 -0600 | [diff] [blame] | 1370 | VkLayerDispatchTable *pDisp = get_dispatch_table(draw_state_device_table_map, device); |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 1371 | deviceExtMap[pDisp].debug_marker_enabled = false; |
Jon Ashburn | e68a9ff | 2015-05-25 14:11:37 -0600 | [diff] [blame] | 1372 | |
| 1373 | for (i = 0; i < pCreateInfo->extensionCount; i++) { |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 1374 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], DEBUG_MARKER_EXTENSION_NAME) == 0) { |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 1375 | /* Found a matching extension name, mark it enabled and init dispatch table*/ |
| 1376 | initDebugMarkerTable(device); |
| 1377 | deviceExtMap[pDisp].debug_marker_enabled = true; |
Jon Ashburn | e68a9ff | 2015-05-25 14:11:37 -0600 | [diff] [blame] | 1378 | } |
| 1379 | |
| 1380 | } |
| 1381 | } |
| 1382 | |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 1383 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1384 | { |
Courtney Goeltzenleuchter | ca173b8 | 2015-06-25 18:01:43 -0600 | [diff] [blame] | 1385 | VkLayerDispatchTable *pDeviceTable = get_dispatch_table(draw_state_device_table_map, *pDevice); |
| 1386 | VkResult result = pDeviceTable->CreateDevice(gpu, pCreateInfo, pDevice); |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1387 | if (result == VK_SUCCESS) { |
| 1388 | layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(gpu), layer_data_map); |
| 1389 | VkLayerDispatchTable *pTable = get_dispatch_table(draw_state_device_table_map, *pDevice); |
| 1390 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map); |
| 1391 | my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice); |
Jon Ashburn | 747f2b6 | 2015-06-18 15:02:58 -0600 | [diff] [blame] | 1392 | createDeviceRegisterExtensions(pCreateInfo, *pDevice); |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1393 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1394 | return result; |
| 1395 | } |
| 1396 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1397 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyDevice(VkDevice device) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1398 | { |
| 1399 | // Free all the memory |
| 1400 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | ecc6bd0 | 2015-04-08 10:58:37 -0600 | [diff] [blame] | 1401 | deletePipelines(); |
| 1402 | deleteSamplers(); |
| 1403 | deleteImages(); |
| 1404 | deleteBuffers(); |
| 1405 | deleteCmdBuffers(); |
| 1406 | deleteDynamicState(); |
| 1407 | deletePools(); |
| 1408 | deleteLayouts(); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1409 | loader_platform_thread_unlock_mutex(&globalLock); |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 1410 | |
Jeremy Hayes | 5d29ce3 | 2015-06-19 11:37:38 -0600 | [diff] [blame] | 1411 | dispatch_key key = get_dispatch_key(device); |
Jon Ashburn | 747f2b6 | 2015-06-18 15:02:58 -0600 | [diff] [blame] | 1412 | VkLayerDispatchTable *pDisp = get_dispatch_table(draw_state_device_table_map, device); |
| 1413 | VkResult result = pDisp->DestroyDevice(device); |
| 1414 | deviceExtMap.erase(pDisp); |
Jeremy Hayes | 5d29ce3 | 2015-06-19 11:37:38 -0600 | [diff] [blame] | 1415 | draw_state_device_table_map.erase(key); |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 1416 | tableDebugMarkerMap.erase(pDisp); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1417 | return result; |
| 1418 | } |
| 1419 | |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 1420 | static const VkLayerProperties ds_global_layers[] = { |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 1421 | { |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 1422 | "DrawState", |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 1423 | VK_API_VERSION, |
| 1424 | VK_MAKE_VERSION(0, 1, 0), |
| 1425 | "Validation layer: DrawState", |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 1426 | } |
Jon Ashburn | 9fd4cc4 | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 1427 | }; |
| 1428 | |
Tony Barbour | 59a4732 | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 1429 | VK_LAYER_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties( |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 1430 | const char *pLayerName, |
| 1431 | uint32_t *pCount, |
| 1432 | VkExtensionProperties* pProperties) |
Jon Ashburn | 9fd4cc4 | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 1433 | { |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 1434 | /* DrawState does not have any global extensions */ |
| 1435 | return util_GetExtensionProperties(0, NULL, pCount, pProperties); |
| 1436 | } |
Jon Ashburn | 9fd4cc4 | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 1437 | |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 1438 | VK_LAYER_EXPORT VkResult VKAPI vkGetGlobalLayerProperties( |
| 1439 | uint32_t *pCount, |
| 1440 | VkLayerProperties* pProperties) |
| 1441 | { |
| 1442 | return util_GetLayerProperties(ARRAY_SIZE(ds_global_layers), |
| 1443 | ds_global_layers, |
| 1444 | pCount, pProperties); |
| 1445 | } |
Jon Ashburn | 9fd4cc4 | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 1446 | |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 1447 | static const VkExtensionProperties ds_device_extensions[] = { |
| 1448 | { |
| 1449 | DEBUG_MARKER_EXTENSION_NAME, |
| 1450 | VK_MAKE_VERSION(0, 1, 0), |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 1451 | } |
| 1452 | }; |
| 1453 | |
| 1454 | static const VkLayerProperties ds_device_layers[] = { |
| 1455 | { |
| 1456 | "DrawState", |
| 1457 | VK_API_VERSION, |
| 1458 | VK_MAKE_VERSION(0, 1, 0), |
| 1459 | "Validation layer: DrawState", |
| 1460 | } |
| 1461 | }; |
| 1462 | |
| 1463 | VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceExtensionProperties( |
| 1464 | VkPhysicalDevice physicalDevice, |
| 1465 | const char* pLayerName, |
| 1466 | uint32_t* pCount, |
| 1467 | VkExtensionProperties* pProperties) |
| 1468 | { |
| 1469 | /* Mem tracker does not have any physical device extensions */ |
| 1470 | return util_GetExtensionProperties(ARRAY_SIZE(ds_device_extensions), ds_device_extensions, |
| 1471 | pCount, pProperties); |
| 1472 | } |
| 1473 | |
| 1474 | VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties( |
| 1475 | VkPhysicalDevice physicalDevice, |
| 1476 | uint32_t* pCount, |
| 1477 | VkLayerProperties* pProperties) |
| 1478 | { |
| 1479 | /* Mem tracker's physical device layers are the same as global */ |
| 1480 | return util_GetLayerProperties(ARRAY_SIZE(ds_device_layers), ds_device_layers, |
| 1481 | pCount, pProperties); |
Jon Ashburn | 9fd4cc4 | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 1482 | } |
| 1483 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1484 | VK_LAYER_EXPORT VkResult VKAPI vkQueueSubmit(VkQueue queue, uint32_t cmdBufferCount, const VkCmdBuffer* pCmdBuffers, VkFence fence) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1485 | { |
Tobin Ehlis | a9f3d76 | 2015-05-22 12:38:16 -0600 | [diff] [blame] | 1486 | GLOBAL_CB_NODE* pCB = NULL; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1487 | for (uint32_t i=0; i < cmdBufferCount; i++) { |
| 1488 | // Validate that cmd buffers have been updated |
Tobin Ehlis | a9f3d76 | 2015-05-22 12:38:16 -0600 | [diff] [blame] | 1489 | pCB = getCBNode(pCmdBuffers[i]); |
| 1490 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 59278bf | 2015-08-18 07:10:58 -0600 | [diff] [blame] | 1491 | pCB->submitCount++; // increment submit count |
| 1492 | if ((pCB->beginInfo.flags & VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT) && (pCB->submitCount > 1)) { |
| 1493 | log_msg(mdd(queue), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_CMD_BUFFER_SINGLE_SUBMIT_VIOLATION, "DS", |
Tobin Ehlis | f1878c7 | 2015-08-18 14:24:32 -0600 | [diff] [blame] | 1494 | "CB %#" PRIxLEAST64 " was begun w/ VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT set, but has been submitted %#" PRIxLEAST64 " times.", reinterpret_cast<VkUintPtrLeast64>(pCB->cmdBuffer), pCB->submitCount); |
Tobin Ehlis | 59278bf | 2015-08-18 07:10:58 -0600 | [diff] [blame] | 1495 | } |
Tobin Ehlis | a9f3d76 | 2015-05-22 12:38:16 -0600 | [diff] [blame] | 1496 | if (CB_UPDATE_COMPLETE != pCB->state) { |
| 1497 | // Flag error for using CB w/o vkEndCommandBuffer() called |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1498 | // TODO : How to pass cb as srcObj? |
| 1499 | log_msg(mdd(queue), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_NO_END_CMD_BUFFER, "DS", |
| 1500 | "You must call vkEndCommandBuffer() on CB %#" PRIxLEAST64 " before this call to vkQueueSubmit()!", reinterpret_cast<VkUintPtrLeast64>(pCB->cmdBuffer)); |
Tobin Ehlis | c4bdde1 | 2015-05-27 14:30:06 -0600 | [diff] [blame] | 1501 | loader_platform_thread_unlock_mutex(&globalLock); |
| 1502 | return VK_ERROR_UNKNOWN; |
Tobin Ehlis | a9f3d76 | 2015-05-22 12:38:16 -0600 | [diff] [blame] | 1503 | } |
Tobin Ehlis | dea6ddf | 2015-05-26 16:06:50 -0600 | [diff] [blame] | 1504 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1505 | } |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 1506 | |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 1507 | VkResult result = get_dispatch_table(draw_state_device_table_map, queue)->QueueSubmit(queue, cmdBufferCount, pCmdBuffers, fence); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1508 | return result; |
| 1509 | } |
| 1510 | |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1511 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyFence(VkDevice device, VkFence fence) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1512 | { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1513 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyFence(device, fence); |
| 1514 | // TODO : Clean up any internal data structures using this obj. |
| 1515 | return result; |
| 1516 | } |
| 1517 | |
| 1518 | VK_LAYER_EXPORT VkResult VKAPI vkDestroySemaphore(VkDevice device, VkSemaphore semaphore) |
| 1519 | { |
| 1520 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroySemaphore(device, semaphore); |
| 1521 | // TODO : Clean up any internal data structures using this obj. |
| 1522 | return result; |
| 1523 | } |
| 1524 | |
| 1525 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyEvent(VkDevice device, VkEvent event) |
| 1526 | { |
| 1527 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyEvent(device, event); |
| 1528 | // TODO : Clean up any internal data structures using this obj. |
| 1529 | return result; |
| 1530 | } |
| 1531 | |
| 1532 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool) |
| 1533 | { |
| 1534 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyQueryPool(device, queryPool); |
| 1535 | // TODO : Clean up any internal data structures using this obj. |
| 1536 | return result; |
| 1537 | } |
| 1538 | |
| 1539 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyBuffer(VkDevice device, VkBuffer buffer) |
| 1540 | { |
| 1541 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyBuffer(device, buffer); |
| 1542 | // TODO : Clean up any internal data structures using this obj. |
| 1543 | return result; |
| 1544 | } |
| 1545 | |
| 1546 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyBufferView(VkDevice device, VkBufferView bufferView) |
| 1547 | { |
| 1548 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyBufferView(device, bufferView); |
| 1549 | // TODO : Clean up any internal data structures using this obj. |
| 1550 | return result; |
| 1551 | } |
| 1552 | |
| 1553 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyImage(VkDevice device, VkImage image) |
| 1554 | { |
| 1555 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyImage(device, image); |
| 1556 | // TODO : Clean up any internal data structures using this obj. |
| 1557 | return result; |
| 1558 | } |
| 1559 | |
| 1560 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyImageView(VkDevice device, VkImageView imageView) |
| 1561 | { |
| 1562 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyImageView(device, imageView); |
| 1563 | // TODO : Clean up any internal data structures using this obj. |
| 1564 | return result; |
| 1565 | } |
| 1566 | |
| 1567 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyAttachmentView(VkDevice device, VkAttachmentView attachmentView) |
| 1568 | { |
| 1569 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyAttachmentView(device, attachmentView); |
| 1570 | // TODO : Clean up any internal data structures using this obj. |
| 1571 | return result; |
| 1572 | } |
| 1573 | |
| 1574 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule) |
| 1575 | { |
| 1576 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyShaderModule(device, shaderModule); |
| 1577 | // TODO : Clean up any internal data structures using this obj. |
| 1578 | return result; |
| 1579 | } |
| 1580 | |
| 1581 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyShader(VkDevice device, VkShader shader) |
| 1582 | { |
| 1583 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyShader(device, shader); |
| 1584 | // TODO : Clean up any internal data structures using this obj. |
| 1585 | return result; |
| 1586 | } |
| 1587 | |
| 1588 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyPipeline(VkDevice device, VkPipeline pipeline) |
| 1589 | { |
| 1590 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyPipeline(device, pipeline); |
| 1591 | // TODO : Clean up any internal data structures using this obj. |
| 1592 | return result; |
| 1593 | } |
| 1594 | |
| 1595 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout) |
| 1596 | { |
| 1597 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyPipelineLayout(device, pipelineLayout); |
| 1598 | // TODO : Clean up any internal data structures using this obj. |
| 1599 | return result; |
| 1600 | } |
| 1601 | |
| 1602 | VK_LAYER_EXPORT VkResult VKAPI vkDestroySampler(VkDevice device, VkSampler sampler) |
| 1603 | { |
| 1604 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroySampler(device, sampler); |
| 1605 | // TODO : Clean up any internal data structures using this obj. |
| 1606 | return result; |
| 1607 | } |
| 1608 | |
| 1609 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout) |
| 1610 | { |
| 1611 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyDescriptorSetLayout(device, descriptorSetLayout); |
| 1612 | // TODO : Clean up any internal data structures using this obj. |
| 1613 | return result; |
| 1614 | } |
| 1615 | |
| 1616 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool) |
| 1617 | { |
| 1618 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyDescriptorPool(device, descriptorPool); |
| 1619 | // TODO : Clean up any internal data structures using this obj. |
| 1620 | return result; |
| 1621 | } |
| 1622 | |
| 1623 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicViewportState(VkDevice device, VkDynamicViewportState dynamicViewportState) |
| 1624 | { |
| 1625 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyDynamicViewportState(device, dynamicViewportState); |
| 1626 | // TODO : Clean up any internal data structures using this obj. |
| 1627 | return result; |
| 1628 | } |
| 1629 | |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1630 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicLineWidthState(VkDevice device, VkDynamicLineWidthState dynamicLineWidthState) |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1631 | { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1632 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyDynamicLineWidthState(device, dynamicLineWidthState); |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 1633 | // TODO : Clean up any internal data structures using this obj. |
| 1634 | return result; |
| 1635 | } |
| 1636 | |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1637 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicDepthBiasState(VkDevice device, VkDynamicDepthBiasState dynamicDepthBiasState) |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 1638 | { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1639 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyDynamicDepthBiasState(device, dynamicDepthBiasState); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1640 | // TODO : Clean up any internal data structures using this obj. |
| 1641 | return result; |
| 1642 | } |
| 1643 | |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1644 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicBlendState(VkDevice device, VkDynamicBlendState dynamicBlendState) |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1645 | { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1646 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyDynamicBlendState(device, dynamicBlendState); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1647 | // TODO : Clean up any internal data structures using this obj. |
| 1648 | return result; |
| 1649 | } |
| 1650 | |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1651 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicDepthBoundsState(VkDevice device, VkDynamicDepthBoundsState dynamicDepthBoundsState) |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1652 | { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1653 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyDynamicDepthBoundsState(device, dynamicDepthBoundsState); |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 1654 | // TODO : Clean up any internal data structures using this obj. |
| 1655 | return result; |
| 1656 | } |
| 1657 | |
| 1658 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicStencilState(VkDevice device, VkDynamicStencilState dynamicStencilState) |
| 1659 | { |
| 1660 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyDynamicStencilState(device, dynamicStencilState); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1661 | // TODO : Clean up any internal data structures using this obj. |
| 1662 | return result; |
| 1663 | } |
| 1664 | |
| 1665 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyCommandBuffer(VkDevice device, VkCmdBuffer commandBuffer) |
| 1666 | { |
| 1667 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyCommandBuffer(device, commandBuffer); |
| 1668 | // TODO : Clean up any internal data structures using this obj. |
| 1669 | return result; |
| 1670 | } |
| 1671 | |
| 1672 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer) |
| 1673 | { |
| 1674 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyFramebuffer(device, framebuffer); |
| 1675 | // TODO : Clean up any internal data structures using this obj. |
| 1676 | return result; |
| 1677 | } |
| 1678 | |
| 1679 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass) |
| 1680 | { |
| 1681 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyRenderPass(device, renderPass); |
| 1682 | // TODO : Clean up any internal data structures using this obj. |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1683 | return result; |
| 1684 | } |
| 1685 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1686 | VK_LAYER_EXPORT VkResult VKAPI vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, VkBufferView* pView) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1687 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 1688 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateBufferView(device, pCreateInfo, pView); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1689 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1690 | loader_platform_thread_lock_mutex(&globalLock); |
| 1691 | BUFFER_NODE* pNewNode = new BUFFER_NODE; |
| 1692 | pNewNode->buffer = *pView; |
| 1693 | pNewNode->createInfo = *pCreateInfo; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1694 | bufferMap[pView->handle] = pNewNode; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1695 | loader_platform_thread_unlock_mutex(&globalLock); |
| 1696 | } |
| 1697 | return result; |
| 1698 | } |
| 1699 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1700 | VK_LAYER_EXPORT VkResult VKAPI vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, VkImageView* pView) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1701 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 1702 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateImageView(device, pCreateInfo, pView); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1703 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1704 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1705 | imageMap[pView->handle] = *pCreateInfo; |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 1706 | loader_platform_thread_unlock_mutex(&globalLock); |
| 1707 | } |
| 1708 | return result; |
| 1709 | } |
| 1710 | |
Tobin Ehlis | ffe3581 | 2015-07-10 12:15:19 -0600 | [diff] [blame] | 1711 | VkResult VKAPI vkCreateAttachmentView( |
| 1712 | VkDevice device, |
| 1713 | const VkAttachmentViewCreateInfo* pCreateInfo, |
| 1714 | VkAttachmentView* pView) |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 1715 | { |
Tobin Ehlis | ffe3581 | 2015-07-10 12:15:19 -0600 | [diff] [blame] | 1716 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateAttachmentView(device, pCreateInfo, pView); |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 1717 | if (VK_SUCCESS == result) { |
| 1718 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1719 | viewMap[pView->handle] = *pCreateInfo; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1720 | loader_platform_thread_unlock_mutex(&globalLock); |
| 1721 | } |
| 1722 | return result; |
| 1723 | } |
| 1724 | |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 1725 | //TODO handle pipeline caches |
| 1726 | VkResult VKAPI vkCreatePipelineCache( |
| 1727 | VkDevice device, |
| 1728 | const VkPipelineCacheCreateInfo* pCreateInfo, |
| 1729 | VkPipelineCache* pPipelineCache) |
| 1730 | { |
| 1731 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreatePipelineCache(device, pCreateInfo, pPipelineCache); |
| 1732 | return result; |
| 1733 | } |
| 1734 | |
| 1735 | VkResult VKAPI vkDestroyPipelineCache( |
| 1736 | VkDevice device, |
| 1737 | VkPipelineCache pipelineCache) |
| 1738 | { |
| 1739 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyPipelineCache(device, pipelineCache); |
| 1740 | return result; |
| 1741 | } |
| 1742 | |
| 1743 | size_t VKAPI vkGetPipelineCacheSize( |
| 1744 | VkDevice device, |
| 1745 | VkPipelineCache pipelineCache) |
| 1746 | { |
| 1747 | size_t size = get_dispatch_table(draw_state_device_table_map, device)->GetPipelineCacheSize(device, pipelineCache); |
| 1748 | return size; |
| 1749 | } |
| 1750 | |
| 1751 | VkResult VKAPI vkGetPipelineCacheData( |
| 1752 | VkDevice device, |
| 1753 | VkPipelineCache pipelineCache, |
| 1754 | void* pData) |
| 1755 | { |
| 1756 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->GetPipelineCacheData(device, pipelineCache, pData); |
| 1757 | return result; |
| 1758 | } |
| 1759 | |
| 1760 | VkResult VKAPI vkMergePipelineCaches( |
| 1761 | VkDevice device, |
| 1762 | VkPipelineCache destCache, |
| 1763 | uint32_t srcCacheCount, |
| 1764 | const VkPipelineCache* pSrcCaches) |
| 1765 | { |
| 1766 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->MergePipelineCaches(device, destCache, srcCacheCount, pSrcCaches); |
| 1767 | return result; |
| 1768 | } |
| 1769 | |
| 1770 | VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t count, const VkGraphicsPipelineCreateInfo* pCreateInfos, VkPipeline* pPipelines) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1771 | { |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 1772 | VkResult result = VK_ERROR_BAD_PIPELINE_DATA; |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 1773 | //TODO handle count > 1 and handle pipelineCache |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 1774 | // The order of operations here is a little convoluted but gets the job done |
| 1775 | // 1. Pipeline create state is first shadowed into PIPELINE_NODE struct |
| 1776 | // 2. Create state is then validated (which uses flags setup during shadowing) |
| 1777 | // 3. If everything looks good, we'll then create the pipeline and add NODE to pipelineMap |
| 1778 | loader_platform_thread_lock_mutex(&globalLock); |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 1779 | PIPELINE_NODE* pPipeNode = initPipeline(pCreateInfos, NULL); |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 1780 | VkBool32 valid = verifyPipelineCreateState(device, pPipeNode); |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 1781 | loader_platform_thread_unlock_mutex(&globalLock); |
| 1782 | if (VK_TRUE == valid) { |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 1783 | result = get_dispatch_table(draw_state_device_table_map, device)->CreateGraphicsPipelines(device, pipelineCache, count, pCreateInfos, pPipelines); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1784 | log_msg(mdd(device), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_PIPELINE, (*pPipelines).handle, 0, DRAWSTATE_NONE, "DS", |
| 1785 | "Created Gfx Pipeline %#" PRIxLEAST64, (*pPipelines).handle); |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 1786 | loader_platform_thread_lock_mutex(&globalLock); |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 1787 | pPipeNode->pipeline = *pPipelines; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1788 | pipelineMap[pPipeNode->pipeline.handle] = pPipeNode; |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 1789 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1790 | } else { |
Tobin Ehlis | 75283bf | 2015-06-18 15:59:33 -0600 | [diff] [blame] | 1791 | if (pPipeNode) { |
| 1792 | // If we allocated a pipeNode, need to clean it up here |
| 1793 | delete[] pPipeNode->pVertexBindingDescriptions; |
| 1794 | delete[] pPipeNode->pVertexAttributeDescriptions; |
| 1795 | delete[] pPipeNode->pAttachments; |
| 1796 | delete pPipeNode; |
| 1797 | } |
| 1798 | } |
Courtney Goeltzenleuchter | e2aaad0 | 2015-04-13 16:16:04 -0600 | [diff] [blame] | 1799 | return result; |
| 1800 | } |
| 1801 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1802 | VK_LAYER_EXPORT VkResult VKAPI vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, VkSampler* pSampler) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1803 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 1804 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateSampler(device, pCreateInfo, pSampler); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1805 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1806 | loader_platform_thread_lock_mutex(&globalLock); |
| 1807 | SAMPLER_NODE* pNewNode = new SAMPLER_NODE; |
| 1808 | pNewNode->sampler = *pSampler; |
| 1809 | pNewNode->createInfo = *pCreateInfo; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1810 | sampleMap[pSampler->handle] = pNewNode; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1811 | loader_platform_thread_unlock_mutex(&globalLock); |
| 1812 | } |
| 1813 | return result; |
| 1814 | } |
| 1815 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1816 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayout* pSetLayout) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1817 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 1818 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateDescriptorSetLayout(device, pCreateInfo, pSetLayout); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1819 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1820 | LAYOUT_NODE* pNewNode = new LAYOUT_NODE; |
| 1821 | if (NULL == pNewNode) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1822 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT, (*pSetLayout).handle, 0, DRAWSTATE_OUT_OF_MEMORY, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1823 | "Out of memory while attempting to allocate LAYOUT_NODE in vkCreateDescriptorSetLayout()"); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1824 | } |
| 1825 | memset(pNewNode, 0, sizeof(LAYOUT_NODE)); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1826 | memcpy((void*)&pNewNode->createInfo, pCreateInfo, sizeof(VkDescriptorSetLayoutCreateInfo)); |
| 1827 | pNewNode->createInfo.pBinding = new VkDescriptorSetLayoutBinding[pCreateInfo->count]; |
| 1828 | memcpy((void*)pNewNode->createInfo.pBinding, pCreateInfo->pBinding, sizeof(VkDescriptorSetLayoutBinding)*pCreateInfo->count); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1829 | uint32_t totalCount = 0; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1830 | for (uint32_t i=0; i<pCreateInfo->count; i++) { |
Chia-I Wu | 712bb5d | 2015-05-25 16:22:52 +0800 | [diff] [blame] | 1831 | totalCount += pCreateInfo->pBinding[i].arraySize; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1832 | if (pCreateInfo->pBinding[i].pImmutableSamplers) { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1833 | VkSampler** ppIS = (VkSampler**)&pNewNode->createInfo.pBinding[i].pImmutableSamplers; |
Chia-I Wu | 712bb5d | 2015-05-25 16:22:52 +0800 | [diff] [blame] | 1834 | *ppIS = new VkSampler[pCreateInfo->pBinding[i].arraySize]; |
| 1835 | memcpy(*ppIS, pCreateInfo->pBinding[i].pImmutableSamplers, pCreateInfo->pBinding[i].arraySize*sizeof(VkSampler)); |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1836 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1837 | } |
| 1838 | if (totalCount > 0) { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1839 | pNewNode->pTypes = new VkDescriptorType[totalCount]; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1840 | uint32_t offset = 0; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1841 | uint32_t j = 0; |
| 1842 | for (uint32_t i=0; i<pCreateInfo->count; i++) { |
Chia-I Wu | 712bb5d | 2015-05-25 16:22:52 +0800 | [diff] [blame] | 1843 | for (j = 0; j < pCreateInfo->pBinding[i].arraySize; j++) { |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1844 | pNewNode->pTypes[offset + j] = pCreateInfo->pBinding[i].descriptorType; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1845 | } |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1846 | offset += j; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1847 | } |
| 1848 | } |
| 1849 | pNewNode->layout = *pSetLayout; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1850 | pNewNode->startIndex = 0; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1851 | pNewNode->endIndex = pNewNode->startIndex + totalCount - 1; |
| 1852 | assert(pNewNode->endIndex >= pNewNode->startIndex); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1853 | // Put new node at Head of global Layer list |
| 1854 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1855 | layoutMap[pSetLayout->handle] = pNewNode; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1856 | loader_platform_thread_unlock_mutex(&globalLock); |
| 1857 | } |
| 1858 | return result; |
| 1859 | } |
| 1860 | |
Mark Lobodzinski | 0fadf5f | 2015-04-17 14:11:39 -0500 | [diff] [blame] | 1861 | VkResult VKAPI vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, VkPipelineLayout* pPipelineLayout) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1862 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 1863 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreatePipelineLayout(device, pCreateInfo, pPipelineLayout); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1864 | if (VK_SUCCESS == result) { |
Mark Lobodzinski | 0fadf5f | 2015-04-17 14:11:39 -0500 | [diff] [blame] | 1865 | // TODO : Need to capture the pipeline layout |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1866 | } |
| 1867 | return result; |
| 1868 | } |
| 1869 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1870 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, VkDescriptorPoolUsage poolUsage, uint32_t maxSets, const VkDescriptorPoolCreateInfo* pCreateInfo, VkDescriptorPool* pDescriptorPool) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1871 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 1872 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateDescriptorPool(device, poolUsage, maxSets, pCreateInfo, pDescriptorPool); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1873 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1874 | // Insert this pool into Global Pool LL at head |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1875 | log_msg(mdd(device), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_DESCRIPTOR_POOL, (*pDescriptorPool).handle, 0, DRAWSTATE_OUT_OF_MEMORY, "DS", |
| 1876 | "Created Descriptor Pool %#" PRIxLEAST64, (*pDescriptorPool).handle); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1877 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1878 | POOL_NODE* pNewNode = new POOL_NODE; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1879 | if (NULL == pNewNode) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1880 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DESCRIPTOR_POOL, (*pDescriptorPool).handle, 0, DRAWSTATE_OUT_OF_MEMORY, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1881 | "Out of memory while attempting to allocate POOL_NODE in vkCreateDescriptorPool()"); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1882 | } else { |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1883 | memset(pNewNode, 0, sizeof(POOL_NODE)); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1884 | VkDescriptorPoolCreateInfo* pCI = (VkDescriptorPoolCreateInfo*)&pNewNode->createInfo; |
| 1885 | memcpy((void*)pCI, pCreateInfo, sizeof(VkDescriptorPoolCreateInfo)); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1886 | if (pNewNode->createInfo.count) { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1887 | size_t typeCountSize = pNewNode->createInfo.count * sizeof(VkDescriptorTypeCount); |
| 1888 | pNewNode->createInfo.pTypeCount = new VkDescriptorTypeCount[typeCountSize]; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1889 | memcpy((void*)pNewNode->createInfo.pTypeCount, pCreateInfo->pTypeCount, typeCountSize); |
| 1890 | } |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1891 | pNewNode->poolUsage = poolUsage; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1892 | pNewNode->maxSets = maxSets; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1893 | pNewNode->pool = *pDescriptorPool; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1894 | poolMap[pDescriptorPool->handle] = pNewNode; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1895 | } |
| 1896 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1897 | } else { |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1898 | // Need to do anything if pool create fails? |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1899 | } |
| 1900 | return result; |
| 1901 | } |
| 1902 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1903 | VK_LAYER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1904 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 1905 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->ResetDescriptorPool(device, descriptorPool); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1906 | if (VK_SUCCESS == result) { |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1907 | clearDescriptorPool(device, descriptorPool); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1908 | } |
| 1909 | return result; |
| 1910 | } |
| 1911 | |
Cody Northrop | 1e4f802 | 2015-08-03 12:47:29 -0600 | [diff] [blame] | 1912 | VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1913 | { |
Cody Northrop | 1e4f802 | 2015-08-03 12:47:29 -0600 | [diff] [blame] | 1914 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->AllocDescriptorSets(device, descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets); |
| 1915 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1916 | POOL_NODE *pPoolNode = getPoolNode(descriptorPool); |
| 1917 | if (!pPoolNode) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1918 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DESCRIPTOR_POOL, descriptorPool.handle, 0, DRAWSTATE_INVALID_POOL, "DS", |
| 1919 | "Unable to find pool node for pool %#" PRIxLEAST64 " specified in vkAllocDescriptorSets() call", descriptorPool.handle); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1920 | } else { |
Cody Northrop | 1e4f802 | 2015-08-03 12:47:29 -0600 | [diff] [blame] | 1921 | if (count == 0) { |
| 1922 | log_msg(mdd(device), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET, count, 0, DRAWSTATE_NONE, "DS", |
| 1923 | "AllocDescriptorSets called with 0 count"); |
| 1924 | } |
| 1925 | for (uint32_t i = 0; i < count; i++) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1926 | log_msg(mdd(device), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET, pDescriptorSets[i].handle, 0, DRAWSTATE_NONE, "DS", |
| 1927 | "Created Descriptor Set %#" PRIxLEAST64, pDescriptorSets[i].handle); |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1928 | // Create new set node and add to head of pool nodes |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1929 | SET_NODE* pNewNode = new SET_NODE; |
| 1930 | if (NULL == pNewNode) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1931 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET, pDescriptorSets[i].handle, 0, DRAWSTATE_OUT_OF_MEMORY, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1932 | "Out of memory while attempting to allocate SET_NODE in vkAllocDescriptorSets()"); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 1933 | } else { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1934 | memset(pNewNode, 0, sizeof(SET_NODE)); |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1935 | // Insert set at head of Set LL for this pool |
| 1936 | pNewNode->pNext = pPoolNode->pSets; |
| 1937 | pPoolNode->pSets = pNewNode; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1938 | LAYOUT_NODE* pLayout = getLayoutNode(pSetLayouts[i]); |
| 1939 | if (NULL == pLayout) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1940 | log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT, pSetLayouts[i].handle, 0, DRAWSTATE_INVALID_LAYOUT, "DS", |
| 1941 | "Unable to find set layout node for layout %#" PRIxLEAST64 " specified in vkAllocDescriptorSets() call", pSetLayouts[i].handle); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1942 | } |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 1943 | pNewNode->pLayout = pLayout; |
| 1944 | pNewNode->pool = descriptorPool; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1945 | pNewNode->set = pDescriptorSets[i]; |
| 1946 | pNewNode->setUsage = setUsage; |
| 1947 | pNewNode->descriptorCount = pLayout->endIndex + 1; |
| 1948 | if (pNewNode->descriptorCount) { |
| 1949 | size_t descriptorArraySize = sizeof(GENERIC_HEADER*)*pNewNode->descriptorCount; |
| 1950 | pNewNode->ppDescriptors = new GENERIC_HEADER*[descriptorArraySize]; |
| 1951 | memset(pNewNode->ppDescriptors, 0, descriptorArraySize); |
| 1952 | } |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1953 | setMap[pDescriptorSets[i].handle] = pNewNode; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1954 | } |
| 1955 | } |
| 1956 | } |
| 1957 | } |
| 1958 | return result; |
| 1959 | } |
| 1960 | |
Tony Barbour | 34ec692 | 2015-07-10 10:50:45 -0600 | [diff] [blame] | 1961 | VK_LAYER_EXPORT VkResult VKAPI vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) |
| 1962 | { |
| 1963 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->FreeDescriptorSets(device, descriptorPool, count, pDescriptorSets); |
| 1964 | // TODO : Clean up any internal data structures using this obj. |
| 1965 | return result; |
| 1966 | } |
| 1967 | |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 1968 | VK_LAYER_EXPORT VkResult VKAPI vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1969 | { |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 1970 | if (dsUpdate(device, VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, writeCount, pDescriptorWrites) && |
| 1971 | dsUpdate(device, VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET, copyCount, pDescriptorCopies)) { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 1972 | return get_dispatch_table(draw_state_device_table_map, device)->UpdateDescriptorSets(device, writeCount, pDescriptorWrites, copyCount, pDescriptorCopies); |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 1973 | } |
| 1974 | return VK_ERROR_UNKNOWN; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1975 | } |
| 1976 | |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1977 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicViewportState(VkDevice device, const VkDynamicViewportStateCreateInfo* pCreateInfo, VkDynamicViewportState* pState) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1978 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 1979 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateDynamicViewportState(device, pCreateInfo, pState); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1980 | VkDynamicViewportStateCreateInfo local_ci; |
| 1981 | memcpy(&local_ci, pCreateInfo, sizeof(VkDynamicViewportStateCreateInfo)); |
| 1982 | local_ci.pViewports = new VkViewport[pCreateInfo->viewportAndScissorCount]; |
| 1983 | local_ci.pScissors = new VkRect2D[pCreateInfo->viewportAndScissorCount]; |
| 1984 | loader_platform_thread_lock_mutex(&globalLock); |
| 1985 | dynamicVpStateMap[pState->handle] = local_ci; |
| 1986 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1987 | return result; |
| 1988 | } |
| 1989 | |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1990 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicLineWidthState(VkDevice device, const VkDynamicLineWidthStateCreateInfo* pCreateInfo, VkDynamicLineWidthState* pState) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 1991 | { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1992 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateDynamicLineWidthState(device, pCreateInfo, pState); |
| 1993 | //insertDynamicState(*pState, (GENERIC_HEADER*)pCreateInfo, VK_STATE_BIND_POINT_LINE_WIDTH); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 1994 | loader_platform_thread_lock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 1995 | dynamicLineWidthStateMap[pState->handle] = *pCreateInfo; |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 1996 | loader_platform_thread_unlock_mutex(&globalLock); |
| 1997 | return result; |
| 1998 | } |
| 1999 | |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2000 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthBiasState(VkDevice device, const VkDynamicDepthBiasStateCreateInfo* pCreateInfo, VkDynamicDepthBiasState* pState) |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 2001 | { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2002 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateDynamicDepthBiasState(device, pCreateInfo, pState); |
| 2003 | //insertDynamicState(*pState, (GENERIC_HEADER*)pCreateInfo, VK_STATE_BIND_POINT_DEPTH_BIAS); |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 2004 | loader_platform_thread_lock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2005 | dynamicDepthBiasStateMap[pState->handle] = *pCreateInfo; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2006 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2007 | return result; |
| 2008 | } |
| 2009 | |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2010 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicBlendState(VkDevice device, const VkDynamicBlendStateCreateInfo* pCreateInfo, VkDynamicBlendState* pState) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2011 | { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2012 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateDynamicBlendState(device, pCreateInfo, pState); |
| 2013 | //insertDynamicState(*pState, (GENERIC_HEADER*)pCreateInfo, VK_STATE_BIND_POINT_BLEND); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2014 | loader_platform_thread_lock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2015 | dynamicBlendStateMap[pState->handle] = *pCreateInfo; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2016 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2017 | return result; |
| 2018 | } |
| 2019 | |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2020 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthBoundsState(VkDevice device, const VkDynamicDepthBoundsStateCreateInfo* pCreateInfo, VkDynamicDepthBoundsState* pState) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2021 | { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2022 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateDynamicDepthBoundsState(device, pCreateInfo, pState); |
| 2023 | //insertDynamicState(*pState, (GENERIC_HEADER*)pCreateInfo, VK_STATE_BIND_POINT_DEPTH_BOUNDS); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2024 | loader_platform_thread_lock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2025 | dynamicDepthBoundsStateMap[pState->handle] = *pCreateInfo; |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 2026 | loader_platform_thread_unlock_mutex(&globalLock); |
| 2027 | return result; |
| 2028 | } |
| 2029 | |
| 2030 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicStencilState(VkDevice device, const VkDynamicStencilStateCreateInfo* pCreateInfoFront, const VkDynamicStencilStateCreateInfo* pCreateInfoBack, VkDynamicStencilState* pState) |
| 2031 | { |
| 2032 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateDynamicStencilState(device, pCreateInfoFront, pCreateInfoBack, pState); |
| 2033 | //insertDynamicState(*pState, (GENERIC_HEADER*)pCreateInfo, VK_STATE_BIND_POINT_STENCIL); |
| 2034 | loader_platform_thread_lock_mutex(&globalLock); |
| 2035 | |
| 2036 | // Bug 14406 - If back is NULL or equal to front, then single sided. |
| 2037 | // To support NULL case, simply track front twice |
| 2038 | const VkDynamicStencilStateCreateInfo* pLocalCreateInfoBack = (pCreateInfoBack == NULL) ? pCreateInfoFront : pCreateInfoBack; |
| 2039 | |
| 2040 | std::pair<VkDynamicStencilStateCreateInfo, VkDynamicStencilStateCreateInfo> infos(*pCreateInfoFront, *pLocalCreateInfoBack); |
| 2041 | dynamicStencilStateMap[pState->handle] = infos; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2042 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2043 | return result; |
| 2044 | } |
| 2045 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2046 | VK_LAYER_EXPORT VkResult VKAPI vkCreateCommandBuffer(VkDevice device, const VkCmdBufferCreateInfo* pCreateInfo, VkCmdBuffer* pCmdBuffer) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2047 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 2048 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateCommandBuffer(device, pCreateInfo, pCmdBuffer); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2049 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2050 | loader_platform_thread_lock_mutex(&globalLock); |
| 2051 | GLOBAL_CB_NODE* pCB = new GLOBAL_CB_NODE; |
| 2052 | memset(pCB, 0, sizeof(GLOBAL_CB_NODE)); |
| 2053 | pCB->cmdBuffer = *pCmdBuffer; |
Tobin Ehlis | 59278bf | 2015-08-18 07:10:58 -0600 | [diff] [blame] | 2054 | pCB->createInfo = *pCreateInfo; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2055 | pCB->lastVtxBinding = MAX_BINDING; |
Mark Lobodzinski | d9139a6 | 2015-08-04 16:24:20 -0600 | [diff] [blame] | 2056 | pCB->level = pCreateInfo->level; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2057 | cmdBufferMap[*pCmdBuffer] = pCB; |
| 2058 | loader_platform_thread_unlock_mutex(&globalLock); |
| 2059 | updateCBTracking(*pCmdBuffer); |
| 2060 | } |
| 2061 | return result; |
| 2062 | } |
| 2063 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2064 | VK_LAYER_EXPORT VkResult VKAPI vkBeginCommandBuffer(VkCmdBuffer cmdBuffer, const VkCmdBufferBeginInfo* pBeginInfo) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2065 | { |
Mark Lobodzinski | d9139a6 | 2015-08-04 16:24:20 -0600 | [diff] [blame] | 2066 | // Validate command buffer level |
| 2067 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2068 | if (pCB) { |
| 2069 | if (pCB->level == VK_CMD_BUFFER_LEVEL_PRIMARY) { |
| 2070 | if (pBeginInfo->renderPass.handle || pBeginInfo->framebuffer.handle) { |
| 2071 | // These should be NULL for a Primary CB |
| 2072 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_BEGIN_CB_INVALID_STATE, "DS", |
| 2073 | "vkCreateCommandBuffer(): Primary Command Buffer (%p) may not specify framebuffer or renderpass parameters", (void*)cmdBuffer); |
| 2074 | } |
| 2075 | } else { |
| 2076 | if (!pBeginInfo->renderPass.handle || !pBeginInfo->framebuffer.handle) { |
| 2077 | // These should NOT be null for an Secondary CB |
| 2078 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_BEGIN_CB_INVALID_STATE, "DS", |
| 2079 | "vkCreateCommandBuffer(): Secondary Command Buffers (%p) must specify framebuffer and renderpass parameters", (void*)cmdBuffer); |
| 2080 | } |
| 2081 | } |
Tobin Ehlis | 59278bf | 2015-08-18 07:10:58 -0600 | [diff] [blame] | 2082 | pCB->beginInfo = *pBeginInfo; |
| 2083 | } else { |
| 2084 | // TODO : Need to pass cmdBuffer as objType here |
| 2085 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_INVALID_CMD_BUFFER, "DS", |
| 2086 | "In vkBeginCommandBuffer() and unable to find CmdBuffer Node for CB %p!", (void*)cmdBuffer); |
Mark Lobodzinski | d9139a6 | 2015-08-04 16:24:20 -0600 | [diff] [blame] | 2087 | } |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 2088 | VkResult result = get_dispatch_table(draw_state_device_table_map, cmdBuffer)->BeginCommandBuffer(cmdBuffer, pBeginInfo); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2089 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 59278bf | 2015-08-18 07:10:58 -0600 | [diff] [blame] | 2090 | if (CB_NEW != pCB->state) |
| 2091 | resetCB(cmdBuffer); |
| 2092 | pCB->state = CB_UPDATE_ACTIVE; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2093 | updateCBTracking(cmdBuffer); |
| 2094 | } |
| 2095 | return result; |
| 2096 | } |
| 2097 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2098 | VK_LAYER_EXPORT VkResult VKAPI vkEndCommandBuffer(VkCmdBuffer cmdBuffer) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2099 | { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2100 | VkResult result = VK_ERROR_BUILDING_COMMAND_BUFFER; |
| 2101 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2102 | if (pCB) { |
| 2103 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2104 | result = get_dispatch_table(draw_state_device_table_map, cmdBuffer)->EndCommandBuffer(cmdBuffer); |
| 2105 | if (VK_SUCCESS == result) { |
| 2106 | updateCBTracking(cmdBuffer); |
| 2107 | pCB->state = CB_UPDATE_COMPLETE; |
| 2108 | // Reset CB status flags |
| 2109 | pCB->status = 0; |
| 2110 | printCB(cmdBuffer); |
| 2111 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2112 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2113 | report_error_no_cb_begin(cmdBuffer, "vkEndCommandBuffer()"); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2114 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2115 | } |
| 2116 | return result; |
| 2117 | } |
| 2118 | |
Cody Northrop | e62183e | 2015-07-09 18:08:05 -0600 | [diff] [blame] | 2119 | VK_LAYER_EXPORT VkResult VKAPI vkResetCommandBuffer(VkCmdBuffer cmdBuffer, VkCmdBufferResetFlags flags) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2120 | { |
Cody Northrop | e62183e | 2015-07-09 18:08:05 -0600 | [diff] [blame] | 2121 | VkResult result = get_dispatch_table(draw_state_device_table_map, cmdBuffer)->ResetCommandBuffer(cmdBuffer, flags); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2122 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2123 | resetCB(cmdBuffer); |
| 2124 | updateCBTracking(cmdBuffer); |
| 2125 | } |
| 2126 | return result; |
| 2127 | } |
| 2128 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2129 | VK_LAYER_EXPORT void VKAPI vkCmdBindPipeline(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2130 | { |
| 2131 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2132 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2133 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2134 | updateCBTracking(cmdBuffer); |
| 2135 | addCmd(pCB, CMD_BINDPIPELINE); |
Tobin Ehlis | 6d58e6d | 2015-06-23 08:46:18 -0600 | [diff] [blame] | 2136 | if ((VK_PIPELINE_BIND_POINT_COMPUTE == pipelineBindPoint) && (pCB->activeRenderPass)) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2137 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PIPELINE, pipeline.handle, 0, DRAWSTATE_INVALID_RENDERPASS_CMD, "DS", |
| 2138 | "Incorrectly binding compute pipeline (%#" PRIxLEAST64 ") during active RenderPass (%#" PRIxLEAST64 ")", pipeline.handle, pCB->activeRenderPass.handle); |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2139 | } else if ((VK_PIPELINE_BIND_POINT_GRAPHICS == pipelineBindPoint) && (!pCB->activeRenderPass)) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2140 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PIPELINE, pipeline.handle, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
| 2141 | "Incorrectly binding graphics pipeline (%#" PRIxLEAST64 ") without an active RenderPass", pipeline.handle); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2142 | } else { |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2143 | PIPELINE_NODE* pPN = getPipeline(pipeline); |
| 2144 | if (pPN) { |
| 2145 | pCB->lastBoundPipeline = pipeline; |
| 2146 | loader_platform_thread_lock_mutex(&globalLock); |
| 2147 | set_cb_pso_status(pCB, pPN); |
| 2148 | g_lastBoundPipeline = pPN; |
| 2149 | loader_platform_thread_unlock_mutex(&globalLock); |
| 2150 | validatePipelineState(pCB, pipelineBindPoint, pipeline); |
| 2151 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline); |
| 2152 | } else { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2153 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PIPELINE, pipeline.handle, 0, DRAWSTATE_INVALID_PIPELINE, "DS", |
| 2154 | "Attempt to bind Pipeline %#" PRIxLEAST64 " that doesn't exist!", (void*)pipeline.handle); |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2155 | } |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2156 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2157 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2158 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindPipeline()"); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2159 | } |
| 2160 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2161 | } |
| 2162 | |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2163 | VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicViewportState(VkCmdBuffer cmdBuffer, VkDynamicViewportState dynamicViewportState) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2164 | { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2165 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2166 | if (pCB) { |
| 2167 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2168 | updateCBTracking(cmdBuffer); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2169 | addCmd(pCB, CMD_BINDDYNAMICVIEWPORTSTATE); |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2170 | if (!pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2171 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
| 2172 | "Incorrect call to vkCmdBindDynamicViewportState() without an active RenderPass."); |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2173 | } |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2174 | loader_platform_thread_lock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2175 | pCB->status |= CBSTATUS_VIEWPORT_BOUND; |
| 2176 | if (dynamicVpStateMap.find(dynamicViewportState.handle) == dynamicVpStateMap.end()) { |
Tony Barbour | a05dbaa | 2015-07-09 17:31:46 -0600 | [diff] [blame] | 2177 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_VIEWPORT_STATE, dynamicViewportState.handle, 0, DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, "DS", |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2178 | "Unable to find VkDynamicViewportState object %#" PRIxLEAST64 ", was it ever created?", dynamicViewportState.handle); |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2179 | } else { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2180 | pCB->lastBoundDynamicState[VK_STATE_BIND_POINT_VIEWPORT] = dynamicViewportState.handle; |
| 2181 | g_lastBoundDynamicState[VK_STATE_BIND_POINT_VIEWPORT] = dynamicViewportState.handle; |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2182 | } |
| 2183 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2184 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindDynamicViewportState(cmdBuffer, dynamicViewportState); |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2185 | } else { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2186 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindDynamicViewportState()"); |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2187 | } |
| 2188 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2189 | } |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2190 | VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicLineWidthState(VkCmdBuffer cmdBuffer, VkDynamicLineWidthState dynamicLineWidthState) |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2191 | { |
| 2192 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2193 | if (pCB) { |
| 2194 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2195 | updateCBTracking(cmdBuffer); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2196 | addCmd(pCB, CMD_BINDDYNAMICLINEWIDTHSTATE); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2197 | if (!pCB->activeRenderPass) { |
| 2198 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2199 | "Incorrect call to vkCmdBindDynamicLineWidthState() without an active RenderPass."); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2200 | } |
| 2201 | loader_platform_thread_lock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2202 | pCB->status |= CBSTATUS_LINE_WIDTH_BOUND; |
| 2203 | if (dynamicLineWidthStateMap.find(dynamicLineWidthState.handle) == dynamicLineWidthStateMap.end()) { |
| 2204 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_LINE_WIDTH_STATE, dynamicLineWidthState.handle, 0, DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, "DS", |
| 2205 | "Unable to find VkDynamicLineWidthState object %#" PRIxLEAST64 ", was it ever created?", dynamicLineWidthState.handle); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2206 | } else { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2207 | pCB->lastBoundDynamicState[VK_STATE_BIND_POINT_LINE_WIDTH] = dynamicLineWidthState.handle; |
| 2208 | g_lastBoundDynamicState[VK_STATE_BIND_POINT_LINE_WIDTH] = dynamicLineWidthState.handle; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2209 | } |
| 2210 | loader_platform_thread_unlock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2211 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindDynamicLineWidthState(cmdBuffer, dynamicLineWidthState); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2212 | } else { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2213 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindDynamicLineWidthState()"); |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 2214 | } |
| 2215 | } |
| 2216 | } |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2217 | VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicDepthBiasState(VkCmdBuffer cmdBuffer, VkDynamicDepthBiasState dynamicDepthBiasState) |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 2218 | { |
| 2219 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2220 | if (pCB) { |
| 2221 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2222 | updateCBTracking(cmdBuffer); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2223 | addCmd(pCB, CMD_BINDDYNAMICDEPTHBIASSTATE); |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 2224 | if (!pCB->activeRenderPass) { |
| 2225 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2226 | "Incorrect call to vkCmdBindDynamicDepthBiasState() without an active RenderPass."); |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 2227 | } |
| 2228 | loader_platform_thread_lock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2229 | pCB->status |= CBSTATUS_DEPTH_BIAS_BOUND; |
| 2230 | if (dynamicDepthBiasStateMap.find(dynamicDepthBiasState.handle) == dynamicDepthBiasStateMap.end()) { |
| 2231 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_DEPTH_BIAS_STATE, dynamicDepthBiasState.handle, 0, DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, "DS", |
| 2232 | "Unable to find VkDynamicDepthBiasState object %#" PRIxLEAST64 ", was it ever created?", dynamicDepthBiasState.handle); |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 2233 | } else { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2234 | pCB->lastBoundDynamicState[VK_STATE_BIND_POINT_DEPTH_BIAS] = dynamicDepthBiasState.handle; |
| 2235 | g_lastBoundDynamicState[VK_STATE_BIND_POINT_DEPTH_BIAS] = dynamicDepthBiasState.handle; |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 2236 | } |
| 2237 | loader_platform_thread_unlock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2238 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindDynamicDepthBiasState(cmdBuffer, dynamicDepthBiasState); |
Cody Northrop | 1236511 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 2239 | } else { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2240 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindDynamicDepthBiasState()"); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2241 | } |
| 2242 | } |
| 2243 | } |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2244 | VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicBlendState(VkCmdBuffer cmdBuffer, VkDynamicBlendState dynamicBlendState) |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2245 | { |
| 2246 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2247 | if (pCB) { |
| 2248 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2249 | updateCBTracking(cmdBuffer); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2250 | addCmd(pCB, CMD_BINDDYNAMICBLENDSTATE); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2251 | if (!pCB->activeRenderPass) { |
| 2252 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2253 | "Incorrect call to vkCmdBindDynamicBlendState() without an active RenderPass."); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2254 | } |
| 2255 | loader_platform_thread_lock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2256 | pCB->status |= CBSTATUS_BLEND_BOUND; |
| 2257 | if (dynamicBlendStateMap.find(dynamicBlendState.handle) == dynamicBlendStateMap.end()) { |
| 2258 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_BLEND_STATE, dynamicBlendState.handle, 0, DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, "DS", |
| 2259 | "Unable to find VkDynamicBlendState object %#" PRIxLEAST64 ", was it ever created?", dynamicBlendState.handle); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2260 | } else { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2261 | pCB->lastBoundDynamicState[VK_STATE_BIND_POINT_BLEND] = dynamicBlendState.handle; |
| 2262 | g_lastBoundDynamicState[VK_STATE_BIND_POINT_BLEND] = dynamicBlendState.handle; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2263 | } |
| 2264 | loader_platform_thread_unlock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2265 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindDynamicBlendState(cmdBuffer, dynamicBlendState); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2266 | } else { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2267 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindDynamicBlendState()"); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2268 | } |
| 2269 | } |
| 2270 | } |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2271 | VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicDepthBoundsState(VkCmdBuffer cmdBuffer, VkDynamicDepthBoundsState dynamicDepthBoundsState) |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2272 | { |
| 2273 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2274 | if (pCB) { |
| 2275 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2276 | updateCBTracking(cmdBuffer); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2277 | addCmd(pCB, CMD_BINDDYNAMICDEPTHBOUNDSSTATE); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2278 | if (!pCB->activeRenderPass) { |
| 2279 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2280 | "Incorrect call to vkCmdBindDynamicDepthBoundsState() without an active RenderPass."); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2281 | } |
| 2282 | loader_platform_thread_lock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2283 | pCB->status |= CBSTATUS_DEPTH_BOUNDS_BOUND; |
| 2284 | if (dynamicDepthBoundsStateMap.find(dynamicDepthBoundsState.handle) == dynamicDepthBoundsStateMap.end()) { |
| 2285 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_DEPTH_BOUNDS_STATE, dynamicDepthBoundsState.handle, 0, DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, "DS", |
| 2286 | "Unable to find VkDynamicDepthBoundsState object %#" PRIxLEAST64 ", was it ever created?", dynamicDepthBoundsState.handle); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2287 | } else { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2288 | pCB->lastBoundDynamicState[VK_STATE_BIND_POINT_DEPTH_BOUNDS] = dynamicDepthBoundsState.handle; |
| 2289 | g_lastBoundDynamicState[VK_STATE_BIND_POINT_DEPTH_BOUNDS] = dynamicDepthBoundsState.handle; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2290 | } |
| 2291 | loader_platform_thread_unlock_mutex(&globalLock); |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2292 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindDynamicDepthBoundsState(cmdBuffer, dynamicDepthBoundsState); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2293 | } else { |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 2294 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindDynamicDepthBoundsState()"); |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 2295 | } |
| 2296 | } |
| 2297 | } |
| 2298 | VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicStencilState(VkCmdBuffer cmdBuffer, VkDynamicStencilState dynamicStencilState) |
| 2299 | { |
| 2300 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2301 | if (pCB) { |
| 2302 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2303 | updateCBTracking(cmdBuffer); |
| 2304 | addCmd(pCB, CMD_BINDDYNAMICSTENCILSTATE); |
| 2305 | if (!pCB->activeRenderPass) { |
| 2306 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
| 2307 | "Incorrect call to vkCmdBindDynamicStencilState() without an active RenderPass."); |
| 2308 | } |
| 2309 | loader_platform_thread_lock_mutex(&globalLock); |
| 2310 | pCB->status |= CBSTATUS_STENCIL_BOUND; |
| 2311 | if (dynamicStencilStateMap.find(dynamicStencilState.handle) == dynamicStencilStateMap.end()) { |
| 2312 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE, dynamicStencilState.handle, 0, DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, "DS", |
| 2313 | "Unable to find VkDynamicStencilState object %#" PRIxLEAST64 ", was it ever created?", dynamicStencilState.handle); |
| 2314 | } else { |
| 2315 | pCB->lastBoundDynamicState[VK_STATE_BIND_POINT_STENCIL] = dynamicStencilState.handle; |
| 2316 | g_lastBoundDynamicState[VK_STATE_BIND_POINT_STENCIL] = dynamicStencilState.handle; |
| 2317 | } |
| 2318 | loader_platform_thread_unlock_mutex(&globalLock); |
| 2319 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindDynamicStencilState(cmdBuffer, dynamicStencilState); |
| 2320 | } else { |
| 2321 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindDynamicStencilState()"); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2322 | } |
| 2323 | } |
| 2324 | } |
Mark Lobodzinski | f2093b6 | 2015-06-15 13:21:21 -0600 | [diff] [blame] | 2325 | VK_LAYER_EXPORT void VKAPI vkCmdBindDescriptorSets(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2326 | { |
| 2327 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2328 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2329 | if (pCB->state == CB_UPDATE_ACTIVE) { |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2330 | if ((VK_PIPELINE_BIND_POINT_COMPUTE == pipelineBindPoint) && (pCB->activeRenderPass)) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2331 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_RENDERPASS_CMD, "DS", |
| 2332 | "Incorrectly binding compute DescriptorSets during active RenderPass (%#" PRIxLEAST64 ")", pCB->activeRenderPass.handle); |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2333 | } else if ((VK_PIPELINE_BIND_POINT_GRAPHICS == pipelineBindPoint) && (!pCB->activeRenderPass)) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2334 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2335 | "Incorrectly binding graphics DescriptorSets without an active RenderPass"); |
| 2336 | } else if (validateBoundPipeline(cmdBuffer)) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2337 | for (uint32_t i=0; i<setCount; i++) { |
Tobin Ehlis | 3e75b2a | 2015-06-24 17:27:33 -0600 | [diff] [blame] | 2338 | SET_NODE* pSet = getSetNode(pDescriptorSets[i]); |
| 2339 | if (pSet) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2340 | loader_platform_thread_lock_mutex(&globalLock); |
| 2341 | pCB->lastBoundDescriptorSet = pDescriptorSets[i]; |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 2342 | pCB->lastBoundPipelineLayout = layout; |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2343 | pCB->boundDescriptorSets.push_back(pDescriptorSets[i]); |
| 2344 | g_lastBoundDescriptorSet = pDescriptorSets[i]; |
| 2345 | loader_platform_thread_unlock_mutex(&globalLock); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2346 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET, pDescriptorSets[i].handle, 0, DRAWSTATE_NONE, "DS", |
| 2347 | "DS %#" PRIxLEAST64 " bound on pipeline %s", pDescriptorSets[i].handle, string_VkPipelineBindPoint(pipelineBindPoint)); |
Tobin Ehlis | 3e75b2a | 2015-06-24 17:27:33 -0600 | [diff] [blame] | 2348 | if (!pSet->pUpdateStructs) |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2349 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_WARN_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET, pDescriptorSets[i].handle, 0, DRAWSTATE_DESCRIPTOR_SET_NOT_UPDATED, "DS", |
| 2350 | "DS %#" PRIxLEAST64 " bound but it was never updated. You may want to either update it or not bind it.", pDescriptorSets[i].handle); |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2351 | } else { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2352 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DESCRIPTOR_SET, pDescriptorSets[i].handle, 0, DRAWSTATE_INVALID_SET, "DS", |
| 2353 | "Attempt to bind DS %#" PRIxLEAST64 " that doesn't exist!", pDescriptorSets[i].handle); |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2354 | } |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 2355 | } |
Tobin Ehlis | 5a65cca | 2015-07-13 13:14:24 -0600 | [diff] [blame] | 2356 | updateCBTracking(cmdBuffer); |
| 2357 | addCmd(pCB, CMD_BINDDESCRIPTORSETS); |
Tobin Ehlis | 7ae7c6a | 2015-06-22 18:00:14 -0600 | [diff] [blame] | 2358 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindDescriptorSets(cmdBuffer, pipelineBindPoint, layout, firstSet, setCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2359 | } |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2360 | } else { |
| 2361 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindDescriptorSets()"); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2362 | } |
| 2363 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2364 | } |
| 2365 | |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 2366 | VK_LAYER_EXPORT void VKAPI vkCmdBindIndexBuffer(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2367 | { |
| 2368 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2369 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2370 | if (pCB->state == CB_UPDATE_ACTIVE) { |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2371 | if (!pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2372 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2373 | "Incorrect call to vkCmdBindIndexBuffer() without an active RenderPass."); |
| 2374 | } else { |
| 2375 | // TODO : Can be more exact in tracking/validating details for Idx buffer, for now just make sure *something* was bound |
| 2376 | pCB->status |= CBSTATUS_INDEX_BUFFER_BOUND; |
Tobin Ehlis | 5a65cca | 2015-07-13 13:14:24 -0600 | [diff] [blame] | 2377 | updateCBTracking(cmdBuffer); |
| 2378 | addCmd(pCB, CMD_BINDINDEXBUFFER); |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2379 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindIndexBuffer(cmdBuffer, buffer, offset, indexType); |
| 2380 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2381 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2382 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2383 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2384 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2385 | } |
| 2386 | |
Courtney Goeltzenleuchter | f68ad72 | 2015-04-16 13:38:46 -0600 | [diff] [blame] | 2387 | VK_LAYER_EXPORT void VKAPI vkCmdBindVertexBuffers( |
| 2388 | VkCmdBuffer cmdBuffer, |
| 2389 | uint32_t startBinding, |
| 2390 | uint32_t bindingCount, |
| 2391 | const VkBuffer* pBuffers, |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 2392 | const VkDeviceSize* pOffsets) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2393 | { |
| 2394 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2395 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2396 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2397 | /* TODO: Need to track all the vertex buffers, not just last one */ |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2398 | if (!pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2399 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2400 | "Incorrect call to vkCmdBindVertexBuffers() without an active RenderPass."); |
| 2401 | } else { |
| 2402 | pCB->lastVtxBinding = startBinding + bindingCount -1; |
| 2403 | if (validateBoundPipeline(cmdBuffer)) { |
Tobin Ehlis | 5a65cca | 2015-07-13 13:14:24 -0600 | [diff] [blame] | 2404 | updateCBTracking(cmdBuffer); |
| 2405 | addCmd(pCB, CMD_BINDVERTEXBUFFER); |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2406 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindVertexBuffers(cmdBuffer, startBinding, bindingCount, pBuffers, pOffsets); |
| 2407 | } |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2408 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2409 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2410 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
Tobin Ehlis | 0174fed | 2015-05-28 12:10:17 -0600 | [diff] [blame] | 2411 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2412 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2413 | } |
| 2414 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2415 | VK_LAYER_EXPORT void VKAPI vkCmdDraw(VkCmdBuffer cmdBuffer, uint32_t firstVertex, uint32_t vertexCount, uint32_t firstInstance, uint32_t instanceCount) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2416 | { |
| 2417 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 2418 | VkBool32 valid = VK_FALSE; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2419 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2420 | if (pCB->state == CB_UPDATE_ACTIVE) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2421 | pCB->drawCount[DRAW]++; |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 2422 | valid = validate_draw_state(pCB, VK_FALSE); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2423 | // TODO : Need to pass cmdBuffer as srcObj here |
| 2424 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_NONE, "DS", |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2425 | "vkCmdDraw() call #%lu, reporting DS state:", g_drawCount[DRAW]++); |
| 2426 | synchAndPrintDSConfig(cmdBuffer); |
| 2427 | if (valid) { |
Tobin Ehlis | 5a65cca | 2015-07-13 13:14:24 -0600 | [diff] [blame] | 2428 | updateCBTracking(cmdBuffer); |
| 2429 | addCmd(pCB, CMD_DRAW); |
| 2430 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount); |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2431 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2432 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2433 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2434 | } |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 2435 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2436 | } |
| 2437 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2438 | VK_LAYER_EXPORT void VKAPI vkCmdDrawIndexed(VkCmdBuffer cmdBuffer, uint32_t firstIndex, uint32_t indexCount, int32_t vertexOffset, uint32_t firstInstance, uint32_t instanceCount) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2439 | { |
| 2440 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 2441 | VkBool32 valid = VK_FALSE; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2442 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2443 | if (pCB->state == CB_UPDATE_ACTIVE) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2444 | pCB->drawCount[DRAW_INDEXED]++; |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 2445 | valid = validate_draw_state(pCB, VK_TRUE); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2446 | // TODO : Need to pass cmdBuffer as srcObj here |
| 2447 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_NONE, "DS", |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2448 | "vkCmdDrawIndexed() call #%lu, reporting DS state:", g_drawCount[DRAW_INDEXED]++); |
| 2449 | synchAndPrintDSConfig(cmdBuffer); |
| 2450 | if (valid) { |
Tobin Ehlis | 5a65cca | 2015-07-13 13:14:24 -0600 | [diff] [blame] | 2451 | updateCBTracking(cmdBuffer); |
| 2452 | addCmd(pCB, CMD_DRAWINDEXED); |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2453 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount); |
| 2454 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2455 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2456 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2457 | } |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 2458 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2459 | } |
| 2460 | |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 2461 | VK_LAYER_EXPORT void VKAPI vkCmdDrawIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2462 | { |
| 2463 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 2464 | VkBool32 valid = VK_FALSE; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2465 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2466 | if (pCB->state == CB_UPDATE_ACTIVE) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2467 | pCB->drawCount[DRAW_INDIRECT]++; |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 2468 | valid = validate_draw_state(pCB, VK_FALSE); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2469 | // TODO : Need to pass cmdBuffer as srcObj here |
| 2470 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_NONE, "DS", |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2471 | "vkCmdDrawIndirect() call #%lu, reporting DS state:", g_drawCount[DRAW_INDIRECT]++); |
| 2472 | synchAndPrintDSConfig(cmdBuffer); |
| 2473 | if (valid) { |
Tobin Ehlis | 5a65cca | 2015-07-13 13:14:24 -0600 | [diff] [blame] | 2474 | updateCBTracking(cmdBuffer); |
| 2475 | addCmd(pCB, CMD_DRAWINDIRECT); |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2476 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdDrawIndirect(cmdBuffer, buffer, offset, count, stride); |
| 2477 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2478 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2479 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2480 | } |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 2481 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2482 | } |
| 2483 | |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 2484 | VK_LAYER_EXPORT void VKAPI vkCmdDrawIndexedIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2485 | { |
| 2486 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
Courtney Goeltzenleuchter | cd2a099 | 2015-07-09 11:44:38 -0600 | [diff] [blame] | 2487 | VkBool32 valid = VK_FALSE; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2488 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2489 | if (pCB->state == CB_UPDATE_ACTIVE) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2490 | pCB->drawCount[DRAW_INDEXED_INDIRECT]++; |
Tobin Ehlis | 429b91d | 2015-06-22 17:20:50 -0600 | [diff] [blame] | 2491 | valid = validate_draw_state(pCB, VK_TRUE); |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2492 | // TODO : Need to pass cmdBuffer as srcObj here |
| 2493 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_NONE, "DS", |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2494 | "vkCmdDrawIndexedIndirect() call #%lu, reporting DS state:", g_drawCount[DRAW_INDEXED_INDIRECT]++); |
| 2495 | synchAndPrintDSConfig(cmdBuffer); |
| 2496 | if (valid) { |
Tobin Ehlis | 5a65cca | 2015-07-13 13:14:24 -0600 | [diff] [blame] | 2497 | updateCBTracking(cmdBuffer); |
| 2498 | addCmd(pCB, CMD_DRAWINDEXEDINDIRECT); |
| 2499 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdDrawIndexedIndirect(cmdBuffer, buffer, offset, count, stride); |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2500 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2501 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2502 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2503 | } |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 2504 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2505 | } |
| 2506 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2507 | VK_LAYER_EXPORT void VKAPI vkCmdDispatch(VkCmdBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2508 | { |
| 2509 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2510 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2511 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2512 | updateCBTracking(cmdBuffer); |
| 2513 | addCmd(pCB, CMD_DISPATCH); |
| 2514 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdDispatch(cmdBuffer, x, y, z); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2515 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2516 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2517 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2518 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2519 | } |
| 2520 | |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 2521 | VK_LAYER_EXPORT void VKAPI vkCmdDispatchIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2522 | { |
| 2523 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2524 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2525 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2526 | updateCBTracking(cmdBuffer); |
| 2527 | addCmd(pCB, CMD_DISPATCHINDIRECT); |
| 2528 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdDispatchIndirect(cmdBuffer, buffer, offset); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2529 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2530 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2531 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2532 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2533 | } |
| 2534 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2535 | VK_LAYER_EXPORT void VKAPI vkCmdCopyBuffer(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2536 | { |
| 2537 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2538 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2539 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2540 | updateCBTracking(cmdBuffer); |
| 2541 | addCmd(pCB, CMD_COPYBUFFER); |
| 2542 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdCopyBuffer(cmdBuffer, srcBuffer, destBuffer, regionCount, pRegions); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2543 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2544 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2545 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2546 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2547 | } |
| 2548 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2549 | VK_LAYER_EXPORT void VKAPI vkCmdCopyImage(VkCmdBuffer cmdBuffer, |
| 2550 | VkImage srcImage, |
| 2551 | VkImageLayout srcImageLayout, |
| 2552 | VkImage destImage, |
| 2553 | VkImageLayout destImageLayout, |
| 2554 | uint32_t regionCount, const VkImageCopy* pRegions) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2555 | { |
| 2556 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2557 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2558 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2559 | updateCBTracking(cmdBuffer); |
| 2560 | addCmd(pCB, CMD_COPYIMAGE); |
| 2561 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdCopyImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2562 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2563 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2564 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2565 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2566 | } |
| 2567 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2568 | VK_LAYER_EXPORT void VKAPI vkCmdBlitImage(VkCmdBuffer cmdBuffer, |
| 2569 | VkImage srcImage, VkImageLayout srcImageLayout, |
| 2570 | VkImage destImage, VkImageLayout destImageLayout, |
Mark Lobodzinski | ee5eef1 | 2015-05-22 14:43:25 -0500 | [diff] [blame] | 2571 | uint32_t regionCount, const VkImageBlit* pRegions, |
| 2572 | VkTexFilter filter) |
Courtney Goeltzenleuchter | 91f9cee | 2015-04-03 14:42:51 -0600 | [diff] [blame] | 2573 | { |
| 2574 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2575 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2576 | if (pCB->state == CB_UPDATE_ACTIVE) { |
Tobin Ehlis | eac8379 | 2015-06-23 10:41:13 -0600 | [diff] [blame] | 2577 | if (pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2578 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_RENDERPASS_CMD, "DS", |
| 2579 | "Incorrectly issuing CmdBlitImage during active RenderPass (%#" PRIxLEAST64 ")", pCB->activeRenderPass.handle); |
Tobin Ehlis | 5a65cca | 2015-07-13 13:14:24 -0600 | [diff] [blame] | 2580 | } else { |
| 2581 | updateCBTracking(cmdBuffer); |
| 2582 | addCmd(pCB, CMD_BLITIMAGE); |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2583 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBlitImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions, filter); |
Tobin Ehlis | 5a65cca | 2015-07-13 13:14:24 -0600 | [diff] [blame] | 2584 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2585 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2586 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2587 | } |
Courtney Goeltzenleuchter | 91f9cee | 2015-04-03 14:42:51 -0600 | [diff] [blame] | 2588 | } |
Courtney Goeltzenleuchter | 91f9cee | 2015-04-03 14:42:51 -0600 | [diff] [blame] | 2589 | } |
| 2590 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2591 | VK_LAYER_EXPORT void VKAPI vkCmdCopyBufferToImage(VkCmdBuffer cmdBuffer, |
| 2592 | VkBuffer srcBuffer, |
| 2593 | VkImage destImage, VkImageLayout destImageLayout, |
| 2594 | uint32_t regionCount, const VkBufferImageCopy* pRegions) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2595 | { |
| 2596 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2597 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2598 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2599 | updateCBTracking(cmdBuffer); |
| 2600 | addCmd(pCB, CMD_COPYBUFFERTOIMAGE); |
| 2601 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdCopyBufferToImage(cmdBuffer, srcBuffer, destImage, destImageLayout, regionCount, pRegions); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2602 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2603 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2604 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2605 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2606 | } |
| 2607 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2608 | VK_LAYER_EXPORT void VKAPI vkCmdCopyImageToBuffer(VkCmdBuffer cmdBuffer, |
| 2609 | VkImage srcImage, VkImageLayout srcImageLayout, |
| 2610 | VkBuffer destBuffer, |
| 2611 | uint32_t regionCount, const VkBufferImageCopy* pRegions) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2612 | { |
| 2613 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2614 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2615 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2616 | updateCBTracking(cmdBuffer); |
| 2617 | addCmd(pCB, CMD_COPYIMAGETOBUFFER); |
| 2618 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdCopyImageToBuffer(cmdBuffer, srcImage, srcImageLayout, destBuffer, regionCount, pRegions); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2619 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2620 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2621 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2622 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2623 | } |
| 2624 | |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 2625 | VK_LAYER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2626 | { |
| 2627 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2628 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2629 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2630 | updateCBTracking(cmdBuffer); |
| 2631 | addCmd(pCB, CMD_UPDATEBUFFER); |
| 2632 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdUpdateBuffer(cmdBuffer, destBuffer, destOffset, dataSize, pData); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2633 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2634 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2635 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2636 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2637 | } |
| 2638 | |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 2639 | VK_LAYER_EXPORT void VKAPI vkCmdFillBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2640 | { |
| 2641 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2642 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2643 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2644 | updateCBTracking(cmdBuffer); |
| 2645 | addCmd(pCB, CMD_FILLBUFFER); |
| 2646 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdFillBuffer(cmdBuffer, destBuffer, destOffset, fillSize, data); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2647 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2648 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2649 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2650 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2651 | } |
| 2652 | |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 2653 | VK_LAYER_EXPORT void VKAPI vkCmdClearColorAttachment( |
| 2654 | VkCmdBuffer cmdBuffer, |
| 2655 | uint32_t colorAttachment, |
| 2656 | VkImageLayout imageLayout, |
| 2657 | const VkClearColorValue* pColor, |
| 2658 | uint32_t rectCount, |
| 2659 | const VkRect3D* pRects) |
| 2660 | { |
| 2661 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2662 | if (pCB) { |
| 2663 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2664 | // Warn if this is issued prior to Draw Cmd |
| 2665 | if (!hasDrawCmd(pCB)) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2666 | // TODO : cmdBuffer should be srcObj |
| 2667 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_WARN_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_CLEAR_CMD_BEFORE_DRAW, "DS", |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 2668 | "vkCmdClearColorAttachment() issued on CB object 0x%" PRIxLEAST64 " prior to any Draw Cmds." |
| 2669 | " It is recommended you use RenderPass LOAD_OP_CLEAR on Color Attachments prior to any Draw.", reinterpret_cast<VkUintPtrLeast64>(cmdBuffer)); |
| 2670 | } |
Tobin Ehlis | e247315 | 2015-06-23 11:34:28 -0600 | [diff] [blame] | 2671 | if (!pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2672 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Tobin Ehlis | e247315 | 2015-06-23 11:34:28 -0600 | [diff] [blame] | 2673 | "Clear*Attachment cmd issued without an active RenderPass. vkCmdClearColorAttachment() must only be called inside of a RenderPass." |
| 2674 | " vkCmdClearColorImage() should be used outside of a RenderPass."); |
| 2675 | } else { |
| 2676 | updateCBTracking(cmdBuffer); |
| 2677 | addCmd(pCB, CMD_CLEARCOLORATTACHMENT); |
| 2678 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdClearColorAttachment(cmdBuffer, colorAttachment, imageLayout, pColor, rectCount, pRects); |
| 2679 | } |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 2680 | } else { |
| 2681 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2682 | } |
| 2683 | } |
| 2684 | } |
| 2685 | |
| 2686 | VK_LAYER_EXPORT void VKAPI vkCmdClearDepthStencilAttachment( |
| 2687 | VkCmdBuffer cmdBuffer, |
| 2688 | VkImageAspectFlags imageAspectMask, |
| 2689 | VkImageLayout imageLayout, |
| 2690 | float depth, |
| 2691 | uint32_t stencil, |
| 2692 | uint32_t rectCount, |
| 2693 | const VkRect3D* pRects) |
| 2694 | { |
| 2695 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2696 | if (pCB) { |
| 2697 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2698 | // Warn if this is issued prior to Draw Cmd |
| 2699 | if (!hasDrawCmd(pCB)) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2700 | // TODO : cmdBuffer should be srcObj |
| 2701 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_WARN_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_CLEAR_CMD_BEFORE_DRAW, "DS", |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 2702 | "vkCmdClearDepthStencilAttachment() issued on CB object 0x%" PRIxLEAST64 " prior to any Draw Cmds." |
| 2703 | " It is recommended you use RenderPass LOAD_OP_CLEAR on DS Attachment prior to any Draw.", reinterpret_cast<VkUintPtrLeast64>(cmdBuffer)); |
| 2704 | } |
Tobin Ehlis | e247315 | 2015-06-23 11:34:28 -0600 | [diff] [blame] | 2705 | if (!pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2706 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Tobin Ehlis | e247315 | 2015-06-23 11:34:28 -0600 | [diff] [blame] | 2707 | "Clear*Attachment cmd issued without an active RenderPass. vkCmdClearDepthStencilAttachment() must only be called inside of a RenderPass." |
| 2708 | " vkCmdClearDepthStencilImage() should be used outside of a RenderPass."); |
| 2709 | } else { |
| 2710 | updateCBTracking(cmdBuffer); |
| 2711 | addCmd(pCB, CMD_CLEARDEPTHSTENCILATTACHMENT); |
| 2712 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdClearDepthStencilAttachment(cmdBuffer, imageAspectMask, imageLayout, depth, stencil, rectCount, pRects); |
| 2713 | } |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 2714 | } else { |
| 2715 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2716 | } |
| 2717 | } |
| 2718 | } |
| 2719 | |
Courtney Goeltzenleuchter | d7a5cff | 2015-04-23 17:49:22 -0600 | [diff] [blame] | 2720 | VK_LAYER_EXPORT void VKAPI vkCmdClearColorImage( |
| 2721 | VkCmdBuffer cmdBuffer, |
| 2722 | VkImage image, VkImageLayout imageLayout, |
Chris Forbes | f0796e1 | 2015-06-24 14:34:53 +1200 | [diff] [blame] | 2723 | const VkClearColorValue *pColor, |
Courtney Goeltzenleuchter | d7a5cff | 2015-04-23 17:49:22 -0600 | [diff] [blame] | 2724 | uint32_t rangeCount, const VkImageSubresourceRange* pRanges) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2725 | { |
| 2726 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2727 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2728 | if (pCB->state == CB_UPDATE_ACTIVE) { |
Tobin Ehlis | e247315 | 2015-06-23 11:34:28 -0600 | [diff] [blame] | 2729 | if (pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2730 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_RENDERPASS_CMD, "DS", |
Tobin Ehlis | e247315 | 2015-06-23 11:34:28 -0600 | [diff] [blame] | 2731 | "Clear*Image cmd issued with an active RenderPass. vkCmdClearColorImage() must only be called outside of a RenderPass." |
| 2732 | " vkCmdClearColorAttachment() should be used within a RenderPass."); |
| 2733 | } else { |
| 2734 | updateCBTracking(cmdBuffer); |
| 2735 | addCmd(pCB, CMD_CLEARCOLORIMAGE); |
| 2736 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdClearColorImage(cmdBuffer, image, imageLayout, pColor, rangeCount, pRanges); |
| 2737 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2738 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2739 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2740 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2741 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2742 | } |
| 2743 | |
Chris Forbes | d9be82b | 2015-06-22 17:21:59 +1200 | [diff] [blame] | 2744 | VK_LAYER_EXPORT void VKAPI vkCmdClearDepthStencilImage(VkCmdBuffer cmdBuffer, |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2745 | VkImage image, VkImageLayout imageLayout, |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2746 | float depth, uint32_t stencil, |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2747 | uint32_t rangeCount, const VkImageSubresourceRange* pRanges) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2748 | { |
| 2749 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2750 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2751 | if (pCB->state == CB_UPDATE_ACTIVE) { |
Tobin Ehlis | e247315 | 2015-06-23 11:34:28 -0600 | [diff] [blame] | 2752 | if (pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2753 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_RENDERPASS_CMD, "DS", |
Tobin Ehlis | e247315 | 2015-06-23 11:34:28 -0600 | [diff] [blame] | 2754 | "Clear*Image cmd issued with an active RenderPass. vkCmdClearDepthStencilImage() must only be called outside of a RenderPass." |
| 2755 | " vkCmdClearDepthStencilAttachment() should be used within a RenderPass."); |
| 2756 | } else { |
| 2757 | updateCBTracking(cmdBuffer); |
| 2758 | addCmd(pCB, CMD_CLEARDEPTHSTENCILIMAGE); |
| 2759 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdClearDepthStencilImage(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges); |
| 2760 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2761 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2762 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2763 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2764 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2765 | } |
| 2766 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2767 | VK_LAYER_EXPORT void VKAPI vkCmdResolveImage(VkCmdBuffer cmdBuffer, |
| 2768 | VkImage srcImage, VkImageLayout srcImageLayout, |
| 2769 | VkImage destImage, VkImageLayout destImageLayout, |
Tony Barbour | 6865d4a | 2015-04-13 15:02:52 -0600 | [diff] [blame] | 2770 | uint32_t regionCount, const VkImageResolve* pRegions) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2771 | { |
| 2772 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2773 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2774 | if (pCB->state == CB_UPDATE_ACTIVE) { |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2775 | if (pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2776 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_RENDERPASS_CMD, "DS", |
| 2777 | "Cannot call vkCmdResolveImage() during an active RenderPass (%#" PRIxLEAST64 ").", pCB->activeRenderPass.handle); |
Tobin Ehlis | e247315 | 2015-06-23 11:34:28 -0600 | [diff] [blame] | 2778 | } else { |
| 2779 | updateCBTracking(cmdBuffer); |
| 2780 | addCmd(pCB, CMD_RESOLVEIMAGE); |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2781 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdResolveImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions); |
Tobin Ehlis | e247315 | 2015-06-23 11:34:28 -0600 | [diff] [blame] | 2782 | } |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2783 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2784 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2785 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2786 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2787 | } |
| 2788 | |
Tony Barbour | 0b2cfb2 | 2015-06-29 16:20:35 -0600 | [diff] [blame] | 2789 | VK_LAYER_EXPORT void VKAPI vkCmdSetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2790 | { |
| 2791 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2792 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2793 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2794 | updateCBTracking(cmdBuffer); |
| 2795 | addCmd(pCB, CMD_SETEVENT); |
Tony Barbour | 0b2cfb2 | 2015-06-29 16:20:35 -0600 | [diff] [blame] | 2796 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdSetEvent(cmdBuffer, event, stageMask); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2797 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2798 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2799 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2800 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2801 | } |
| 2802 | |
Tony Barbour | 0b2cfb2 | 2015-06-29 16:20:35 -0600 | [diff] [blame] | 2803 | VK_LAYER_EXPORT void VKAPI vkCmdResetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2804 | { |
| 2805 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2806 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2807 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2808 | updateCBTracking(cmdBuffer); |
| 2809 | addCmd(pCB, CMD_RESETEVENT); |
Tony Barbour | 0b2cfb2 | 2015-06-29 16:20:35 -0600 | [diff] [blame] | 2810 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdResetEvent(cmdBuffer, event, stageMask); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2811 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2812 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2813 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2814 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2815 | } |
| 2816 | |
Courtney Goeltzenleuchter | dbd2032 | 2015-07-12 12:58:58 -0600 | [diff] [blame] | 2817 | VK_LAYER_EXPORT void VKAPI vkCmdWaitEvents(VkCmdBuffer cmdBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags sourceStageMask, VkPipelineStageFlags destStageMask, uint32_t memBarrierCount, const void* const* ppMemBarriers) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2818 | { |
| 2819 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2820 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2821 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2822 | updateCBTracking(cmdBuffer); |
| 2823 | addCmd(pCB, CMD_WAITEVENTS); |
Tony Barbour | 0b2cfb2 | 2015-06-29 16:20:35 -0600 | [diff] [blame] | 2824 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdWaitEvents(cmdBuffer, eventCount, pEvents, sourceStageMask, destStageMask, memBarrierCount, ppMemBarriers); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2825 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2826 | report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()"); |
| 2827 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2828 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2829 | } |
| 2830 | |
Courtney Goeltzenleuchter | ceebbb1 | 2015-07-12 13:07:46 -0600 | [diff] [blame] | 2831 | VK_LAYER_EXPORT void VKAPI vkCmdPipelineBarrier(VkCmdBuffer cmdBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags destStageMask, VkBool32 byRegion, uint32_t memBarrierCount, const void* const* ppMemBarriers) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2832 | { |
| 2833 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2834 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2835 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2836 | updateCBTracking(cmdBuffer); |
| 2837 | addCmd(pCB, CMD_PIPELINEBARRIER); |
Courtney Goeltzenleuchter | 5304373 | 2015-07-12 13:20:05 -0600 | [diff] [blame] | 2838 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdPipelineBarrier(cmdBuffer, srcStageMask, destStageMask, byRegion, memBarrierCount, ppMemBarriers); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2839 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2840 | report_error_no_cb_begin(cmdBuffer, "vkCmdPipelineBarrier()"); |
| 2841 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2842 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2843 | } |
| 2844 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2845 | VK_LAYER_EXPORT void VKAPI vkCmdBeginQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkFlags flags) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2846 | { |
| 2847 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2848 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2849 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2850 | updateCBTracking(cmdBuffer); |
| 2851 | addCmd(pCB, CMD_BEGINQUERY); |
| 2852 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBeginQuery(cmdBuffer, queryPool, slot, flags); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2853 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2854 | report_error_no_cb_begin(cmdBuffer, "vkCmdBeginQuery()"); |
| 2855 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2856 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2857 | } |
| 2858 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2859 | VK_LAYER_EXPORT void VKAPI vkCmdEndQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2860 | { |
| 2861 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2862 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2863 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2864 | updateCBTracking(cmdBuffer); |
| 2865 | addCmd(pCB, CMD_ENDQUERY); |
| 2866 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdEndQuery(cmdBuffer, queryPool, slot); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2867 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2868 | report_error_no_cb_begin(cmdBuffer, "vkCmdEndQuery()"); |
| 2869 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2870 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2871 | } |
| 2872 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2873 | VK_LAYER_EXPORT void VKAPI vkCmdResetQueryPool(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2874 | { |
| 2875 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2876 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2877 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2878 | updateCBTracking(cmdBuffer); |
| 2879 | addCmd(pCB, CMD_RESETQUERYPOOL); |
| 2880 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2881 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2882 | report_error_no_cb_begin(cmdBuffer, "vkCmdResetQueryPool()"); |
| 2883 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2884 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2885 | } |
| 2886 | |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 2887 | VK_LAYER_EXPORT void VKAPI vkCmdWriteTimestamp(VkCmdBuffer cmdBuffer, VkTimestampType timestampType, VkBuffer destBuffer, VkDeviceSize destOffset) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2888 | { |
| 2889 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2890 | if (pCB) { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2891 | if (pCB->state == CB_UPDATE_ACTIVE) { |
| 2892 | updateCBTracking(cmdBuffer); |
| 2893 | addCmd(pCB, CMD_WRITETIMESTAMP); |
| 2894 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdWriteTimestamp(cmdBuffer, timestampType, destBuffer, destOffset); |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 2895 | } else { |
Tobin Ehlis | 9c53644 | 2015-06-19 13:00:59 -0600 | [diff] [blame] | 2896 | report_error_no_cb_begin(cmdBuffer, "vkCmdWriteTimestamp()"); |
| 2897 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2898 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2899 | } |
| 2900 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2901 | VK_LAYER_EXPORT VkResult VKAPI vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, VkFramebuffer* pFramebuffer) |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 2902 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 2903 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateFramebuffer(device, pCreateInfo, pFramebuffer); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2904 | if (VK_SUCCESS == result) { |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 2905 | // Shadow create info and store in map |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2906 | VkFramebufferCreateInfo* localFBCI = new VkFramebufferCreateInfo(*pCreateInfo); |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2907 | if (pCreateInfo->pAttachments) { |
Cody Northrop | 3cc85e9 | 2015-08-04 10:47:08 -0600 | [diff] [blame] | 2908 | localFBCI->pAttachments = new VkAttachmentView[localFBCI->attachmentCount]; |
| 2909 | memcpy((void*)localFBCI->pAttachments, pCreateInfo->pAttachments, localFBCI->attachmentCount*sizeof(VkAttachmentView)); |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 2910 | } |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2911 | frameBufferMap[pFramebuffer->handle] = localFBCI; |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 2912 | } |
| 2913 | return result; |
| 2914 | } |
| 2915 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2916 | VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, VkRenderPass* pRenderPass) |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 2917 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 2918 | VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateRenderPass(device, pCreateInfo, pRenderPass); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2919 | if (VK_SUCCESS == result) { |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 2920 | // Shadow create info and store in map |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 2921 | VkRenderPassCreateInfo* localRPCI = new VkRenderPassCreateInfo(*pCreateInfo); |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2922 | if (pCreateInfo->pAttachments) { |
| 2923 | localRPCI->pAttachments = new VkAttachmentDescription[localRPCI->attachmentCount]; |
| 2924 | memcpy((void*)localRPCI->pAttachments, pCreateInfo->pAttachments, localRPCI->attachmentCount*sizeof(VkAttachmentDescription)); |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 2925 | } |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2926 | if (pCreateInfo->pSubpasses) { |
| 2927 | localRPCI->pSubpasses = new VkSubpassDescription[localRPCI->subpassCount]; |
| 2928 | memcpy((void*)localRPCI->pSubpasses, pCreateInfo->pSubpasses, localRPCI->subpassCount*sizeof(VkSubpassDescription)); |
| 2929 | |
| 2930 | for (uint32_t i = 0; i < localRPCI->subpassCount; i++) { |
| 2931 | VkSubpassDescription *subpass = (VkSubpassDescription *) &localRPCI->pSubpasses[i]; |
| 2932 | const uint32_t attachmentCount = subpass->inputCount + |
Cody Northrop | a505dda | 2015-08-04 11:16:41 -0600 | [diff] [blame] | 2933 | subpass->colorCount * (1 + (subpass->pResolveAttachments?1:0)) + |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2934 | subpass->preserveCount; |
| 2935 | VkAttachmentReference *attachments = new VkAttachmentReference[attachmentCount]; |
| 2936 | |
Cody Northrop | a505dda | 2015-08-04 11:16:41 -0600 | [diff] [blame] | 2937 | memcpy(attachments, subpass->pInputAttachments, |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2938 | sizeof(attachments[0]) * subpass->inputCount); |
Cody Northrop | a505dda | 2015-08-04 11:16:41 -0600 | [diff] [blame] | 2939 | subpass->pInputAttachments = attachments; |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2940 | attachments += subpass->inputCount; |
| 2941 | |
Cody Northrop | a505dda | 2015-08-04 11:16:41 -0600 | [diff] [blame] | 2942 | memcpy(attachments, subpass->pColorAttachments, |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2943 | sizeof(attachments[0]) * subpass->colorCount); |
Cody Northrop | a505dda | 2015-08-04 11:16:41 -0600 | [diff] [blame] | 2944 | subpass->pColorAttachments = attachments; |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2945 | attachments += subpass->colorCount; |
| 2946 | |
Cody Northrop | a505dda | 2015-08-04 11:16:41 -0600 | [diff] [blame] | 2947 | if (subpass->pResolveAttachments) { |
| 2948 | memcpy(attachments, subpass->pResolveAttachments, |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2949 | sizeof(attachments[0]) * subpass->colorCount); |
Cody Northrop | a505dda | 2015-08-04 11:16:41 -0600 | [diff] [blame] | 2950 | subpass->pResolveAttachments = attachments; |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2951 | attachments += subpass->colorCount; |
| 2952 | } |
| 2953 | |
Cody Northrop | a505dda | 2015-08-04 11:16:41 -0600 | [diff] [blame] | 2954 | memcpy(attachments, subpass->pPreserveAttachments, |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2955 | sizeof(attachments[0]) * subpass->preserveCount); |
Cody Northrop | a505dda | 2015-08-04 11:16:41 -0600 | [diff] [blame] | 2956 | subpass->pPreserveAttachments = attachments; |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2957 | } |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 2958 | } |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2959 | if (pCreateInfo->pDependencies) { |
| 2960 | localRPCI->pDependencies = new VkSubpassDependency[localRPCI->dependencyCount]; |
| 2961 | memcpy((void*)localRPCI->pDependencies, pCreateInfo->pDependencies, localRPCI->dependencyCount*sizeof(VkSubpassDependency)); |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 2962 | } |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2963 | renderPassMap[pRenderPass->handle] = localRPCI; |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 2964 | } |
| 2965 | return result; |
| 2966 | } |
| 2967 | |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2968 | VK_LAYER_EXPORT void VKAPI vkCmdBeginRenderPass(VkCmdBuffer cmdBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, VkRenderPassContents contents) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2969 | { |
| 2970 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2971 | if (pCB) { |
Tobin Ehlis | 259730a | 2015-06-23 16:13:03 -0600 | [diff] [blame] | 2972 | if (pRenderPassBegin && pRenderPassBegin->renderPass) { |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2973 | if (pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2974 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_RENDERPASS_CMD, "DS", |
| 2975 | "Cannot call vkCmdBeginRenderPass() during an active RenderPass (%#" PRIxLEAST64 "). You must first call vkCmdEndRenderPass().", pCB->activeRenderPass.handle); |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2976 | } else { |
| 2977 | updateCBTracking(cmdBuffer); |
| 2978 | addCmd(pCB, CMD_BEGINRENDERPASS); |
| 2979 | pCB->activeRenderPass = pRenderPassBegin->renderPass; |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2980 | pCB->activeSubpass = 0; |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2981 | pCB->framebuffer = pRenderPassBegin->framebuffer; |
| 2982 | if (pCB->lastBoundPipeline) { |
| 2983 | validatePipelineState(pCB, VK_PIPELINE_BIND_POINT_GRAPHICS, pCB->lastBoundPipeline); |
| 2984 | } |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2985 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBeginRenderPass(cmdBuffer, pRenderPassBegin, contents); |
Tobin Ehlis | 259730a | 2015-06-23 16:13:03 -0600 | [diff] [blame] | 2986 | } |
Tobin Ehlis | 502480b | 2015-06-24 15:53:07 -0600 | [diff] [blame] | 2987 | } else { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2988 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_INVALID_RENDERPASS, "DS", |
Tobin Ehlis | 259730a | 2015-06-23 16:13:03 -0600 | [diff] [blame] | 2989 | "You cannot use a NULL RenderPass object in vkCmdBeginRenderPass()"); |
Tony Barbour | badda99 | 2015-04-06 11:09:26 -0600 | [diff] [blame] | 2990 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2991 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 2992 | } |
| 2993 | |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 2994 | VK_LAYER_EXPORT void VKAPI vkCmdNextSubpass(VkCmdBuffer cmdBuffer, VkRenderPassContents contents) |
| 2995 | { |
| 2996 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 2997 | if (pCB) { |
| 2998 | if (!pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 2999 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 3000 | "Incorrect call to vkCmdNextSubpass() without an active RenderPass."); |
| 3001 | } else { |
| 3002 | updateCBTracking(cmdBuffer); |
| 3003 | addCmd(pCB, CMD_NEXTSUBPASS); |
| 3004 | pCB->activeSubpass++; |
| 3005 | if (pCB->lastBoundPipeline) { |
| 3006 | validatePipelineState(pCB, VK_PIPELINE_BIND_POINT_GRAPHICS, pCB->lastBoundPipeline); |
| 3007 | } |
| 3008 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdNextSubpass(cmdBuffer, contents); |
| 3009 | } |
| 3010 | } |
| 3011 | } |
| 3012 | |
Chia-I Wu | 0b50a1c | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 3013 | VK_LAYER_EXPORT void VKAPI vkCmdEndRenderPass(VkCmdBuffer cmdBuffer) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3014 | { |
| 3015 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 3016 | if (pCB) { |
Chia-I Wu | 0b50a1c | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 3017 | if (!pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3018 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Chia-I Wu | 0b50a1c | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 3019 | "Incorrect call to vkCmdEndRenderPass() without an active RenderPass."); |
Tobin Ehlis | 59a9c83 | 2015-06-23 16:13:03 -0600 | [diff] [blame] | 3020 | } else { |
Chia-I Wu | 0b50a1c | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 3021 | updateCBTracking(cmdBuffer); |
| 3022 | addCmd(pCB, CMD_ENDRENDERPASS); |
| 3023 | pCB->activeRenderPass = 0; |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 3024 | pCB->activeSubpass = 0; |
Chia-I Wu | 0b50a1c | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 3025 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdEndRenderPass(cmdBuffer); |
| 3026 | } |
| 3027 | } |
| 3028 | } |
| 3029 | |
| 3030 | VK_LAYER_EXPORT void VKAPI vkCmdExecuteCommands(VkCmdBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCmdBuffer* pCmdBuffers) |
| 3031 | { |
| 3032 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
| 3033 | if (pCB) { |
| 3034 | if (!pCB->activeRenderPass) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3035 | log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", |
Chia-I Wu | 0b50a1c | 2015-06-26 15:34:39 +0800 | [diff] [blame] | 3036 | "Incorrect call to vkCmdExecuteCommands() without an active RenderPass."); |
| 3037 | } else { |
| 3038 | updateCBTracking(cmdBuffer); |
| 3039 | addCmd(pCB, CMD_EXECUTECOMMANDS); |
| 3040 | get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdExecuteCommands(cmdBuffer, cmdBuffersCount, pCmdBuffers); |
Tobin Ehlis | 259730a | 2015-06-23 16:13:03 -0600 | [diff] [blame] | 3041 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3042 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3043 | } |
| 3044 | |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 3045 | VK_LAYER_EXPORT VkResult VKAPI vkDbgCreateMsgCallback( |
| 3046 | VkInstance instance, |
| 3047 | VkFlags msgFlags, |
| 3048 | const PFN_vkDbgMsgCallback pfnMsgCallback, |
| 3049 | void* pUserData, |
| 3050 | VkDbgMsgCallback* pMsgCallback) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3051 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 3052 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(draw_state_instance_table_map, instance); |
Tobin Ehlis | c16c3e9 | 2015-06-16 09:04:30 -0600 | [diff] [blame] | 3053 | VkResult res = pTable->DbgCreateMsgCallback(instance, msgFlags, pfnMsgCallback, pUserData, pMsgCallback); |
| 3054 | if (VK_SUCCESS == res) { |
| 3055 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 3056 | res = layer_create_msg_callback(my_data->report_data, msgFlags, pfnMsgCallback, pUserData, pMsgCallback); |
| 3057 | } |
| 3058 | return res; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3059 | } |
| 3060 | |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 3061 | VK_LAYER_EXPORT VkResult VKAPI vkDbgDestroyMsgCallback( |
| 3062 | VkInstance instance, |
| 3063 | VkDbgMsgCallback msgCallback) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3064 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 3065 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(draw_state_instance_table_map, instance); |
Tobin Ehlis | c16c3e9 | 2015-06-16 09:04:30 -0600 | [diff] [blame] | 3066 | VkResult res = pTable->DbgDestroyMsgCallback(instance, msgCallback); |
| 3067 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 3068 | layer_destroy_msg_callback(my_data->report_data, msgCallback); |
| 3069 | return res; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3070 | } |
| 3071 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 3072 | VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerBegin(VkCmdBuffer cmdBuffer, const char* pMarker) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3073 | { |
| 3074 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 3075 | VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) cmdBuffer; |
| 3076 | if (!deviceExtMap[pDisp].debug_marker_enabled) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3077 | // TODO : cmdBuffer should be srcObj |
| 3078 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_INVALID_EXTENSION, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 3079 | "Attempt to use CmdDbgMarkerBegin but extension disabled!"); |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 3080 | return; |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 3081 | } else if (pCB) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3082 | updateCBTracking(cmdBuffer); |
| 3083 | addCmd(pCB, CMD_DBGMARKERBEGIN); |
| 3084 | } |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 3085 | debug_marker_dispatch_table(cmdBuffer)->CmdDbgMarkerBegin(cmdBuffer, pMarker); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3086 | } |
| 3087 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 3088 | VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerEnd(VkCmdBuffer cmdBuffer) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3089 | { |
| 3090 | GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer); |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 3091 | VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) cmdBuffer; |
| 3092 | if (!deviceExtMap[pDisp].debug_marker_enabled) { |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3093 | // TODO : cmdBuffer should be srcObj |
| 3094 | log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_INVALID_EXTENSION, "DS", |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 3095 | "Attempt to use CmdDbgMarkerEnd but extension disabled!"); |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 3096 | return; |
Tobin Ehlis | ce132d8 | 2015-06-19 15:07:05 -0600 | [diff] [blame] | 3097 | } else if (pCB) { |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3098 | updateCBTracking(cmdBuffer); |
| 3099 | addCmd(pCB, CMD_DBGMARKEREND); |
| 3100 | } |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 3101 | debug_marker_dispatch_table(cmdBuffer)->CmdDbgMarkerEnd(cmdBuffer); |
| 3102 | } |
| 3103 | |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3104 | //VK_LAYER_EXPORT VkResult VKAPI vkDbgSetObjectTag(VkDevice device, VkObjectType objType, VkObject object, size_t tagSize, const void* pTag) |
| 3105 | //{ |
| 3106 | // VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device; |
| 3107 | // if (!deviceExtMap[pDisp].debug_marker_enabled) { |
| 3108 | // log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, objType, object, 0, DRAWSTATE_INVALID_EXTENSION, "DS", |
| 3109 | // "Attempt to use DbgSetObjectTag but extension disabled!"); |
| 3110 | // return VK_ERROR_UNAVAILABLE; |
| 3111 | // } |
| 3112 | // debug_marker_dispatch_table(device)->DbgSetObjectTag(device, objType, object, tagSize, pTag); |
| 3113 | //} |
| 3114 | // |
| 3115 | //VK_LAYER_EXPORT VkResult VKAPI vkDbgSetObjectName(VkDevice device, VkObjectType objType, VkObject object, size_t nameSize, const char* pName) |
| 3116 | //{ |
| 3117 | // VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device; |
| 3118 | // if (!deviceExtMap[pDisp].debug_marker_enabled) { |
| 3119 | // log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, objType, object, 0, DRAWSTATE_INVALID_EXTENSION, "DS", |
| 3120 | // "Attempt to use DbgSetObjectName but extension disabled!"); |
| 3121 | // return VK_ERROR_UNAVAILABLE; |
| 3122 | // } |
| 3123 | // debug_marker_dispatch_table(device)->DbgSetObjectName(device, objType, object, nameSize, pName); |
| 3124 | //} |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3125 | |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3126 | VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetDeviceProcAddr(VkDevice dev, const char* funcName) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3127 | { |
Jon Ashburn | 8d1b0b5 | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 3128 | if (dev == NULL) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3129 | return NULL; |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 3130 | |
Jon Ashburn | 8fd0825 | 2015-05-28 16:25:02 -0600 | [diff] [blame] | 3131 | /* loader uses this to force layer initialization; device object is wrapped */ |
| 3132 | if (!strcmp(funcName, "vkGetDeviceProcAddr")) { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 3133 | initDeviceTable(draw_state_device_table_map, (const VkBaseLayerObject *) dev); |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3134 | return (PFN_vkVoidFunction) vkGetDeviceProcAddr; |
Jon Ashburn | 8fd0825 | 2015-05-28 16:25:02 -0600 | [diff] [blame] | 3135 | } |
Courtney Goeltzenleuchter | ca173b8 | 2015-06-25 18:01:43 -0600 | [diff] [blame] | 3136 | if (!strcmp(funcName, "vkCreateDevice")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3137 | return (PFN_vkVoidFunction) vkCreateDevice; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3138 | if (!strcmp(funcName, "vkDestroyDevice")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3139 | return (PFN_vkVoidFunction) vkDestroyDevice; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3140 | if (!strcmp(funcName, "vkQueueSubmit")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3141 | return (PFN_vkVoidFunction) vkQueueSubmit; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3142 | if (!strcmp(funcName, "vkDestroyInstance")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3143 | return (PFN_vkVoidFunction) vkDestroyInstance; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3144 | if (!strcmp(funcName, "vkDestroyDevice")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3145 | return (PFN_vkVoidFunction) vkDestroyDevice; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3146 | if (!strcmp(funcName, "vkDestroyFence")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3147 | return (PFN_vkVoidFunction) vkDestroyFence; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3148 | if (!strcmp(funcName, "vkDestroySemaphore")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3149 | return (PFN_vkVoidFunction) vkDestroySemaphore; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3150 | if (!strcmp(funcName, "vkDestroyEvent")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3151 | return (PFN_vkVoidFunction) vkDestroyEvent; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3152 | if (!strcmp(funcName, "vkDestroyQueryPool")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3153 | return (PFN_vkVoidFunction) vkDestroyQueryPool; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3154 | if (!strcmp(funcName, "vkDestroyBuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3155 | return (PFN_vkVoidFunction) vkDestroyBuffer; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3156 | if (!strcmp(funcName, "vkDestroyBufferView")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3157 | return (PFN_vkVoidFunction) vkDestroyBufferView; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3158 | if (!strcmp(funcName, "vkDestroyImage")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3159 | return (PFN_vkVoidFunction) vkDestroyImage; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3160 | if (!strcmp(funcName, "vkDestroyImageView")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3161 | return (PFN_vkVoidFunction) vkDestroyImageView; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3162 | if (!strcmp(funcName, "vkDestroyAttachmentView")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3163 | return (PFN_vkVoidFunction) vkDestroyAttachmentView; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3164 | if (!strcmp(funcName, "vkDestroyShaderModule")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3165 | return (PFN_vkVoidFunction) vkDestroyShaderModule; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3166 | if (!strcmp(funcName, "vkDestroyShader")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3167 | return (PFN_vkVoidFunction) vkDestroyShader; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3168 | if (!strcmp(funcName, "vkDestroyPipeline")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3169 | return (PFN_vkVoidFunction) vkDestroyPipeline; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3170 | if (!strcmp(funcName, "vkDestroyPipelineLayout")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3171 | return (PFN_vkVoidFunction) vkDestroyPipelineLayout; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3172 | if (!strcmp(funcName, "vkDestroySampler")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3173 | return (PFN_vkVoidFunction) vkDestroySampler; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3174 | if (!strcmp(funcName, "vkDestroyDescriptorSetLayout")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3175 | return (PFN_vkVoidFunction) vkDestroyDescriptorSetLayout; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3176 | if (!strcmp(funcName, "vkDestroyDescriptorPool")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3177 | return (PFN_vkVoidFunction) vkDestroyDescriptorPool; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3178 | if (!strcmp(funcName, "vkDestroyDynamicViewportState")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3179 | return (PFN_vkVoidFunction) vkDestroyDynamicViewportState; |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 3180 | if (!strcmp(funcName, "vkDestroyDynamicLineWidthState")) |
| 3181 | return (PFN_vkVoidFunction) vkDestroyDynamicLineWidthState; |
| 3182 | if (!strcmp(funcName, "vkDestroyDynamicDepthBiasState")) |
| 3183 | return (PFN_vkVoidFunction) vkDestroyDynamicDepthBiasState; |
| 3184 | if (!strcmp(funcName, "vkDestroyDynamicBlendState")) |
| 3185 | return (PFN_vkVoidFunction) vkDestroyDynamicBlendState; |
| 3186 | if (!strcmp(funcName, "vkDestroyDynamicDepthBoundsState")) |
| 3187 | return (PFN_vkVoidFunction) vkDestroyDynamicDepthBoundsState; |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 3188 | if (!strcmp(funcName, "vkDestroyDynamicStencilState")) |
| 3189 | return (PFN_vkVoidFunction) vkDestroyDynamicStencilState; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3190 | if (!strcmp(funcName, "vkDestroyCommandBuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3191 | return (PFN_vkVoidFunction) vkDestroyCommandBuffer; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3192 | if (!strcmp(funcName, "vkDestroyFramebuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3193 | return (PFN_vkVoidFunction) vkDestroyFramebuffer; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3194 | if (!strcmp(funcName, "vkDestroyRenderPass")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3195 | return (PFN_vkVoidFunction) vkDestroyRenderPass; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3196 | if (!strcmp(funcName, "vkCreateBufferView")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3197 | return (PFN_vkVoidFunction) vkCreateBufferView; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3198 | if (!strcmp(funcName, "vkCreateImageView")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3199 | return (PFN_vkVoidFunction) vkCreateImageView; |
Tobin Ehlis | ffe3581 | 2015-07-10 12:15:19 -0600 | [diff] [blame] | 3200 | if (!strcmp(funcName, "vkCreateAttachmentView")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3201 | return (PFN_vkVoidFunction) vkCreateAttachmentView; |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 3202 | if (!strcmp(funcName, "CreatePipelineCache")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3203 | return (PFN_vkVoidFunction) vkCreatePipelineCache; |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 3204 | if (!strcmp(funcName, "DestroyPipelineCache")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3205 | return (PFN_vkVoidFunction) vkDestroyPipelineCache; |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 3206 | if (!strcmp(funcName, "GetPipelineCacheSize")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3207 | return (PFN_vkVoidFunction) vkGetPipelineCacheSize; |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 3208 | if (!strcmp(funcName, "GetPipelineCacheData")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3209 | return (PFN_vkVoidFunction) vkGetPipelineCacheData; |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 3210 | if (!strcmp(funcName, "MergePipelineCaches")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3211 | return (PFN_vkVoidFunction) vkMergePipelineCaches; |
Jon Ashburn | c669cc6 | 2015-07-09 15:02:25 -0600 | [diff] [blame] | 3212 | if (!strcmp(funcName, "vkCreateGraphicsPipelines")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3213 | return (PFN_vkVoidFunction) vkCreateGraphicsPipelines; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3214 | if (!strcmp(funcName, "vkCreateSampler")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3215 | return (PFN_vkVoidFunction) vkCreateSampler; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3216 | if (!strcmp(funcName, "vkCreateDescriptorSetLayout")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3217 | return (PFN_vkVoidFunction) vkCreateDescriptorSetLayout; |
Mark Lobodzinski | 0fadf5f | 2015-04-17 14:11:39 -0500 | [diff] [blame] | 3218 | if (!strcmp(funcName, "vkCreatePipelineLayout")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3219 | return (PFN_vkVoidFunction) vkCreatePipelineLayout; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3220 | if (!strcmp(funcName, "vkCreateDescriptorPool")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3221 | return (PFN_vkVoidFunction) vkCreateDescriptorPool; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3222 | if (!strcmp(funcName, "vkResetDescriptorPool")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3223 | return (PFN_vkVoidFunction) vkResetDescriptorPool; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3224 | if (!strcmp(funcName, "vkAllocDescriptorSets")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3225 | return (PFN_vkVoidFunction) vkAllocDescriptorSets; |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 3226 | if (!strcmp(funcName, "vkUpdateDescriptorSets")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3227 | return (PFN_vkVoidFunction) vkUpdateDescriptorSets; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3228 | if (!strcmp(funcName, "vkCreateDynamicViewportState")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3229 | return (PFN_vkVoidFunction) vkCreateDynamicViewportState; |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 3230 | if (!strcmp(funcName, "vkCreateDynamicLineWidthState")) |
| 3231 | return (PFN_vkVoidFunction) vkCreateDynamicLineWidthState; |
| 3232 | if (!strcmp(funcName, "vkCreateDynamicDepthBiasState")) |
| 3233 | return (PFN_vkVoidFunction) vkCreateDynamicDepthBiasState; |
| 3234 | if (!strcmp(funcName, "vkCreateDynamicBlendState")) |
| 3235 | return (PFN_vkVoidFunction) vkCreateDynamicBlendState; |
| 3236 | if (!strcmp(funcName, "vkCreateDynamicDepthBoundsState")) |
| 3237 | return (PFN_vkVoidFunction) vkCreateDynamicDepthBoundsState; |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 3238 | if (!strcmp(funcName, "vkCreateDynamicStencilState")) |
| 3239 | return (PFN_vkVoidFunction) vkCreateDynamicStencilState; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3240 | if (!strcmp(funcName, "vkCreateCommandBuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3241 | return (PFN_vkVoidFunction) vkCreateCommandBuffer; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3242 | if (!strcmp(funcName, "vkBeginCommandBuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3243 | return (PFN_vkVoidFunction) vkBeginCommandBuffer; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3244 | if (!strcmp(funcName, "vkEndCommandBuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3245 | return (PFN_vkVoidFunction) vkEndCommandBuffer; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3246 | if (!strcmp(funcName, "vkResetCommandBuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3247 | return (PFN_vkVoidFunction) vkResetCommandBuffer; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3248 | if (!strcmp(funcName, "vkCmdBindPipeline")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3249 | return (PFN_vkVoidFunction) vkCmdBindPipeline; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3250 | if (!strcmp(funcName, "vkCmdBindDynamicViewportState")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3251 | return (PFN_vkVoidFunction) vkCmdBindDynamicViewportState; |
Cody Northrop | 271ba75 | 2015-08-26 10:01:32 -0600 | [diff] [blame^] | 3252 | if (!strcmp(funcName, "vkCmdBindDynamicLineWidthState")) |
| 3253 | return (PFN_vkVoidFunction) vkCmdBindDynamicLineWidthState; |
| 3254 | if (!strcmp(funcName, "vkCmdBindDynamicDepthBiasState")) |
| 3255 | return (PFN_vkVoidFunction) vkCmdBindDynamicDepthBiasState; |
| 3256 | if (!strcmp(funcName, "vkCmdBindDynamicBlendState")) |
| 3257 | return (PFN_vkVoidFunction) vkCmdBindDynamicBlendState; |
| 3258 | if (!strcmp(funcName, "vkCmdBindDynamicDepthBoundsState")) |
| 3259 | return (PFN_vkVoidFunction) vkCmdBindDynamicDepthBoundsState; |
Cody Northrop | 82485a8 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 3260 | if (!strcmp(funcName, "vkCmdBindDynamicStencilState")) |
| 3261 | return (PFN_vkVoidFunction) vkCmdBindDynamicStencilState; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3262 | if (!strcmp(funcName, "vkCmdBindDescriptorSets")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3263 | return (PFN_vkVoidFunction) vkCmdBindDescriptorSets; |
Courtney Goeltzenleuchter | f68ad72 | 2015-04-16 13:38:46 -0600 | [diff] [blame] | 3264 | if (!strcmp(funcName, "vkCmdBindVertexBuffers")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3265 | return (PFN_vkVoidFunction) vkCmdBindVertexBuffers; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3266 | if (!strcmp(funcName, "vkCmdBindIndexBuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3267 | return (PFN_vkVoidFunction) vkCmdBindIndexBuffer; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3268 | if (!strcmp(funcName, "vkCmdDraw")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3269 | return (PFN_vkVoidFunction) vkCmdDraw; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3270 | if (!strcmp(funcName, "vkCmdDrawIndexed")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3271 | return (PFN_vkVoidFunction) vkCmdDrawIndexed; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3272 | if (!strcmp(funcName, "vkCmdDrawIndirect")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3273 | return (PFN_vkVoidFunction) vkCmdDrawIndirect; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3274 | if (!strcmp(funcName, "vkCmdDrawIndexedIndirect")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3275 | return (PFN_vkVoidFunction) vkCmdDrawIndexedIndirect; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3276 | if (!strcmp(funcName, "vkCmdDispatch")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3277 | return (PFN_vkVoidFunction) vkCmdDispatch; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3278 | if (!strcmp(funcName, "vkCmdDispatchIndirect")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3279 | return (PFN_vkVoidFunction) vkCmdDispatchIndirect; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3280 | if (!strcmp(funcName, "vkCmdCopyBuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3281 | return (PFN_vkVoidFunction) vkCmdCopyBuffer; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3282 | if (!strcmp(funcName, "vkCmdCopyImage")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3283 | return (PFN_vkVoidFunction) vkCmdCopyImage; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3284 | if (!strcmp(funcName, "vkCmdCopyBufferToImage")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3285 | return (PFN_vkVoidFunction) vkCmdCopyBufferToImage; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3286 | if (!strcmp(funcName, "vkCmdCopyImageToBuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3287 | return (PFN_vkVoidFunction) vkCmdCopyImageToBuffer; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3288 | if (!strcmp(funcName, "vkCmdUpdateBuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3289 | return (PFN_vkVoidFunction) vkCmdUpdateBuffer; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3290 | if (!strcmp(funcName, "vkCmdFillBuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3291 | return (PFN_vkVoidFunction) vkCmdFillBuffer; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3292 | if (!strcmp(funcName, "vkCmdClearColorImage")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3293 | return (PFN_vkVoidFunction) vkCmdClearColorImage; |
Chris Forbes | d9be82b | 2015-06-22 17:21:59 +1200 | [diff] [blame] | 3294 | if (!strcmp(funcName, "vkCmdClearDepthStencilImage")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3295 | return (PFN_vkVoidFunction) vkCmdClearDepthStencilImage; |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 3296 | if (!strcmp(funcName, "vkCmdClearColorAttachment")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3297 | return (PFN_vkVoidFunction) vkCmdClearColorAttachment; |
Tobin Ehlis | 53eddda | 2015-07-01 16:46:13 -0600 | [diff] [blame] | 3298 | if (!strcmp(funcName, "vkCmdClearDepthStencilAttachment")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3299 | return (PFN_vkVoidFunction) vkCmdClearDepthStencilAttachment; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3300 | if (!strcmp(funcName, "vkCmdResolveImage")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3301 | return (PFN_vkVoidFunction) vkCmdResolveImage; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3302 | if (!strcmp(funcName, "vkCmdSetEvent")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3303 | return (PFN_vkVoidFunction) vkCmdSetEvent; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3304 | if (!strcmp(funcName, "vkCmdResetEvent")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3305 | return (PFN_vkVoidFunction) vkCmdResetEvent; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3306 | if (!strcmp(funcName, "vkCmdWaitEvents")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3307 | return (PFN_vkVoidFunction) vkCmdWaitEvents; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3308 | if (!strcmp(funcName, "vkCmdPipelineBarrier")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3309 | return (PFN_vkVoidFunction) vkCmdPipelineBarrier; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3310 | if (!strcmp(funcName, "vkCmdBeginQuery")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3311 | return (PFN_vkVoidFunction) vkCmdBeginQuery; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3312 | if (!strcmp(funcName, "vkCmdEndQuery")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3313 | return (PFN_vkVoidFunction) vkCmdEndQuery; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3314 | if (!strcmp(funcName, "vkCmdResetQueryPool")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3315 | return (PFN_vkVoidFunction) vkCmdResetQueryPool; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3316 | if (!strcmp(funcName, "vkCmdWriteTimestamp")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3317 | return (PFN_vkVoidFunction) vkCmdWriteTimestamp; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3318 | if (!strcmp(funcName, "vkCreateFramebuffer")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3319 | return (PFN_vkVoidFunction) vkCreateFramebuffer; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3320 | if (!strcmp(funcName, "vkCreateRenderPass")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3321 | return (PFN_vkVoidFunction) vkCreateRenderPass; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3322 | if (!strcmp(funcName, "vkCmdBeginRenderPass")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3323 | return (PFN_vkVoidFunction) vkCmdBeginRenderPass; |
Chia-I Wu | 08accc6 | 2015-07-07 11:50:03 +0800 | [diff] [blame] | 3324 | if (!strcmp(funcName, "vkCmdNextSubpass")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3325 | return (PFN_vkVoidFunction) vkCmdNextSubpass; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3326 | if (!strcmp(funcName, "vkCmdEndRenderPass")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3327 | return (PFN_vkVoidFunction) vkCmdEndRenderPass; |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 3328 | |
Jon Ashburn | 747f2b6 | 2015-06-18 15:02:58 -0600 | [diff] [blame] | 3329 | VkLayerDispatchTable* pTable = get_dispatch_table(draw_state_device_table_map, dev); |
| 3330 | if (deviceExtMap.size() == 0 || deviceExtMap[pTable].debug_marker_enabled) |
Jon Ashburn | 8fd0825 | 2015-05-28 16:25:02 -0600 | [diff] [blame] | 3331 | { |
Jon Ashburn | 747f2b6 | 2015-06-18 15:02:58 -0600 | [diff] [blame] | 3332 | if (!strcmp(funcName, "vkCmdDbgMarkerBegin")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3333 | return (PFN_vkVoidFunction) vkCmdDbgMarkerBegin; |
Jon Ashburn | 747f2b6 | 2015-06-18 15:02:58 -0600 | [diff] [blame] | 3334 | if (!strcmp(funcName, "vkCmdDbgMarkerEnd")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3335 | return (PFN_vkVoidFunction) vkCmdDbgMarkerEnd; |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 3336 | // if (!strcmp(funcName, "vkDbgSetObjectTag")) |
| 3337 | // return (void*) vkDbgSetObjectTag; |
| 3338 | // if (!strcmp(funcName, "vkDbgSetObjectName")) |
| 3339 | // return (void*) vkDbgSetObjectName; |
Jon Ashburn | eab3449 | 2015-06-01 09:37:38 -0600 | [diff] [blame] | 3340 | } |
| 3341 | { |
Jon Ashburn | 8fd0825 | 2015-05-28 16:25:02 -0600 | [diff] [blame] | 3342 | if (pTable->GetDeviceProcAddr == NULL) |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3343 | return NULL; |
Jon Ashburn | 8fd0825 | 2015-05-28 16:25:02 -0600 | [diff] [blame] | 3344 | return pTable->GetDeviceProcAddr(dev, funcName); |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 3345 | } |
| 3346 | } |
| 3347 | |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3348 | VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetInstanceProcAddr(VkInstance instance, const char* funcName) |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 3349 | { |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3350 | PFN_vkVoidFunction fptr; |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 3351 | if (instance == NULL) |
| 3352 | return NULL; |
| 3353 | |
Jon Ashburn | 8fd0825 | 2015-05-28 16:25:02 -0600 | [diff] [blame] | 3354 | /* loader uses this to force layer initialization; instance object is wrapped */ |
| 3355 | if (!strcmp(funcName, "vkGetInstanceProcAddr")) { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 3356 | initInstanceTable(draw_state_instance_table_map, (const VkBaseLayerObject *) instance); |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3357 | return (PFN_vkVoidFunction) vkGetInstanceProcAddr; |
Jon Ashburn | 8fd0825 | 2015-05-28 16:25:02 -0600 | [diff] [blame] | 3358 | } |
Courtney Goeltzenleuchter | abc035e | 2015-06-01 14:29:58 -0600 | [diff] [blame] | 3359 | if (!strcmp(funcName, "vkCreateInstance")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3360 | return (PFN_vkVoidFunction) vkCreateInstance; |
Jon Ashburn | 3950e1b | 2015-05-20 09:00:28 -0600 | [diff] [blame] | 3361 | if (!strcmp(funcName, "vkDestroyInstance")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3362 | return (PFN_vkVoidFunction) vkDestroyInstance; |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 3363 | if (!strcmp(funcName, "vkGetGlobalLayerProperties")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3364 | return (PFN_vkVoidFunction) vkGetGlobalLayerProperties; |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 3365 | if (!strcmp(funcName, "vkGetGlobalExtensionProperties")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3366 | return (PFN_vkVoidFunction) vkGetGlobalExtensionProperties; |
Courtney Goeltzenleuchter | 7ad58c0 | 2015-07-06 22:31:52 -0600 | [diff] [blame] | 3367 | if (!strcmp(funcName, "vkGetPhysicalDeviceLayerProperties")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3368 | return (PFN_vkVoidFunction) vkGetPhysicalDeviceLayerProperties; |
Tony Barbour | 59a4732 | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 3369 | if (!strcmp(funcName, "vkGetPhysicalDeviceExtensionProperties")) |
Courtney Goeltzenleuchter | 2d3ba63 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 3370 | return (PFN_vkVoidFunction) vkGetPhysicalDeviceExtensionProperties; |
Courtney Goeltzenleuchter | ee56287 | 2015-06-01 14:33:14 -0600 | [diff] [blame] | 3371 | |
Tobin Ehlis | a16e892 | 2015-06-16 15:50:44 -0600 | [diff] [blame] | 3372 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 3373 | fptr = debug_report_get_instance_proc_addr(my_data->report_data, funcName); |
Courtney Goeltzenleuchter | ee56287 | 2015-06-01 14:33:14 -0600 | [diff] [blame] | 3374 | if (fptr) |
| 3375 | return fptr; |
| 3376 | |
Jon Ashburn | 8fd0825 | 2015-05-28 16:25:02 -0600 | [diff] [blame] | 3377 | { |
Courtney Goeltzenleuchter | 3d0dfad | 2015-06-13 21:23:09 -0600 | [diff] [blame] | 3378 | VkLayerInstanceDispatchTable* pTable = get_dispatch_table(draw_state_instance_table_map, instance); |
Jon Ashburn | 8fd0825 | 2015-05-28 16:25:02 -0600 | [diff] [blame] | 3379 | if (pTable->GetInstanceProcAddr == NULL) |
Jon Ashburn | f6b33db | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 3380 | return NULL; |
Jon Ashburn | 8fd0825 | 2015-05-28 16:25:02 -0600 | [diff] [blame] | 3381 | return pTable->GetInstanceProcAddr(instance, funcName); |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3382 | } |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 3383 | } |