@@ -573,33 +573,33 @@ bool CVulkanLogicalDevice::createGPUGraphicsPipelines_impl(
573
573
574
574
uint32_t offset = colorBlendAttachmentCount_total;
575
575
576
- uint32_t colorBlendAttachmentCount = 0u ;
577
- for (uint32_t as = 0u ; as < asset::SBlendParams::MAX_COLOR_ATTACHMENT_COUNT; ++as)
576
+ assert (creationParams[i].subpassIx < creationParams[i].renderpass ->getCreationParameters ().subpassCount );
577
+ auto subpassDescription = creationParams[i].renderpass ->getCreationParameters ().subpasses [creationParams[i].subpassIx ];
578
+ uint32_t colorBlendAttachmentCount = subpassDescription.colorAttachmentCount ;
579
+
580
+ for (uint32_t as = 0u ; as < colorBlendAttachmentCount; ++as)
578
581
{
579
- const auto & attBlendParams = blendParams.blendParams [as];
580
- if (attBlendParams.attachmentEnabled )
581
- {
582
- auto & attBlendState = vk_colorBlendAttachmentStates[offset + colorBlendAttachmentCount++];
583
-
584
- attBlendState.blendEnable = attBlendParams.blendEnable ;
585
- attBlendState.srcColorBlendFactor = static_cast <VkBlendFactor>(attBlendParams.srcColorFactor );
586
- attBlendState.dstColorBlendFactor = static_cast <VkBlendFactor>(attBlendParams.dstColorFactor );
587
- assert (attBlendParams.colorBlendOp <= asset::EBO_MAX);
588
- attBlendState.colorBlendOp = static_cast <VkBlendOp>(attBlendParams.colorBlendOp );
589
- attBlendState.srcAlphaBlendFactor = static_cast <VkBlendFactor>(attBlendParams.srcAlphaFactor );
590
- attBlendState.dstAlphaBlendFactor = static_cast <VkBlendFactor>(attBlendParams.dstAlphaFactor );
591
- assert (attBlendParams.alphaBlendOp <= asset::EBO_MAX);
592
- attBlendState.alphaBlendOp = static_cast <VkBlendOp>(attBlendParams.alphaBlendOp );
593
- attBlendState.colorWriteMask = static_cast <VkColorComponentFlags>(attBlendParams.colorWriteMask );
594
- }
582
+ const auto & inBlendParams = blendParams.blendParams [as];
583
+ auto & outBlendState = vk_colorBlendAttachmentStates[offset + as];
584
+
585
+ outBlendState.blendEnable = inBlendParams.blendEnable ;
586
+ outBlendState.srcColorBlendFactor = getVkBlendFactorFromBlendFactor (static_cast <asset::E_BLEND_FACTOR>(inBlendParams.srcColorFactor ));
587
+ outBlendState.dstColorBlendFactor = getVkBlendFactorFromBlendFactor (static_cast <asset::E_BLEND_FACTOR>(inBlendParams.dstColorFactor ));
588
+ assert (inBlendParams.colorBlendOp <= asset::EBO_MAX);
589
+ outBlendState.colorBlendOp = getVkBlendOpFromBlendOp (static_cast <asset::E_BLEND_OP>(inBlendParams.colorBlendOp ));
590
+ outBlendState.srcAlphaBlendFactor = getVkBlendFactorFromBlendFactor (static_cast <asset::E_BLEND_FACTOR>(inBlendParams.srcAlphaFactor ));
591
+ outBlendState.dstAlphaBlendFactor = getVkBlendFactorFromBlendFactor (static_cast <asset::E_BLEND_FACTOR>(inBlendParams.dstAlphaFactor ));
592
+ assert (inBlendParams.alphaBlendOp <= asset::EBO_MAX);
593
+ outBlendState.alphaBlendOp = getVkBlendOpFromBlendOp (static_cast <asset::E_BLEND_OP>(inBlendParams.alphaBlendOp ));
594
+ outBlendState.colorWriteMask = getVkColorComponentFlagsFromColorWriteMask (inBlendParams.colorWriteMask );
595
595
}
596
596
colorBlendAttachmentCount_total += colorBlendAttachmentCount;
597
597
598
598
vk_colorBlendStates[i].sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
599
599
vk_colorBlendStates[i].pNext = nullptr ;
600
600
vk_colorBlendStates[i].flags = 0u ;
601
601
vk_colorBlendStates[i].logicOpEnable = blendParams.logicOpEnable ;
602
- vk_colorBlendStates[i].logicOp = static_cast <VkLogicOp >(blendParams.logicOp );
602
+ vk_colorBlendStates[i].logicOp = getVkLogicOpFromLogicOp ( static_cast <asset::E_LOGIC_OP >(blendParams.logicOp ) );
603
603
vk_colorBlendStates[i].attachmentCount = colorBlendAttachmentCount;
604
604
vk_colorBlendStates[i].pAttachments = vk_colorBlendAttachmentStates.data () + offset;
605
605
vk_colorBlendStates[i].blendConstants [0 ] = 0 .0f ;
0 commit comments