1
votes

VkGraphicsPipelineCreateInfo expects assignment of a VkRenderPass to .renderPass property. I don't really understand why a pipeline must be coupled with render pass. I mean, VkGraphicsPipelineCreateInfo doesn't directly "talks" to render pass related content, like FBOs and their attachments. I may want to use same pipeline with more than one render pass, like in case where I want to render same set of objects in different scenes, so do I have to create another one with exactly the same setup?

Just to add that creating VkPipeline with .renderPass = nullptr fails with validation error:

vkCreateGraphicsPipelines: required parameter pCreateInfos[0].renderPass specified as VK_NULL_HANDLE.Invalid VkRenderPass Object 0x0. The Vulkan spec states: renderPass must be a valid VkRenderPass handle (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkGraphicsPipelineCreateInfo-renderPass-parameter)

1
"I may want to use same pipeline with more than one render pass, like in case where I want to render same set of objects in different scenes" Why would that involve using a different renderpass?Nicol Bolas
In my use case I may have several scenes with different render targets,different dimensions of the render targets,and MSAA enabled/ disabledMichael IV
Aside from the sample counts, none of those things affect the structure of the VkRenderPass object that gets used. And as far as multisampling is concerned... well, stop doing that. Pick a sample count and stick with it.Nicol Bolas
@NicolBolas what do you mean by " pick a sample count and stick with it" ?Michael IV
It means to pick a sample count and stick with it. To not have a bunch of different render targets with different sample counts. I can see the need for doing multisampling for the main rendering process while not doing multisampling for reflections processed via render-to-texture. But that's just two sample counts, which requires two render passes and two pipelines.Nicol Bolas

1 Answers

2
votes

I mean VkGraphicsPipelineCreateInfo doesn't directly "talks" to render pass related content, like FBOs and their attachments.

Of course it does. What do you think a fragment shader is doing when it writes into a render pass' attachments?

Do I have to create another one with exactly the same setup?

No. As per the specification:

"renderPass is a handle to a render pass object describing the environment in which the pipeline will be used; the pipeline must only be used with an instance of any render pass compatible with the one provided. See Render Pass Compatibility for more information".

... so a pipeline can be used with any render pass that is compatible with the one used to create it.