layers: LX232, Add contstructor for DrawState struct
PIPELINE_NODE was getting treated as POD with memcpy/memsets.
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 590f4bb..f037d2f 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -1371,11 +1371,11 @@
static PIPELINE_NODE* initGraphicsPipeline(layer_data* dev_data, const VkGraphicsPipelineCreateInfo* pCreateInfo, PIPELINE_NODE* pBasePipeline)
{
PIPELINE_NODE* pPipeline = new PIPELINE_NODE;
+
if (pBasePipeline) {
- memcpy((void*)pPipeline, (void*)pBasePipeline, sizeof(PIPELINE_NODE));
- } else {
- memset((void*)pPipeline, 0, sizeof(PIPELINE_NODE));
+ *pPipeline = *pBasePipeline;
}
+
// First init create info
memcpy(&pPipeline->graphicsPipelineCI, pCreateInfo, sizeof(VkGraphicsPipelineCreateInfo));
diff --git a/layers/draw_state.h b/layers/draw_state.h
index 33d4828..d2df8df 100755
--- a/layers/draw_state.h
+++ b/layers/draw_state.h
@@ -155,6 +155,32 @@
VkVertexInputAttributeDescription* pVertexAttributeDescriptions;
uint32_t attachmentCount; // number of CB attachments
VkPipelineColorBlendAttachmentState* pAttachments;
+ // Default constructor
+ _PIPELINE_NODE():pipeline{},
+ graphicsPipelineCI{},
+ vertexInputCI{},
+ iaStateCI{},
+ tessStateCI{},
+ vpStateCI{},
+ rsStateCI{},
+ msStateCI{},
+ cbStateCI{},
+ dsStateCI{},
+ dynStateCI{},
+ vsCI{},
+ tcsCI{},
+ tesCI{},
+ gsCI{},
+ fsCI{},
+ computePipelineCI{},
+ active_shaders(0),
+ vtxBindingCount(0),
+ pVertexBindingDescriptions(0),
+ vtxAttributeCount(0),
+ pVertexAttributeDescriptions(0),
+ attachmentCount(0),
+ pAttachments(0)
+ {};
} PIPELINE_NODE;
typedef struct _SAMPLER_NODE {
@@ -213,7 +239,12 @@
vector<VkShaderStageFlags> stageFlags; // stageFlags per descriptor in this layout to verify correct updates
unordered_set<uint32_t> bindings;
// Default constructor
- _LAYOUT_NODE():layout{},createInfo{},startIndex(0),endIndex(0),dynamicDescriptorCount(0) {};
+ _LAYOUT_NODE():layout{},
+ createInfo{},
+ startIndex(0),
+ endIndex(0),
+ dynamicDescriptorCount(0)
+ {};
} LAYOUT_NODE;
// Store layouts and pushconstants for PipelineLayout