Labs / QUBICENGINE HANDBOOK

Render graph & resource lifetimes

Step across producers and consumers, inspect first/last use, and distinguish an alias candidate from legal native aliasing.

Inspect the relationship#

Step across producers and consumers, inspect first/last use, and distinguish an alias candidate from legal native aliasing.

INTERACTIVE ILLUSTRATIONSIMULATION / BROWSER

A frame is a dependency graph This illustration uses canvas. The explanation below describes the same process.

Change a control to inspect the result. Values describe the simulation, not native engine benchmarks. Open full lab ↗

Try these experiments#

  1. Step through geometry, lighting, transparency, and tone mapping. Read which resources each pass reads and writes.
  2. Observe the lifetime bars. A resource remains needed through its last consumer, not only its producer.
  3. Show the alias candidate. The G-buffer ends before output begins, so their logical lifetimes do not overlap.

What the illustration calculates#

The lab computes first and last use from pass declarations. Geometry produces depth and G-buffer data; lighting produces HDR; transparency produces a composite; tone mapping produces output. The highlighted pass and bars describe one ordered dependency model, not measured GPU timing. A full graph also handles imported swap-chain images, persistent temporal history, optional shadow/compute passes, and queue dependencies. Independent passes can be scheduled when their dependencies permit it. The lab keeps the order simple enough to inspect the lifetime relationship.

Connect it to physical resources#

Logical resources are graph identities. Physical resources are backend allocations with sizes, formats, usages, alignment, and memory requirements. Non-overlapping logical lifetimes are necessary for transient aliasing but not sufficient. A compatible heap strategy and the required aliasing transitions/barriers still matter. A texture can reach its last graph use during CPU recording while the GPU has not executed that use. Retire its physical storage using completion points covering execution, not merely the current pass number.

Reference pass declaration
text · REFERENCE EXCERPT
Lighting reads: depth, gbuffer
Lighting writes: hdr
Tone map reads: composite
Tone map writes: output

The graph compiler validates producers, sorts dependencies, and derives usages. The DX12 backend translates those into states/barriers. Vulkan translates them into stage/access dependencies and image layouts, with queue-family transfer when relevant.

What to inspect when it is wrong#

A read with no producer may be a missing pass or an undeclared imported resource. An alias that corrupts another target may have overlapping GPU lifetime or incorrect placement/barriers. A graph that serializes every pass can be correct but unnecessarily slow. Optimize only after dependency correctness is established. Read building a renderer and the full rendering pipeline.

Search titles and full article text.