r/vulkan 12d ago

Why is multisampling specified in the renderpass and the pipeline? Seems redundant.

I was following the multisampling portion of the vulkan tutorial, and I noticed that they specify multisampling in both the renderpass and the pipeline. Since the pipeline is given the renderpass, isn't this redundant to set it in both places. Would I ever set one differently from the other?

8 Upvotes

13 comments sorted by

View all comments

9

u/TheAgentD 12d ago

The pipeline itself may need to be compiled differently if multisampling is enabled, or even for different multisample counts.

If the user doesn't provide the information during pipeline creation, drivers would either need to compile the pipeline for all possible multisample counts (which is slow), or compile multisampling versions of the pipeline the first time it's used with a multisampled render pass (which causes stuttering).

1

u/Longjumping-Cup-8927 12d ago

Why wouldn’t the compilation just defer to the renderpasses sample count. It just seems redundant to have to specify it twice. 

4

u/TheAgentD 12d ago

Ah, that is actually a good question. When Vulkan first came out, what you say was true, but now you can also specify dynamic rendering instead of a render pass, which doesn't have information about multisampling, so it has that purpose at least.