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 | 67a99448a827ed263ae90a3afa45399508397087 (patch) | |
| tree | 0122af4991be0cc094baeda4065859c0f229e139 /layers/core_validation.cpp | |
| parent | 2ad14d201ba0ac0644d5fa1f770d7734697870ad (diff) | |
| download | usermoji-67a99448a827ed263ae90a3afa45399508397087.tar.xz | |
layers: Fix AV in core_validaton
Caused crashes in DOTA2
Change-Id: I74d121641872597a63ea42e13ff860112fc7c314
Diffstat (limited to 'layers/core_validation.cpp')
| -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 56ba538d..e4946c40 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"); + } } } } |
