The render graph system is a set of APIs from the Core Scriptable Render Pipeline (SRP) package. You use the APIs to write a Scriptable Render Pass in the Universal Render Pipeline (URP).
When you use the render graph API to create a Scriptable Render Pass, you tell URP the following:
You can then inject your Scriptable Render Pass into the URP renderer. Your Scriptable Render Pass becomes part of URP’s internal render graph, which is the sequence of render passes URP steps through each frame.
The render graph system automatically optimizes the graph to minimize the number of render passes, and the memory and bandwidth the render passes use.
The render graph system does the following to optimize rendering:
On mobile platforms that use tile-based deferred rendering (TBDR), the render graph system can also merge multiple render passes into a single native render pass. A native render pass keeps textures in tile memory, rather than copying textures from the GPU to the CPU. As a result, URP uses less memory bandwidth and rendering time.
To check how the render graph system optimizes rendering in your custom render passes, refer to Analyze a render graph.
To declare a resource and use it in a render pass, for example a texture or a list of objects to render, call render graph system APIs that return a handle to the resource. You can’t directly allocate or dispose of resources yourself.
The render graph system only allocates the memory for a resource just before the first render pass that writes to it, and releases the memory after the last render pass that reads it. This lets render graph manage memory in the most efficient way possible, and avoid allocating memory for resources that aren’t used in a frame.
You can create resources in two ways:
The render graph system supports the following render pass types.
| Pass type | API | Use case |
|---|---|---|
| Raster | AddRasterRenderPass |
Use by default. The render graph system can merge compatible raster render passes together, which makes this the most optimized pass type. For more information, refer to Write a render pass using the render graph system. |
| Compute | AddComputePass |
Use if your render pass runs a compute shader. For more information, refer to Compute shaders in the render graph system. |
| Unsafe | AddUnsafePass |
Use only if you need direct access to the CommandBuffer API and can’t achieve the same result with a raster or compute render pass. Unsafe render passes can’t be merged with other passes and have less validation than raster and compute render passes. For more information, refer to Use the CommandBuffer interface in a render graph. |