diff options
author | Mark Lobodzinski <mark@lunarg.com> | 2016-03-23 14:34:52 -0600 |
---|---|---|
committer | Mark Lobodzinski <mark@lunarg.com> | 2016-03-23 14:53:22 -0600 |
commit | c7bd67f06427b08ba65cdf2dd529c8234beebdd5 (patch) | |
tree | 069374027bca3c12e9cccad06ca61d92edb350b0 | |
parent | 03b71511c9e94f2e6101a3214858cee3742ec277 (diff) | |
download | vulkan-validation-layers-c7bd67f06427b08ba65cdf2dd529c8234beebdd5.tar.gz |
layers: Fix AV in core_validaton
Caused crashes in DOTA2
Change-Id: I74d121641872597a63ea42e13ff860112fc7c314
-rw-r--r-- | layers/core_validation.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 56ba538da..e4946c40c 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -3034,20 +3034,22 @@ static VkBool32 verifyPipelineCreateState(layer_data *my_data, const VkDevice de if (pPipeline->graphicsPipelineCI.pColorBlendState != NULL) { if (!my_data->physDevProperties.features.independentBlend) { - VkPipelineColorBlendAttachmentState *pAttachments = pAttachments = &pPipeline->attachments[0]; - for (size_t i = 1; i < pPipeline->attachments.size(); i++) { - if ((pAttachments[0].blendEnable != pAttachments[i].blendEnable) || - (pAttachments[0].srcColorBlendFactor != pAttachments[i].srcColorBlendFactor) || - (pAttachments[0].dstColorBlendFactor != pAttachments[i].dstColorBlendFactor) || - (pAttachments[0].colorBlendOp != pAttachments[i].colorBlendOp) || - (pAttachments[0].srcAlphaBlendFactor != pAttachments[i].srcAlphaBlendFactor) || - (pAttachments[0].dstAlphaBlendFactor != pAttachments[i].dstAlphaBlendFactor) || - (pAttachments[0].alphaBlendOp != pAttachments[i].alphaBlendOp) || - (pAttachments[0].colorWriteMask != pAttachments[i].colorWriteMask)) { - skipCall |= - log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, - DRAWSTATE_INDEPENDENT_BLEND, "DS", "Invalid Pipeline CreateInfo: If independent blend feature not " - "enabled, all elements of pAttachments must be identical"); + if (pPipeline->attachments.size() > 0) { + VkPipelineColorBlendAttachmentState *pAttachments = pAttachments = &pPipeline->attachments[0]; + for (size_t i = 1; i < pPipeline->attachments.size(); i++) { + if ((pAttachments[0].blendEnable != pAttachments[i].blendEnable) || + (pAttachments[0].srcColorBlendFactor != pAttachments[i].srcColorBlendFactor) || + (pAttachments[0].dstColorBlendFactor != pAttachments[i].dstColorBlendFactor) || + (pAttachments[0].colorBlendOp != pAttachments[i].colorBlendOp) || + (pAttachments[0].srcAlphaBlendFactor != pAttachments[i].srcAlphaBlendFactor) || + (pAttachments[0].dstAlphaBlendFactor != pAttachments[i].dstAlphaBlendFactor) || + (pAttachments[0].alphaBlendOp != pAttachments[i].alphaBlendOp) || + (pAttachments[0].colorWriteMask != pAttachments[i].colorWriteMask)) { + skipCall |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + DRAWSTATE_INDEPENDENT_BLEND, "DS", "Invalid Pipeline CreateInfo: If independent blend feature not " + "enabled, all elements of pAttachments must be identical"); + } } } } |