Build color blend state.
583{
584 for (const auto& config_attachment : config.color_blend_attachments) {
585 vk::PipelineColorBlendAttachmentState attachment;
586 attachment.blendEnable = config_attachment.blend_enable;
587 attachment.srcColorBlendFactor = config_attachment.src_color_blend_factor;
588 attachment.dstColorBlendFactor = config_attachment.dst_color_blend_factor;
589 attachment.colorBlendOp = config_attachment.color_blend_op;
590 attachment.srcAlphaBlendFactor = config_attachment.src_alpha_blend_factor;
591 attachment.dstAlphaBlendFactor = config_attachment.dst_alpha_blend_factor;
592 attachment.alphaBlendOp = config_attachment.alpha_blend_op;
593 attachment.colorWriteMask = config_attachment.color_write_mask;
594 attachments.push_back(attachment);
595 }
596
597 vk::PipelineColorBlendStateCreateInfo color_blend;
598 color_blend.logicOpEnable = config.logic_op_enable;
599 color_blend.logicOp = config.logic_op;
600 color_blend.attachmentCount = static_cast<uint32_t>(attachments.size());
601 color_blend.pAttachments = attachments.empty() ? nullptr : attachments.data();
602 color_blend.blendConstants[0] = config.blend_constants[0];
603 color_blend.blendConstants[1] = config.blend_constants[1];
604 color_blend.blendConstants[2] = config.blend_constants[2];
605 color_blend.blendConstants[3] = config.blend_constants[3];
606
607 return color_blend;
608}