Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "VkPipelineColorBlendAttachmentState contains the configuration per attached framebuffer" mean?

Tags:

vulkan

I read the Color blending Vulkan tutorial.

and this page says :

The first struct, VkPipelineColorBlendAttachmentState contains the configuration per attached framebuffer and the second struct, VkPipelineColorBlendStateCreateInfo contains the global color blending settings.In our case we only have one framebuffer

The second structure references the array of structures for all of the framebuffers

However, in the Framebuffers chapter, as many framebuffers as the number of imageView were created.

But the code associated with it is the same.

And per-framebuffer struct no framebuffer-related members.

How do one attach a color blend attachment to a framebuffer?

My guess is that it is automatically attached via VkFramebufferCreateInfo::pAttachments when recording the commands (i.e. when the render pass begins), am I right?

or rather via VkSubpassDescription::pColorAttachments ?

because specification say:

The value of attachmentCount must be greater than the index of all color attachments that are not VK_ATTACHMENT_UNUSED in VkSubpassDescription::pColorAttachments or VkSubpassDescription2::pColorAttachments for the subpass in which this pipeline is used.

like image 496
Nor-s Avatar asked Oct 27 '25 10:10

Nor-s


1 Answers

Sometimes, tutorials do not use proper wording. This is one of those times.

Recall that a pipeline is built against a specific subpass of a specific render pass. Also recall that subpasses have a list of (among other things) color attachments that represent the render targets for rendering operations in that subpass.

What the tutorial means is that VkPipelineColorBlendAttachmentState defines the blend state for a particular attachment in the subpass designated by the pipeline. The array of VkPipelineColorBlendAttachmentState structs mirrors the array of color attachments used in the subpass the pipeline is being built for. So the third element of VkPipelineColorBlendStateCreateInfo::pAttachments corresponds to the third element in VkSubpassDescription::pColorAttachments for the subpass the pipeline is being built for.

For some reason, this tutorial refers to these attachments as "attached framebuffer," as this is absolutely the wrong term to use. They're just attachments.

Framebuffers provide the images that will be used as attachments when you begin a render pass. But the pipeline doesn't (really) care what image object you use. It cares about what color attachment in the subpass you're talking about.

like image 83
Nicol Bolas Avatar answered Oct 30 '25 03:10

Nicol Bolas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!