15

What is the logical relationship between RenderPass and Pipeline in Vulkan?

If you ignore RenderPass, my understanding of the rendering process is first, the vertex data prepared by the application layer, then the texture data can be submitted to the driver, and after that through the various stages of the pipeline, after writing to the Framebuffer, you can complete a rendering.

So what is the responsibility of the RenderPass? Is it an abstraction that provides metadata for rendering each stage (such as Format), or does it have some other role?

Is RenderPass and Pipeline dependent on feelings? For example, each Pipeline belongs to a Subpass. Or a dependency, such as the last output of the Pipeline, is handled by RenderPass. Or is it something else?

genpfault
  • 51,148
  • 11
  • 85
  • 139
董佳斌
  • 151
  • 1
  • 3
  • Possible duplicate of [Why do we need multiple render passes and subpasses?](https://stackoverflow.com/questions/48300046/why-do-we-need-multiple-render-passes-and-subpasses) – Nicol Bolas May 05 '19 at 13:25
  • Possible duplicate of [confused about render pass in Vulkan API](https://stackoverflow.com/questions/39551676/confused-about-render-pass-in-vulkan-api) – krOoze May 05 '19 at 13:51

1 Answers1

11

At the end of the day Vulkan is a nice modern-ish OO API. All the objects in Vulkan are practically only what parameters they take. Just saying this to ease your learning. You can look at vkCreateX and largely understand what VkX does in Vulkan.

VkPipeline is a GPU context. Think of GPU as a FPGA (which it isn't, but bear with me). Doing vkCmdBindPipeline would set the GPU to given gate configuration. Exept GPU is not FPGA — in our case it sets the GPU to a state where it can execute the shader programs and fixed-function pipeline stages defined by the VkPipeline.

VkRenderPass is a data oriented thing. It is necessitated by tiled architecture GPUs (mobile GPUs). On desktop GPUs it can still fill the role of being oracle for optimization and\or allow partially-tiled architecture (or any other architecture really that can use this).

Tiled-architecture GPUs need to "load" image\buffer from general-purpose RAM to "on-chip memory". When they are done they "store" their results back to RAM.

VkRenderPass defines what kind of inputs (attachments) will be needed. It defines how they get loaded and stored before and after the render pass instance*, respectively. It also has subpasses. It defines synchronization between them (replaces vkCmdPipelineBarriers). And defines the kind of purpose given render pass attachment will be filling (e.g. if it is color buffer, or a depth buffer).

* Render Pass Instance is the thing created from Render Pass instance by vkCmdBeginRenderPass. Yea, not confusing, right.

David DiGioia
  • 181
  • 15
krOoze
  • 12,301
  • 1
  • 20
  • 34
  • Thank you very much, but my English is very bad. I am Chinese, if you are too, then I am officially too lucky, thank you again. – 董佳斌 May 06 '19 at 10:26