Build color blend state.
551{
552 for (const auto& config_attachment : config.color_blend_attachments) {
553 vk::PipelineColorBlendAttachmentState attachment;
554 attachment.blendEnable = config_attachment.blend_enable;
555 attachment.srcColorBlendFactor = config_attachment.src_color_blend_factor;
556 attachment.dstColorBlendFactor = config_attachment.dst_color_blend_factor;
557 attachment.colorBlendOp = config_attachment.color_blend_op;
558 attachment.srcAlphaBlendFactor = config_attachment.src_alpha_blend_factor;
559 attachment.dstAlphaBlendFactor = config_attachment.dst_alpha_blend_factor;
560 attachment.alphaBlendOp = config_attachment.alpha_blend_op;
561 attachment.colorWriteMask = config_attachment.color_write_mask;
562 attachments.push_back(attachment);
563 }
564
565 vk::PipelineColorBlendStateCreateInfo color_blend;
566 color_blend.logicOpEnable = config.logic_op_enable;
567 color_blend.logicOp = config.logic_op;
568 color_blend.attachmentCount = static_cast<uint32_t>(attachments.size());
569 color_blend.pAttachments = attachments.empty() ? nullptr : attachments.data();
570 color_blend.blendConstants[0] = config.blend_constants[0];
571 color_blend.blendConstants[1] = config.blend_constants[1];
572 color_blend.blendConstants[2] = config.blend_constants[2];
573 color_blend.blendConstants[3] = config.blend_constants[3];
574
575 return color_blend;
576}