Commit 558df923 by Chris Forbes

Fix color blend state handling for multiple attachments

This was masked by the incorrect assert -- we did the wrong thing in MRT cases, but the assert intended to protect us would only fire if logic ops were also enabled. Fix this properly. We still only have one shared set of blend state, but each attachment has its masks set now. Some of the tests exercising this are dubious on a device which doesn't support independent blending -- the color write masks are technically part of the state which must be the same across all attachments. Bug: b/132433217 Test: dEQP-VK.renderpass.* Change-Id: Ia22f9cbf156a9f3c24d47142211bde67f06a0d46 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31350Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent ea81ab76
...@@ -398,8 +398,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -398,8 +398,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
if(colorBlendState) if(colorBlendState)
{ {
if((colorBlendState->flags != 0) || if((colorBlendState->flags != 0) ||
((colorBlendState->logicOpEnable != 0) && ((colorBlendState->logicOpEnable != 0)))
(colorBlendState->attachmentCount > 1)))
{ {
UNIMPLEMENTED("colorBlendState"); UNIMPLEMENTED("colorBlendState");
} }
...@@ -412,10 +411,15 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -412,10 +411,15 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
blendConstants.a = colorBlendState->blendConstants[3]; blendConstants.a = colorBlendState->blendConstants[3];
} }
if(colorBlendState->attachmentCount == 1) for (auto i = 0u; i < colorBlendState->attachmentCount; i++)
{
const VkPipelineColorBlendAttachmentState& attachment = colorBlendState->pAttachments[i];
context.setColorWriteMask(i, attachment.colorWriteMask);
}
if(colorBlendState->attachmentCount > 0)
{ {
const VkPipelineColorBlendAttachmentState& attachment = colorBlendState->pAttachments[0]; const VkPipelineColorBlendAttachmentState& attachment = colorBlendState->pAttachments[0];
context.setColorWriteMask(0, attachment.colorWriteMask);
context.alphaBlendEnable = (attachment.blendEnable == VK_TRUE); context.alphaBlendEnable = (attachment.blendEnable == VK_TRUE);
context.blendOperationStateAlpha = attachment.alphaBlendOp; context.blendOperationStateAlpha = attachment.alphaBlendOp;
context.blendOperationState = attachment.colorBlendOp; context.blendOperationState = attachment.colorBlendOp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment