- Home
- Blog / Notes
notes/vulkan-and-computer-graphic/framegraph
Features
- Directed Acyclic Graph (DAG).
- Creation and management of render passes and frame buffers automatically.
- Reduce the memory required for a frame with memory aliasing.
- Manage the insertion of memory barriers and layout transitions.
Implementation Consideration
Data-driven approach
- Define our graph in JSON, implement parser.
- Have
inputs, outputs, name for each node.
- Resource types: texture, attachment, buffer, reference...
- steps to use framegraph:
- parse JSON
- compile()
- register_render_graph()
- render()
And this is possible to switch framegraph at runtime.
- In
compile() step of framegraph, we need:
- topological sort the nodes to decide rendering order.
- computing the resource aliasing for better memory reuse by checking the lifetime of resource.
Rendering stage (Preparing draw commands)
- We first iterate through all the inputs of a node. If the resource is a texture, we insert a barrier to
transition that resource from an attachment layout (for use in a render pass) to a shader stage layout
(for use in a fragment shader).
Implementation Details
Parsing graph