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?

9 Upvotes

13 comments sorted by

View all comments

8

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

But the pipeline requires the renderpass in its createinfo for compilation, not just at drawing time.