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