diff options
| author | Mark Mueller <markm@lunarg.com> | 2016-07-13 14:49:35 -0600 |
|---|---|---|
| committer | Mark Mueller <markm@lunarg.com> | 2016-07-18 09:38:34 -0600 |
| commit | 9918c0920c6c3fdcf3076e3c834f4dae1900863d (patch) | |
| tree | 22e0dbadcff14de601b7ff63184f277c3d53a6e1 /layers/core_validation.cpp | |
| parent | 7ed260f18f3c3610c6fc89b5c7ff6a4b79336c1d (diff) | |
| download | usermoji-9918c0920c6c3fdcf3076e3c834f4dae1900863d.tar.xz | |
layers: Fix minor completeness/performance issue
The first time the condition is discovered it will
be the same as every subsequent time, so there is
no need to continue. Also, the whole structure must
be compared, so memcmp assures that will happen
with good efficiency
Change-Id: I71f608c71f83ebcd02212bb391a30bdf15279ff6
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 9211503f..4ca938fe 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -3093,18 +3093,16 @@ static bool verifyPipelineCreateState(layer_data *my_data, const VkDevice device if (pPipeline->attachments.size() > 1) { VkPipelineColorBlendAttachmentState *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)) { + // Quoting the spec: "If [the independent blend] feature is not enabled, the VkPipelineColorBlendAttachmentState + // settings for all color attachments must be identical." VkPipelineColorBlendAttachmentState contains + // only attachment state, so memcmp is best suited for the comparison + if (memcmp(static_cast<const void *>(pAttachments), static_cast<const void *>(&pAttachments[i]), + sizeof(pAttachments[0]))) { skip_call |= 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"); + break; } } } |
