Tobin Ehlis | 246ba4d | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1 | /* |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2 | * Vulkan |
Tobin Ehlis | 246ba4d | 2014-11-18 16:38:08 -0700 | [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 | */ |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 24 | #include "vkLayer.h" |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 25 | #include <vector> |
| 26 | |
| 27 | using namespace std; |
| 28 | |
Tobin Ehlis | 246ba4d | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 29 | // Draw State ERROR codes |
| 30 | typedef enum _DRAW_STATE_ERROR |
| 31 | { |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 32 | DRAWSTATE_NONE, // Used for INFO & other non-error messages |
Tobin Ehlis | 04178d7 | 2015-01-22 10:45:21 -0700 | [diff] [blame] | 33 | DRAWSTATE_INTERNAL_ERROR, // Error with DrawState internal data structures |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 34 | DRAWSTATE_NO_PIPELINE_BOUND, // Unable to identify a bound pipeline |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 35 | DRAWSTATE_INVALID_POOL, // Invalid DS pool |
Tobin Ehlis | a3a693e | 2015-02-10 15:35:23 -0700 | [diff] [blame] | 36 | DRAWSTATE_INVALID_SET, // Invalid DS |
Tobin Ehlis | 04178d7 | 2015-01-22 10:45:21 -0700 | [diff] [blame] | 37 | DRAWSTATE_INVALID_LAYOUT, // Invalid DS layout |
Tobin Ehlis | a3a693e | 2015-02-10 15:35:23 -0700 | [diff] [blame] | 38 | DRAWSTATE_INVALID_PIPELINE, // Invalid Pipeline referenced |
Tobin Ehlis | d01f7d6 | 2015-02-13 10:26:14 -0700 | [diff] [blame] | 39 | DRAWSTATE_INVALID_CMD_BUFFER, // Invalid CmdBuffer referenced |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 40 | DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, // binding in vkCmdBindVertexData() too large for PSO's pVertexBindingDescriptions array |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 41 | DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, // Invalid dyn state object |
| 42 | DRAWSTATE_MISSING_DOT_PROGRAM, // No "dot" program in order to generate png image |
Tobin Ehlis | 04178d7 | 2015-01-22 10:45:21 -0700 | [diff] [blame] | 43 | DRAWSTATE_OUT_OF_MEMORY, // malloc failed |
| 44 | DRAWSTATE_DESCRIPTOR_TYPE_MISMATCH, // Type in layout vs. update are not the same |
Tobin Ehlis | a3a693e | 2015-02-10 15:35:23 -0700 | [diff] [blame] | 45 | DRAWSTATE_DESCRIPTOR_UPDATE_OUT_OF_BOUNDS, // Descriptors set for update out of bounds for corresponding layout section |
Tobin Ehlis | 297b985 | 2015-02-23 16:09:58 -0700 | [diff] [blame] | 46 | DRAWSTATE_INVALID_UPDATE_INDEX, // Index of requested update is invalid for specified descriptors set |
Tobin Ehlis | eba312c | 2015-04-01 08:40:34 -0600 | [diff] [blame] | 47 | DRAWSTATE_INVALID_UPDATE_STRUCT, // Struct in DS Update tree is of invalid type |
Tobin Ehlis | a9f3d76 | 2015-05-22 12:38:16 -0600 | [diff] [blame] | 48 | DRAWSTATE_NUM_SAMPLES_MISMATCH, // Number of samples in bound PSO does not match number in FB of current RenderPass |
| 49 | DRAWSTATE_NO_END_CMD_BUFFER, // Must call vkEndCommandBuffer() before QueueSubmit on that cmdBuffer |
Tobin Ehlis | e382c5a | 2015-06-10 12:57:07 -0600 | [diff] [blame] | 50 | DRAWSTATE_VIEWPORT_NOT_BOUND, // Draw submitted with no viewport state object bound |
| 51 | DRAWSTATE_RASTER_NOT_BOUND, // Draw submitted with no raster state object bound |
| 52 | DRAWSTATE_COLOR_BLEND_NOT_BOUND, // Draw submitted with no color blend state object bound when color write enabled |
| 53 | DRAWSTATE_DEPTH_STENCIL_NOT_BOUND, // Draw submitted with no depth-stencil state object bound when depth write enabled |
Jon Ashburn | e68a9ff | 2015-05-25 14:11:37 -0600 | [diff] [blame] | 54 | DRAWSTATE_INVALID_EXTENSION |
Tobin Ehlis | 246ba4d | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 55 | } DRAW_STATE_ERROR; |
Tobin Ehlis | 5742e77 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 56 | |
| 57 | typedef enum _DRAW_TYPE |
| 58 | { |
| 59 | DRAW = 0, |
| 60 | DRAW_INDEXED = 1, |
| 61 | DRAW_INDIRECT = 2, |
| 62 | DRAW_INDEXED_INDIRECT = 3, |
| 63 | DRAW_BEGIN_RANGE = DRAW, |
| 64 | DRAW_END_RANGE = DRAW_INDEXED_INDIRECT, |
| 65 | NUM_DRAW_TYPES = (DRAW_END_RANGE - DRAW_BEGIN_RANGE + 1), |
| 66 | } DRAW_TYPE; |
Tobin Ehlis | 8356288 | 2014-11-27 15:43:39 -0700 | [diff] [blame] | 67 | |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 68 | typedef struct _SHADER_DS_MAPPING { |
| 69 | uint32_t slotCount; |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 70 | VkDescriptorSetLayoutCreateInfo* pShaderMappingSlot; |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 71 | } SHADER_DS_MAPPING; |
| 72 | |
Tobin Ehlis | 04178d7 | 2015-01-22 10:45:21 -0700 | [diff] [blame] | 73 | typedef struct _GENERIC_HEADER { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 74 | VkStructureType sType; |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 75 | const void* pNext; |
Tobin Ehlis | 04178d7 | 2015-01-22 10:45:21 -0700 | [diff] [blame] | 76 | } GENERIC_HEADER; |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 77 | |
| 78 | typedef struct _PIPELINE_NODE { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 79 | VkPipeline pipeline; |
Tobin Ehlis | f313c8b | 2015-04-01 11:59:08 -0600 | [diff] [blame] | 80 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 81 | VkGraphicsPipelineCreateInfo graphicsPipelineCI; |
| 82 | VkPipelineVertexInputCreateInfo vertexInputCI; |
| 83 | VkPipelineIaStateCreateInfo iaStateCI; |
| 84 | VkPipelineTessStateCreateInfo tessStateCI; |
| 85 | VkPipelineVpStateCreateInfo vpStateCI; |
| 86 | VkPipelineRsStateCreateInfo rsStateCI; |
| 87 | VkPipelineMsStateCreateInfo msStateCI; |
| 88 | VkPipelineCbStateCreateInfo cbStateCI; |
| 89 | VkPipelineDsStateCreateInfo dsStateCI; |
| 90 | VkPipelineShaderStageCreateInfo vsCI; |
| 91 | VkPipelineShaderStageCreateInfo tcsCI; |
| 92 | VkPipelineShaderStageCreateInfo tesCI; |
| 93 | VkPipelineShaderStageCreateInfo gsCI; |
| 94 | VkPipelineShaderStageCreateInfo fsCI; |
| 95 | // Compute shader is include in VkComputePipelineCreateInfo |
| 96 | VkComputePipelineCreateInfo computePipelineCI; |
Tobin Ehlis | f313c8b | 2015-04-01 11:59:08 -0600 | [diff] [blame] | 97 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 98 | VkGraphicsPipelineCreateInfo* pCreateTree; // Ptr to shadow of data in create tree |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 99 | // Vtx input info (if any) |
| 100 | uint32_t vtxBindingCount; // number of bindings |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 101 | VkVertexInputBindingDescription* pVertexBindingDescriptions; |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 102 | uint32_t vtxAttributeCount; // number of attributes |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 103 | VkVertexInputAttributeDescription* pVertexAttributeDescriptions; |
Tobin Ehlis | a3a693e | 2015-02-10 15:35:23 -0700 | [diff] [blame] | 104 | uint32_t attachmentCount; // number of CB attachments |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 105 | VkPipelineCbAttachmentState* pAttachments; |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 106 | } PIPELINE_NODE; |
| 107 | |
| 108 | typedef struct _SAMPLER_NODE { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 109 | VkSampler sampler; |
| 110 | VkSamplerCreateInfo createInfo; |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 111 | } SAMPLER_NODE; |
| 112 | |
Tobin Ehlis | 04178d7 | 2015-01-22 10:45:21 -0700 | [diff] [blame] | 113 | typedef struct _IMAGE_NODE { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 114 | VkImageView image; |
| 115 | VkImageViewCreateInfo createInfo; |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 116 | VkDescriptorInfo descriptorInfo; |
Tobin Ehlis | 04178d7 | 2015-01-22 10:45:21 -0700 | [diff] [blame] | 117 | } IMAGE_NODE; |
| 118 | |
| 119 | typedef struct _BUFFER_NODE { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 120 | VkBufferView buffer; |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 121 | VkBufferViewCreateInfo createInfo; |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 122 | VkDescriptorInfo descriptorInfo; |
Tobin Ehlis | 04178d7 | 2015-01-22 10:45:21 -0700 | [diff] [blame] | 123 | } BUFFER_NODE; |
| 124 | |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 125 | typedef struct _DYNAMIC_STATE_NODE { |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 126 | VkObjectType objType; |
| 127 | VkDynamicStateObject stateObj; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 128 | GENERIC_HEADER* pCreateInfo; |
| 129 | union { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 130 | VkDynamicVpStateCreateInfo vpci; |
| 131 | VkDynamicRsStateCreateInfo rsci; |
| 132 | VkDynamicCbStateCreateInfo cbci; |
| 133 | VkDynamicDsStateCreateInfo dsci; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 134 | } create_info; |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 135 | } DYNAMIC_STATE_NODE; |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 136 | // Descriptor Data structures |
Tobin Ehlis | 04178d7 | 2015-01-22 10:45:21 -0700 | [diff] [blame] | 137 | // Layout Node has the core layout data |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 138 | typedef struct _LAYOUT_NODE { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 139 | VkDescriptorSetLayout layout; |
| 140 | VkDescriptorType* pTypes; // Dynamic array that will be created to verify descriptor types |
| 141 | VkDescriptorSetLayoutCreateInfo createInfo; |
Tobin Ehlis | a3a693e | 2015-02-10 15:35:23 -0700 | [diff] [blame] | 142 | uint32_t startIndex; // 1st index of this layout |
| 143 | uint32_t endIndex; // last index of this layout |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 144 | } LAYOUT_NODE; |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 145 | typedef struct _SET_NODE { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 146 | VkDescriptorSet set; |
| 147 | VkDescriptorPool pool; |
| 148 | VkDescriptorSetUsage setUsage; |
Tobin Ehlis | 481ec71 | 2015-02-19 09:55:18 -0700 | [diff] [blame] | 149 | // Head of LL of all Update structs for this set |
Tobin Ehlis | 04178d7 | 2015-01-22 10:45:21 -0700 | [diff] [blame] | 150 | GENERIC_HEADER* pUpdateStructs; |
| 151 | // Total num of descriptors in this set (count of its layout plus all prior layouts) |
| 152 | uint32_t descriptorCount; |
Tobin Ehlis | 481ec71 | 2015-02-19 09:55:18 -0700 | [diff] [blame] | 153 | GENERIC_HEADER** ppDescriptors; // Array where each index points to update node for its slot |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 154 | LAYOUT_NODE* pLayout; // Layout for this set |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 155 | struct _SET_NODE* pNext; |
| 156 | } SET_NODE; |
| 157 | |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 158 | typedef struct _POOL_NODE { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 159 | VkDescriptorPool pool; |
| 160 | VkDescriptorPoolUsage poolUsage; |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 161 | uint32_t maxSets; |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 162 | VkDescriptorPoolCreateInfo createInfo; |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 163 | SET_NODE* pSets; // Head of LL of sets for this Pool |
| 164 | } POOL_NODE; |
Tobin Ehlis | 7265e83 | 2015-01-19 08:42:29 -0700 | [diff] [blame] | 165 | |
Tobin Ehlis | d01f7d6 | 2015-02-13 10:26:14 -0700 | [diff] [blame] | 166 | // Cmd Buffer Tracking |
| 167 | typedef enum _CMD_TYPE |
| 168 | { |
| 169 | CMD_BINDPIPELINE, |
| 170 | CMD_BINDPIPELINEDELTA, |
| 171 | CMD_BINDDYNAMICSTATEOBJECT, |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 172 | CMD_BINDDESCRIPTORSETS, |
Tobin Ehlis | d01f7d6 | 2015-02-13 10:26:14 -0700 | [diff] [blame] | 173 | CMD_BINDINDEXBUFFER, |
| 174 | CMD_BINDVERTEXBUFFER, |
| 175 | CMD_DRAW, |
| 176 | CMD_DRAWINDEXED, |
| 177 | CMD_DRAWINDIRECT, |
| 178 | CMD_DRAWINDEXEDINDIRECT, |
| 179 | CMD_DISPATCH, |
| 180 | CMD_DISPATCHINDIRECT, |
| 181 | CMD_COPYBUFFER, |
| 182 | CMD_COPYIMAGE, |
Tobin Ehlis | 793ad30 | 2015-04-03 12:01:11 -0600 | [diff] [blame] | 183 | CMD_BLITIMAGE, |
Tobin Ehlis | d01f7d6 | 2015-02-13 10:26:14 -0700 | [diff] [blame] | 184 | CMD_COPYBUFFERTOIMAGE, |
| 185 | CMD_COPYIMAGETOBUFFER, |
| 186 | CMD_CLONEIMAGEDATA, |
| 187 | CMD_UPDATEBUFFER, |
| 188 | CMD_FILLBUFFER, |
| 189 | CMD_CLEARCOLORIMAGE, |
| 190 | CMD_CLEARCOLORIMAGERAW, |
| 191 | CMD_CLEARDEPTHSTENCIL, |
| 192 | CMD_RESOLVEIMAGE, |
| 193 | CMD_SETEVENT, |
| 194 | CMD_RESETEVENT, |
| 195 | CMD_WAITEVENTS, |
| 196 | CMD_PIPELINEBARRIER, |
| 197 | CMD_BEGINQUERY, |
| 198 | CMD_ENDQUERY, |
| 199 | CMD_RESETQUERYPOOL, |
| 200 | CMD_WRITETIMESTAMP, |
| 201 | CMD_INITATOMICCOUNTERS, |
| 202 | CMD_LOADATOMICCOUNTERS, |
| 203 | CMD_SAVEATOMICCOUNTERS, |
| 204 | CMD_BEGINRENDERPASS, |
Tobin Ehlis | 6744942 | 2015-03-02 10:16:40 -0700 | [diff] [blame] | 205 | CMD_ENDRENDERPASS, |
| 206 | CMD_DBGMARKERBEGIN, |
| 207 | CMD_DBGMARKEREND, |
Tobin Ehlis | d01f7d6 | 2015-02-13 10:26:14 -0700 | [diff] [blame] | 208 | } CMD_TYPE; |
| 209 | // Data structure for holding sequence of cmds in cmd buffer |
| 210 | typedef struct _CMD_NODE { |
Tobin Ehlis | d01f7d6 | 2015-02-13 10:26:14 -0700 | [diff] [blame] | 211 | CMD_TYPE type; |
| 212 | uint64_t cmdNumber; |
| 213 | } CMD_NODE; |
| 214 | |
| 215 | typedef enum _CB_STATE |
| 216 | { |
| 217 | CB_NEW, // Newly created CB w/o any cmds |
| 218 | CB_UPDATE_ACTIVE, // BeginCB has been called on this CB |
| 219 | CB_UPDATE_COMPLETE // EndCB has been called on this CB |
| 220 | } CB_STATE; |
Tobin Ehlis | e382c5a | 2015-06-10 12:57:07 -0600 | [diff] [blame] | 221 | // CB Status -- used to track status of various bindings on cmd buffer objects |
| 222 | typedef VkFlags CBStatusFlags; |
| 223 | typedef enum _CBStatusFlagBits |
| 224 | { |
| 225 | CBSTATUS_NONE = 0x00000000, // No status is set |
| 226 | CBSTATUS_VIEWPORT_BOUND = 0x00000001, // Viewport state object has been bound |
| 227 | CBSTATUS_RASTER_BOUND = 0x00000002, // Raster state object has been bound |
| 228 | CBSTATUS_COLOR_BLEND_WRITE_ENABLE = 0x00000004, // PSO w/ CB Enable set has been bound |
| 229 | CBSTATUS_COLOR_BLEND_BOUND = 0x00000008, // CB state object has been bound |
| 230 | CBSTATUS_DEPTH_STENCIL_WRITE_ENABLE = 0x00000010, // PSO w/ DS Enable set has been bound |
| 231 | CBSTATUS_DEPTH_STENCIL_BOUND = 0x00000020, // DS state object has been bound |
| 232 | } CBStatusFlagBits; |
Tobin Ehlis | 10ae8c1 | 2015-03-17 16:24:32 -0600 | [diff] [blame] | 233 | // Cmd Buffer Wrapper Struct |
Tobin Ehlis | d01f7d6 | 2015-02-13 10:26:14 -0700 | [diff] [blame] | 234 | typedef struct _GLOBAL_CB_NODE { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 235 | VkCmdBuffer cmdBuffer; |
Tobin Ehlis | a9f3d76 | 2015-05-22 12:38:16 -0600 | [diff] [blame] | 236 | uint32_t queueNodeIndex; |
| 237 | VkFlags flags; |
| 238 | VkFence fence; // fence tracking this cmd buffer |
| 239 | uint64_t numCmds; // number of cmds in this CB |
| 240 | uint64_t drawCount[NUM_DRAW_TYPES]; // Count of each type of draw in this CB |
Tobin Ehlis | e382c5a | 2015-06-10 12:57:07 -0600 | [diff] [blame] | 241 | CB_STATE state; // Track cmd buffer update state |
| 242 | CBStatusFlags status; // Track status of various bindings on cmd buffer |
Tobin Ehlis | a9f3d76 | 2015-05-22 12:38:16 -0600 | [diff] [blame] | 243 | vector<CMD_NODE*> pCmds; |
Tobin Ehlis | d01f7d6 | 2015-02-13 10:26:14 -0700 | [diff] [blame] | 244 | // Currently storing "lastBound" objects on per-CB basis |
| 245 | // long-term may want to create caches of "lastBound" states and could have |
| 246 | // each individual CMD_NODE referencing its own "lastBound" state |
Tobin Ehlis | a9f3d76 | 2015-05-22 12:38:16 -0600 | [diff] [blame] | 247 | VkPipeline lastBoundPipeline; |
| 248 | uint32_t lastVtxBinding; |
| 249 | DYNAMIC_STATE_NODE* lastBoundDynamicState[VK_NUM_STATE_BIND_POINT]; |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 250 | VkDescriptorSet lastBoundDescriptorSet; |
| 251 | VkRenderPass activeRenderPass; |
Tobin Ehlis | a9f3d76 | 2015-05-22 12:38:16 -0600 | [diff] [blame] | 252 | VkFramebuffer framebuffer; |
| 253 | vector<VkDescriptorSet> boundDescriptorSets; |
Tobin Ehlis | d01f7d6 | 2015-02-13 10:26:14 -0700 | [diff] [blame] | 254 | } GLOBAL_CB_NODE; |
| 255 | |
Tobin Ehlis | 8356288 | 2014-11-27 15:43:39 -0700 | [diff] [blame] | 256 | //prototypes for extension functions |
Mark Lobodzinski | 17caf57 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 257 | void drawStateDumpDotFile(char* outFileName); |
| 258 | void drawStateDumpPngFile(char* outFileName); |
Jeremy Hayes | 2c98e53 | 2015-02-26 15:59:19 -0700 | [diff] [blame] | 259 | void drawStateDumpCommandBufferDotFile(char* outFileName); |
Tobin Ehlis | f27eba7 | 2014-12-16 17:34:50 -0700 | [diff] [blame] | 260 | // Func ptr typedefs |
Mark Lobodzinski | 17caf57 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 261 | typedef void (*DRAW_STATE_DUMP_DOT_FILE)(char*); |
| 262 | typedef void (*DRAW_STATE_DUMP_PNG_FILE)(char*); |
Jeremy Hayes | 2c98e53 | 2015-02-26 15:59:19 -0700 | [diff] [blame] | 263 | typedef void (*DRAW_STATE_DUMP_COMMAND_BUFFER_DOT_FILE)(char*); |