blob: 86c84a00a426ca913af27268eb26438ee4bd05d2 [file] [log] [blame]
Tobin Ehlise79df942014-11-18 16:38:08 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan
Tobin Ehlise79df942014-11-18 16:38:08 -07003 *
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 */
Tobin Ehlis2d1d9702015-07-03 09:42:57 -060024#include "vk_layer.h"
Tobin Ehlis63bb9482015-03-17 16:24:32 -060025#include <vector>
Tobin Ehlisd04ccab2015-10-07 15:40:22 -060026#include <memory>
Courtney Goeltzenleuchterd4d26dd2015-09-23 12:30:48 -060027#include "vk_debug_report_lunarg.h"
Tobin Ehlis63bb9482015-03-17 16:24:32 -060028
29using namespace std;
30
Tobin Ehlise79df942014-11-18 16:38:08 -070031// Draw State ERROR codes
32typedef enum _DRAW_STATE_ERROR
33{
Tobin Ehlis84c521c2015-01-19 08:42:29 -070034 DRAWSTATE_NONE, // Used for INFO & other non-error messages
Tobin Ehlis41415bb2015-01-22 10:45:21 -070035 DRAWSTATE_INTERNAL_ERROR, // Error with DrawState internal data structures
Tobin Ehlis84c521c2015-01-19 08:42:29 -070036 DRAWSTATE_NO_PIPELINE_BOUND, // Unable to identify a bound pipeline
Tobin Ehlisdd82f6b2015-04-03 12:01:11 -060037 DRAWSTATE_INVALID_POOL, // Invalid DS pool
Tobin Ehlis83ebbef2015-02-10 15:35:23 -070038 DRAWSTATE_INVALID_SET, // Invalid DS
Tobin Ehlis41415bb2015-01-22 10:45:21 -070039 DRAWSTATE_INVALID_LAYOUT, // Invalid DS layout
Tobin Ehlisde63c532015-06-18 15:59:33 -060040 DRAWSTATE_INVALID_PIPELINE, // Invalid Pipeline handle referenced
41 DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, // Attempt to create a pipeline with invalid state
Tobin Ehlis8cced212015-02-13 10:26:14 -070042 DRAWSTATE_INVALID_CMD_BUFFER, // Invalid CmdBuffer referenced
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060043 DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, // binding in vkCmdBindVertexData() too large for PSO's pVertexBindingDescriptions array
Tobin Ehlis8d199e52015-09-17 12:24:13 -060044 DRAWSTATE_VTX_INDEX_ALIGNMENT_ERROR, // binding offset in vkCmdBindIndexBuffer() out of alignment based on indexType
Tobin Ehlis236717c2015-08-31 12:42:38 -060045 //DRAWSTATE_MISSING_DOT_PROGRAM, // No "dot" program in order to generate png image
Tobin Ehlis41415bb2015-01-22 10:45:21 -070046 DRAWSTATE_OUT_OF_MEMORY, // malloc failed
47 DRAWSTATE_DESCRIPTOR_TYPE_MISMATCH, // Type in layout vs. update are not the same
Tobin Ehlis83ebbef2015-02-10 15:35:23 -070048 DRAWSTATE_DESCRIPTOR_UPDATE_OUT_OF_BOUNDS, // Descriptors set for update out of bounds for corresponding layout section
Tobin Ehlis3c543112015-10-08 13:13:50 -060049 DRAWSTATE_CANT_FREE_FROM_ONE_SHOT_POOL, // Invalid to call vkFreeDescriptorSets on Sets allocated from a ONE_SHOT Pool
Tobin Ehlis8733adc2015-02-23 16:09:58 -070050 DRAWSTATE_INVALID_UPDATE_INDEX, // Index of requested update is invalid for specified descriptors set
Tobin Ehlis2464b882015-04-01 08:40:34 -060051 DRAWSTATE_INVALID_UPDATE_STRUCT, // Struct in DS Update tree is of invalid type
Tobin Ehlis28be0be2015-05-22 12:38:16 -060052 DRAWSTATE_NUM_SAMPLES_MISMATCH, // Number of samples in bound PSO does not match number in FB of current RenderPass
53 DRAWSTATE_NO_END_CMD_BUFFER, // Must call vkEndCommandBuffer() before QueueSubmit on that cmdBuffer
Tobin Ehlise42007c2015-06-19 13:00:59 -060054 DRAWSTATE_NO_BEGIN_CMD_BUFFER, // Binding cmds or calling End on CB that never had vkBeginCommandBuffer() called on it
Tobin Ehlis0cea4082015-08-18 07:10:58 -060055 DRAWSTATE_CMD_BUFFER_SINGLE_SUBMIT_VIOLATION, // Cmd Buffer created with VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT flag is submitted multiple times
Tobin Ehlis5f728d32015-09-17 14:18:16 -060056 DRAWSTATE_INVALID_SECONDARY_CMD_BUFFER, // vkCmdExecuteCommands() called with a primary cmdBuffer in pCmdBuffers array
Tobin Ehlisf6cb4672015-09-29 08:18:34 -060057 DRAWSTATE_VIEWPORT_NOT_BOUND, // Draw submitted with no viewport state bound
58 DRAWSTATE_SCISSOR_NOT_BOUND, // Draw submitted with no scissor state bound
59 DRAWSTATE_LINE_WIDTH_NOT_BOUND, // Draw submitted with no line width state bound
60 DRAWSTATE_DEPTH_BIAS_NOT_BOUND, // Draw submitted with no depth bias state bound
61 DRAWSTATE_BLEND_NOT_BOUND, // Draw submitted with no blend state bound when color write enabled
62 DRAWSTATE_DEPTH_BOUNDS_NOT_BOUND, // Draw submitted with no depth bounds state bound when depth enabled
63 DRAWSTATE_STENCIL_NOT_BOUND, // Draw submitted with no stencil state bound when stencil enabled
64 DRAWSTATE_INDEX_BUFFER_NOT_BOUND, // Draw submitted with no depth-stencil state bound when depth write enabled
Tobin Ehlisc6c3d6d2015-06-22 17:20:50 -060065 DRAWSTATE_PIPELINE_LAYOUT_MISMATCH, // Draw submitted PSO Pipeline layout that doesn't match layout from BindDescriptorSets
Tobin Ehlis8b6c2352015-06-23 16:13:03 -060066 DRAWSTATE_INVALID_RENDERPASS, // Use of a NULL or otherwise invalid RenderPass object
Tobin Ehlis451efca2015-06-23 11:22:55 -060067 DRAWSTATE_INVALID_RENDERPASS_CMD, // Invalid cmd submitted while a RenderPass is active
68 DRAWSTATE_NO_ACTIVE_RENDERPASS, // Rendering cmd submitted without an active RenderPass
Tobin Ehlise4076782015-06-24 15:53:07 -060069 DRAWSTATE_DESCRIPTOR_SET_NOT_UPDATED, // DescriptorSet bound but it was never updated. This is a warning code.
Tobin Ehlis8cd650e2015-07-01 16:46:13 -060070 DRAWSTATE_CLEAR_CMD_BEFORE_DRAW, // Clear cmd issued before any Draw in CmdBuffer, should use RenderPass Ops instead
Mark Lobodzinski90bf5b02015-08-04 16:24:20 -060071 DRAWSTATE_BEGIN_CB_INVALID_STATE, // Primary/Secondary CB created with mismatched FB/RP information
Tobin Ehlis9e839e52015-10-01 11:15:13 -060072 DRAWSTATE_VIEWPORT_SCISSOR_MISMATCH, // Count for viewports and scissors mismatch and/or state doesn't match count
Mark Lobodzinskif14c8452015-10-16 13:32:24 -060073 DRAWSTATE_INVALID_IMAGE_ASPECT, // Image aspect is invalid for the current operation
Tobin Ehlisde63c532015-06-18 15:59:33 -060074 DRAWSTATE_INVALID_EXTENSION,
Tobin Ehlise79df942014-11-18 16:38:08 -070075} DRAW_STATE_ERROR;
Tobin Ehlis26092022014-11-20 09:49:17 -070076
77typedef enum _DRAW_TYPE
78{
79 DRAW = 0,
80 DRAW_INDEXED = 1,
81 DRAW_INDIRECT = 2,
82 DRAW_INDEXED_INDIRECT = 3,
83 DRAW_BEGIN_RANGE = DRAW,
84 DRAW_END_RANGE = DRAW_INDEXED_INDIRECT,
85 NUM_DRAW_TYPES = (DRAW_END_RANGE - DRAW_BEGIN_RANGE + 1),
86} DRAW_TYPE;
Tobin Ehlisa701ef02014-11-27 15:43:39 -070087
Tobin Ehlis84c521c2015-01-19 08:42:29 -070088typedef struct _SHADER_DS_MAPPING {
89 uint32_t slotCount;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060090 VkDescriptorSetLayoutCreateInfo* pShaderMappingSlot;
Tobin Ehlis84c521c2015-01-19 08:42:29 -070091} SHADER_DS_MAPPING;
92
Tobin Ehlis41415bb2015-01-22 10:45:21 -070093typedef struct _GENERIC_HEADER {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060094 VkStructureType sType;
Tobin Ehlis84c521c2015-01-19 08:42:29 -070095 const void* pNext;
Tobin Ehlis41415bb2015-01-22 10:45:21 -070096} GENERIC_HEADER;
Tobin Ehlis84c521c2015-01-19 08:42:29 -070097
98typedef struct _PIPELINE_NODE {
Tony Barboure307f582015-07-10 15:29:03 -060099 VkPipeline pipeline;
100 VkGraphicsPipelineCreateInfo graphicsPipelineCI;
101 VkPipelineVertexInputStateCreateInfo vertexInputCI;
102 VkPipelineInputAssemblyStateCreateInfo iaStateCI;
103 VkPipelineTessellationStateCreateInfo tessStateCI;
104 VkPipelineViewportStateCreateInfo vpStateCI;
105 VkPipelineRasterStateCreateInfo rsStateCI;
106 VkPipelineMultisampleStateCreateInfo msStateCI;
107 VkPipelineColorBlendStateCreateInfo cbStateCI;
108 VkPipelineDepthStencilStateCreateInfo dsStateCI;
Tobin Ehlisf6cb4672015-09-29 08:18:34 -0600109 VkPipelineDynamicStateCreateInfo dynStateCI;
Tony Barboure307f582015-07-10 15:29:03 -0600110 VkPipelineShaderStageCreateInfo vsCI;
111 VkPipelineShaderStageCreateInfo tcsCI;
112 VkPipelineShaderStageCreateInfo tesCI;
113 VkPipelineShaderStageCreateInfo gsCI;
114 VkPipelineShaderStageCreateInfo fsCI;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600115 // Compute shader is include in VkComputePipelineCreateInfo
Mark Lobodzinski0e0fb5c2015-06-23 15:11:57 -0600116 VkComputePipelineCreateInfo computePipelineCI;
Tobin Ehlis806a97a2015-06-18 11:02:59 -0600117 // Flag of which shader stages are active for this pipeline
Mark Lobodzinski0e0fb5c2015-06-23 15:11:57 -0600118 uint32_t active_shaders;
Tobin Ehlis84c521c2015-01-19 08:42:29 -0700119 // Vtx input info (if any)
Mark Lobodzinski0e0fb5c2015-06-23 15:11:57 -0600120 uint32_t vtxBindingCount; // number of bindings
121 VkVertexInputBindingDescription* pVertexBindingDescriptions;
122 uint32_t vtxAttributeCount; // number of attributes
123 VkVertexInputAttributeDescription* pVertexAttributeDescriptions;
124 uint32_t attachmentCount; // number of CB attachments
Tony Barboure307f582015-07-10 15:29:03 -0600125 VkPipelineColorBlendAttachmentState* pAttachments;
Tobin Ehlis84c521c2015-01-19 08:42:29 -0700126} PIPELINE_NODE;
127
128typedef struct _SAMPLER_NODE {
Tobin Ehlisa366ca22015-06-19 15:07:05 -0600129 VkSampler sampler;
130 VkSamplerCreateInfo createInfo;
Tobin Ehlisd04ccab2015-10-07 15:40:22 -0600131
132 _SAMPLER_NODE(const VkSampler* ps, const VkSamplerCreateInfo* pci) : sampler(*ps), createInfo(*pci) {};
Tobin Ehlis84c521c2015-01-19 08:42:29 -0700133} SAMPLER_NODE;
134
Tobin Ehlis41415bb2015-01-22 10:45:21 -0700135typedef struct _BUFFER_NODE {
Tobin Ehlisa366ca22015-06-19 15:07:05 -0600136 VkBufferView buffer;
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600137 VkBufferViewCreateInfo createInfo;
Tobin Ehlisd04ccab2015-10-07 15:40:22 -0600138
139 _BUFFER_NODE(const VkBufferView* pbv, const VkBufferViewCreateInfo* pci) : buffer(*pbv), createInfo(*pci) {};
Tobin Ehlis41415bb2015-01-22 10:45:21 -0700140} BUFFER_NODE;
141
Tobin Ehlis84c521c2015-01-19 08:42:29 -0700142// Descriptor Data structures
Tobin Ehlis41415bb2015-01-22 10:45:21 -0700143// Layout Node has the core layout data
Tobin Ehlis84c521c2015-01-19 08:42:29 -0700144typedef struct _LAYOUT_NODE {
Tobin Ehlisa366ca22015-06-19 15:07:05 -0600145 VkDescriptorSetLayout layout;
146 VkDescriptorType* pTypes; // Dynamic array that will be created to verify descriptor types
147 VkDescriptorSetLayoutCreateInfo createInfo;
148 uint32_t startIndex; // 1st index of this layout
149 uint32_t endIndex; // last index of this layout
Tobin Ehlis84c521c2015-01-19 08:42:29 -0700150} LAYOUT_NODE;
Tobin Ehlis84c521c2015-01-19 08:42:29 -0700151typedef struct _SET_NODE {
Tobin Ehlisa366ca22015-06-19 15:07:05 -0600152 VkDescriptorSet set;
153 VkDescriptorPool pool;
154 VkDescriptorSetUsage setUsage;
Tobin Ehlis82871a82015-02-19 09:55:18 -0700155 // Head of LL of all Update structs for this set
Tobin Ehlisa366ca22015-06-19 15:07:05 -0600156 GENERIC_HEADER* pUpdateStructs;
Tobin Ehlis41415bb2015-01-22 10:45:21 -0700157 // Total num of descriptors in this set (count of its layout plus all prior layouts)
Tobin Ehlisa366ca22015-06-19 15:07:05 -0600158 uint32_t descriptorCount;
159 GENERIC_HEADER** ppDescriptors; // Array where each index points to update node for its slot
160 LAYOUT_NODE* pLayout; // Layout for this set
161 struct _SET_NODE* pNext;
Tobin Ehlis84c521c2015-01-19 08:42:29 -0700162} SET_NODE;
163
Tobin Ehlisdd82f6b2015-04-03 12:01:11 -0600164typedef struct _POOL_NODE {
Tobin Ehlisa366ca22015-06-19 15:07:05 -0600165 VkDescriptorPool pool;
166 VkDescriptorPoolUsage poolUsage;
167 uint32_t maxSets;
168 VkDescriptorPoolCreateInfo createInfo;
169 SET_NODE* pSets; // Head of LL of sets for this Pool
Tobin Ehlisdd82f6b2015-04-03 12:01:11 -0600170} POOL_NODE;
Tobin Ehlis84c521c2015-01-19 08:42:29 -0700171
Tobin Ehlis8cced212015-02-13 10:26:14 -0700172// Cmd Buffer Tracking
173typedef enum _CMD_TYPE
174{
175 CMD_BINDPIPELINE,
176 CMD_BINDPIPELINEDELTA,
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -0600177 CMD_SETVIEWPORTSTATE,
Courtney Goeltzenleuchter932cdb52015-09-21 11:44:06 -0600178 CMD_SETSCISSORSTATE,
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -0600179 CMD_SETLINEWIDTHSTATE,
180 CMD_SETDEPTHBIASSTATE,
181 CMD_SETBLENDSTATE,
182 CMD_SETDEPTHBOUNDSSTATE,
183 CMD_SETSTENCILREADMASKSTATE,
184 CMD_SETSTENCILWRITEMASKSTATE,
185 CMD_SETSTENCILREFERENCESTATE,
Tobin Ehlisdd82f6b2015-04-03 12:01:11 -0600186 CMD_BINDDESCRIPTORSETS,
Tobin Ehlis8cced212015-02-13 10:26:14 -0700187 CMD_BINDINDEXBUFFER,
188 CMD_BINDVERTEXBUFFER,
189 CMD_DRAW,
190 CMD_DRAWINDEXED,
191 CMD_DRAWINDIRECT,
192 CMD_DRAWINDEXEDINDIRECT,
193 CMD_DISPATCH,
194 CMD_DISPATCHINDIRECT,
195 CMD_COPYBUFFER,
196 CMD_COPYIMAGE,
Tobin Ehlisdd82f6b2015-04-03 12:01:11 -0600197 CMD_BLITIMAGE,
Tobin Ehlis8cced212015-02-13 10:26:14 -0700198 CMD_COPYBUFFERTOIMAGE,
199 CMD_COPYIMAGETOBUFFER,
200 CMD_CLONEIMAGEDATA,
201 CMD_UPDATEBUFFER,
202 CMD_FILLBUFFER,
203 CMD_CLEARCOLORIMAGE,
Tobin Ehlis8cd650e2015-07-01 16:46:13 -0600204 CMD_CLEARCOLORATTACHMENT,
205 CMD_CLEARDEPTHSTENCILIMAGE,
206 CMD_CLEARDEPTHSTENCILATTACHMENT,
Tobin Ehlis8cced212015-02-13 10:26:14 -0700207 CMD_RESOLVEIMAGE,
208 CMD_SETEVENT,
209 CMD_RESETEVENT,
210 CMD_WAITEVENTS,
211 CMD_PIPELINEBARRIER,
212 CMD_BEGINQUERY,
213 CMD_ENDQUERY,
214 CMD_RESETQUERYPOOL,
Mark Lobodzinskia0f061c2015-09-30 16:19:16 -0600215 CMD_COPYQUERYPOOLRESULTS,
Tobin Ehlis8cced212015-02-13 10:26:14 -0700216 CMD_WRITETIMESTAMP,
217 CMD_INITATOMICCOUNTERS,
218 CMD_LOADATOMICCOUNTERS,
219 CMD_SAVEATOMICCOUNTERS,
220 CMD_BEGINRENDERPASS,
Chia-I Wuc278df82015-07-07 11:50:03 +0800221 CMD_NEXTSUBPASS,
Tobin Ehlis1dae99a2015-03-02 10:16:40 -0700222 CMD_ENDRENDERPASS,
Chia-I Wu88eaa3b2015-06-26 15:34:39 +0800223 CMD_EXECUTECOMMANDS,
Tobin Ehlis1dae99a2015-03-02 10:16:40 -0700224 CMD_DBGMARKERBEGIN,
225 CMD_DBGMARKEREND,
Tobin Ehlis8cced212015-02-13 10:26:14 -0700226} CMD_TYPE;
227// Data structure for holding sequence of cmds in cmd buffer
228typedef struct _CMD_NODE {
Tobin Ehlis8cced212015-02-13 10:26:14 -0700229 CMD_TYPE type;
230 uint64_t cmdNumber;
231} CMD_NODE;
232
233typedef enum _CB_STATE
234{
235 CB_NEW, // Newly created CB w/o any cmds
236 CB_UPDATE_ACTIVE, // BeginCB has been called on this CB
237 CB_UPDATE_COMPLETE // EndCB has been called on this CB
238} CB_STATE;
Tobin Ehlis97866202015-06-10 12:57:07 -0600239// CB Status -- used to track status of various bindings on cmd buffer objects
240typedef VkFlags CBStatusFlags;
241typedef enum _CBStatusFlagBits
242{
243 CBSTATUS_NONE = 0x00000000, // No status is set
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -0600244 CBSTATUS_VIEWPORT_SET = 0x00000001, // Viewport has been set
245 CBSTATUS_LINE_WIDTH_SET = 0x00000002, // Line width has been set
246 CBSTATUS_DEPTH_BIAS_SET = 0x00000004, // Depth bias has been set
247 CBSTATUS_COLOR_BLEND_WRITE_ENABLE = 0x00000008, // PSO w/ CB Enable set has been set
248 CBSTATUS_BLEND_SET = 0x00000010, // Blend state object has been set
249 CBSTATUS_DEPTH_WRITE_ENABLE = 0x00000020, // PSO w/ Depth Enable set has been set
250 CBSTATUS_STENCIL_TEST_ENABLE = 0x00000040, // PSO w/ Stencil Enable set has been set
251 CBSTATUS_DEPTH_BOUNDS_SET = 0x00000080, // Depth bounds state object has been set
252 CBSTATUS_STENCIL_READ_MASK_SET = 0x00000100, // Stencil read mask has been set
253 CBSTATUS_STENCIL_WRITE_MASK_SET = 0x00000200, // Stencil write mask has been set
254 CBSTATUS_STENCIL_REFERENCE_SET = 0x00000400, // Stencil reference has been set
255 CBSTATUS_INDEX_BUFFER_BOUND = 0x00000800, // Index buffer has been set
Courtney Goeltzenleuchter932cdb52015-09-21 11:44:06 -0600256 CBSTATUS_SCISSOR_SET = 0x00001000, // Scissor has been set
Tobin Ehlis3dec46c2015-10-01 09:24:40 -0600257 CBSTATUS_ALL = 0x00001FFF, // All dynamic state set
Tobin Ehlis97866202015-06-10 12:57:07 -0600258} CBStatusFlagBits;
Tobin Ehlis1dce5f12015-07-07 10:42:20 -0600259
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -0600260typedef struct stencil_data {
261 uint32_t stencilCompareMask;
262 uint32_t stencilWriteMask;
263 uint32_t stencilReference;
264} CBStencilData;
265
Tobin Ehlis63bb9482015-03-17 16:24:32 -0600266// Cmd Buffer Wrapper Struct
Tobin Ehlis8cced212015-02-13 10:26:14 -0700267typedef struct _GLOBAL_CB_NODE {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600268 VkCmdBuffer cmdBuffer;
Tobin Ehlis0cea4082015-08-18 07:10:58 -0600269 VkCmdBufferCreateInfo createInfo;
270 VkCmdBufferBeginInfo beginInfo;
Tobin Ehlis28be0be2015-05-22 12:38:16 -0600271 VkFence fence; // fence tracking this cmd buffer
272 uint64_t numCmds; // number of cmds in this CB
273 uint64_t drawCount[NUM_DRAW_TYPES]; // Count of each type of draw in this CB
Tobin Ehlis97866202015-06-10 12:57:07 -0600274 CB_STATE state; // Track cmd buffer update state
Tobin Ehlis0cea4082015-08-18 07:10:58 -0600275 uint64_t submitCount; // Number of times CB has been submitted
Tobin Ehlis97866202015-06-10 12:57:07 -0600276 CBStatusFlags status; // Track status of various bindings on cmd buffer
Tobin Ehlis28be0be2015-05-22 12:38:16 -0600277 vector<CMD_NODE*> pCmds;
Tobin Ehlis8cced212015-02-13 10:26:14 -0700278 // Currently storing "lastBound" objects on per-CB basis
279 // long-term may want to create caches of "lastBound" states and could have
280 // each individual CMD_NODE referencing its own "lastBound" state
Tobin Ehlis28be0be2015-05-22 12:38:16 -0600281 VkPipeline lastBoundPipeline;
282 uint32_t lastVtxBinding;
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -0600283 vector<VkViewport> viewports;
284 vector<VkRect2D> scissors;
285 float lineWidth;
286 float depthBias;
287 float depthBiasClamp;
288 float slopeScaledDepthBias;
289 float blendConst[4];
290 float minDepthBounds;
291 float maxDepthBounds;
292 CBStencilData front;
293 CBStencilData back;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600294 VkDescriptorSet lastBoundDescriptorSet;
Tobin Ehlisc6c3d6d2015-06-22 17:20:50 -0600295 VkPipelineLayout lastBoundPipelineLayout;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600296 VkRenderPass activeRenderPass;
Chia-I Wuc278df82015-07-07 11:50:03 +0800297 uint32_t activeSubpass;
Tobin Ehlis28be0be2015-05-22 12:38:16 -0600298 VkFramebuffer framebuffer;
Mark Lobodzinski90bf5b02015-08-04 16:24:20 -0600299 VkCmdBufferLevel level;
Tobin Ehlis28be0be2015-05-22 12:38:16 -0600300 vector<VkDescriptorSet> boundDescriptorSets;
Tobin Ehlis8cced212015-02-13 10:26:14 -0700301} GLOBAL_CB_NODE;