aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2015-12-11 11:56:07 -0700
committerMark Lobodzinski <mark@lunarg.com>2015-12-11 12:01:16 -0700
commit8aa380a7e3482917ad3d2823f716ae079ef0231e (patch)
tree486459ab40e7e960d08c4186358de2bf5a9eed24
parent5790ff41388a31bbb6a2e4b8d8c2fb9942726ab8 (diff)
downloadusermoji-8aa380a7e3482917ad3d2823f716ae079ef0231e.tar.xz
layers: LX232, Add contstructor for DrawState struct
PIPELINE_NODE was getting treated as POD with memcpy/memsets.
-rw-r--r--layers/draw_state.cpp6
-rwxr-xr-xlayers/draw_state.h33
2 files changed, 35 insertions, 4 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 590f4bb0..f037d2ff 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -1371,11 +1371,11 @@ static VkBool32 verifyPipelineCreateState(layer_data* my_data, const VkDevice de
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 33d4828e..d2df8df2 100755
--- a/layers/draw_state.h
+++ b/layers/draw_state.h
@@ -155,6 +155,32 @@ typedef struct _PIPELINE_NODE {
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 @@ typedef struct _LAYOUT_NODE {
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