Introduction of Render Graph in the Universal Render Pipeline (URP)

renderGraph.CreateTexture(destinationDesc);
or
UniversalRenderer.CreateRenderGraphTexture

both create a TextureHandle for a temp resource. RenderGraph will manage the lifetime of that temp resource, at most it last the entire frame. The lifetime of the resource is between its first use and last use in the frame. Once the resource is not used anymore, ie, no pass is reading or writing to it, then RenderGraph will be able to reuse the underlying memory.

So for example, if you have three full screen post processing passes, and each creates a new texture handle to write to using renderGraph.CreateTexture(destinationDesc) and swaps it with the color buffer like in the example, then the lifetime of each temp resource is two passes and because the descriptor is identical, RG will reuse the original two color buffers from URP (CameraTargetAttachmentA en B). You can see in the image below what happens when you add three BlitAndSwap passes.

9831585--1414068--upload_2024-5-13_14-13-50.png

3 Likes