diff options
| author | Ian Elliott <ianelliott@google.com> | 2016-02-18 14:26:42 -0700 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2016-02-26 10:20:34 -0700 |
| commit | 57638adcbe25c52444894d71676d5204c2eefeca (patch) | |
| tree | 7cdf2a7fbdabea0b089c7488f509a54c7180d167 | |
| parent | 9f5d8cc6ab3f1f89e1711ea8c8e6d1efc53e2eb6 (diff) | |
| download | usermoji-57638adcbe25c52444894d71676d5204c2eefeca.tar.xz | |
layers: draw_state validates VkPipelineColorBlendStateCreateInfo
This is a squash of 3 commits/validationtests:
- If independentBlend not enabled, validate that all elements of pAttachments
must be identical (for the vkCreateGraphicsPipelines() function).
- If logicOp not enabled, validate that logicOpEnable is VK_FALSE.
- If logicOpEnable is VK_TRUE, logicOp must be a valid VkLogicOp value.
| -rw-r--r-- | layers/draw_state.cpp | 33 | ||||
| -rwxr-xr-x | layers/draw_state.h | 6 | ||||
| -rw-r--r-- | layers/vk_validation_layer_details.md | 3 |
3 files changed, 42 insertions, 0 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 889f124c..0a5ea990 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -1873,6 +1873,39 @@ static VkBool32 verifyPipelineCreateState(layer_data* my_data, const VkDevice de { VkBool32 skipCall = VK_FALSE; + if (pPipeline->graphicsPipelineCI.pColorBlendState != NULL) { + if (!my_data->physDevProperties.features.independentBlend) { + VkPipelineColorBlendAttachmentState *pAttachments = pPipeline->pAttachments; + for (uint i = 1 ; i < pPipeline->attachmentCount ; 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 (!my_data->physDevProperties.features.logicOp && + (pPipeline->graphicsPipelineCI.pColorBlendState->logicOpEnable != VK_FALSE)) { + skipCall |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + (VkDebugReportObjectTypeEXT) 0, 0, __LINE__, DRAWSTATE_DISABLED_LOGIC_OP, "DS", + "Invalid Pipeline CreateInfo: If logic operations feature not enabled, logicOpEnable must be VK_FALSE"); + } + if ((pPipeline->graphicsPipelineCI.pColorBlendState->logicOpEnable == VK_TRUE) && + (pPipeline->graphicsPipelineCI.pColorBlendState->logicOp < VK_LOGIC_OP_CLEAR) || + (pPipeline->graphicsPipelineCI.pColorBlendState->logicOp > VK_LOGIC_OP_SET)) { + skipCall |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + (VkDebugReportObjectTypeEXT) 0, 0, __LINE__, DRAWSTATE_INVALID_LOGIC_OP, "DS", + "Invalid Pipeline CreateInfo: If logicOpEnable is VK_TRUE, logicOp must be a valid VkLogicOp value"); + } + } + if (!validate_pipeline_shaders(my_data, device, pPipeline)) { skipCall = VK_TRUE; } diff --git a/layers/draw_state.h b/layers/draw_state.h index d17a2186..41c7174a 100755 --- a/layers/draw_state.h +++ b/layers/draw_state.h @@ -193,6 +193,12 @@ typedef enum _DRAW_STATE_ERROR { // violate device limit DRAWSTATE_INVALID_STORAGE_BUFFER_OFFSET, // Dynamic Storage Buffer Offsets // violate device limit + DRAWSTATE_INDEPENDENT_BLEND, // If independent blending is not enabled, all + // elements of pAttachmentsMustBeIdentical + DRAWSTATE_DISABLED_LOGIC_OP, // If logic operations is not enabled, logicOpEnable + // must be VK_FALSE + DRAWSTATE_INVALID_LOGIC_OP, // If logicOpEnable is VK_TRUE, logicOp must + // must be a valid VkLogicOp value } DRAW_STATE_ERROR; typedef enum _SHADER_CHECKER_ERROR { diff --git a/layers/vk_validation_layer_details.md b/layers/vk_validation_layer_details.md index 2e56f296..c419ace1 100644 --- a/layers/vk_validation_layer_details.md +++ b/layers/vk_validation_layer_details.md @@ -78,6 +78,9 @@ The VK_LAYER_LUNARG_draw_state layer tracks state leading into Draw cmds. This i | Live Semaphore | When waiting on a semaphore, need to make sure that the semaphore is live and therefore can be signalled, otherwise queue is stalled and cannot make forward progress. | QUEUE_FORWARD_PROGRESS | vkQueueSubmit vkQueueBindSparse vkQueuePresentKHR vkAcquireNextImageKHR | TODO | Create test | | Storage Buffer Alignment | Storage Buffer offsets in BindDescriptorSets must agree with offset alignment device limit | INVALID_STORAGE_BUFFER_OFFSET | vkCmdBindDescriptorSets | TODO | Create test | | Uniform Buffer Alignment | Uniform Buffer offsets in BindDescriptorSets must agree with offset alignment device limit | INVALID_UNIFORM_BUFFER_OFFSET | vkCmdBindDescriptorSets | TODO | Create test | +| Independent Blending | If independent blending is not enabled, all elements of pAttachments must be identical | INDEPENDENT_BLEND | vkCreateGraphicsPipelines | TODO | Create test | +| Enabled Logic Operations | If logic operations is not enabled, logicOpEnable must be VK_FALSE | DISABLED_LOGIC_OP | vkCreateGraphicsPipelines | TODO | Create test | +| Valid Logic Operations | If logicOpEnable is VK_TRUE, logicOp must be a valid VkLogicOp value | VALID_LOGIC_OP | vkCreateGraphicsPipelines | TODO | Create test | | NA | Enum used for informational messages | NONE | | NA | None | | NA | Enum used for errors in the layer itself. This does not indicate an app issue, but instead a bug in the layer. | INTERNAL_ERROR | | NA | None | | NA | Enum used when VK_LAYER_LUNARG_draw_state attempts to allocate memory for its own internal use and is unable to. | OUT_OF_MEMORY | | NA | None | |
