Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can multiple subpass be used with single pipeline in vulkan

Tags:

vulkan

VkGraphicsPipelineCreateInfo has integer member subpass.

My use case is creating a single pipeline object and use it with multiple subpasses. Each subpass has different color attachment.

like image 602
s007 Avatar asked Jun 20 '17 13:06

s007


People also ask

What are Subpasses in Vulkan?

Vulkan introduces the concept of sub-passes to subdivide a single render pass into separate logical phases. The benefit of using sub-passes over multiple render passes is that a GPU is able to perform various optimizations.

What is Vulkan render?

Vulkan is a new-generation graphics and compute API for high-efficiency, cross-platform access to GPUs. As the industry's only open standard modern GPU API, Vulkan is unique in enabling developers to write applications that are portable to multiple diverse platforms.


1 Answers

No. A pipeline is always built relative to a specific subpass of a specific render pass. It cannot be used in any other subpass:

The subpass index of the current render pass must be equal to the subpass member of the VkGraphicsPipelineCreateInfo structure specified when creating the VkPipeline currently bound to VK_PIPELINE_BIND_POINT_GRAPHICS.

You will need to create multiple pipelines, one for each subpass you intend to use it with. The pipeline cache should make this efficient for implementations that don't really care much about this.

like image 178
Nicol Bolas Avatar answered Sep 30 '22 02:09

Nicol Bolas