docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class RenderGraph

    This class is the main entry point of the Render Graph system.

    Inheritance
    object
    RenderGraph
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Experimental.Rendering.RenderGraphModule
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    Syntax
    public class RenderGraph

    Constructors

    RenderGraph(string)

    Render Graph constructor.

    Declaration
    public RenderGraph(string name = "RenderGraph")
    Parameters
    Type Name Description
    string name

    Optional name used to identify the render graph instnace.

    Fields

    kMaxMRTCount

    Maximum number of MRTs supported by Render Graph.

    Declaration
    public static readonly int kMaxMRTCount
    Field Value
    Type Description
    int

    Properties

    defaultResources

    Set of default resources usable in a pass rendering code.

    Declaration
    public RenderGraphDefaultResources defaultResources { get; }
    Property Value
    Type Description
    RenderGraphDefaultResources

    name

    Name of the Render Graph.

    Declaration
    public string name { get; }
    Property Value
    Type Description
    string

    Methods

    AddRenderPass<PassData>(string, out PassData)

    Add a new Render Pass to the Render Graph.

    Declaration
    public RenderGraphBuilder AddRenderPass<PassData>(string passName, out PassData passData) where PassData : class, new()
    Parameters
    Type Name Description
    string passName

    Name of the new Render Pass (this is also be used to generate a GPU profiling marker).

    PassData passData

    Instance of PassData that is passed to the render function and you must fill.

    Returns
    Type Description
    RenderGraphBuilder

    A new instance of a RenderGraphBuilder used to setup the new Render Pass.

    Type Parameters
    Name Description
    PassData

    Type of the class to use to provide data to the Render Pass.

    AddRenderPass<PassData>(string, out PassData, ProfilingSampler)

    Add a new Render Pass to the Render Graph.

    Declaration
    public RenderGraphBuilder AddRenderPass<PassData>(string passName, out PassData passData, ProfilingSampler sampler) where PassData : class, new()
    Parameters
    Type Name Description
    string passName

    Name of the new Render Pass (this is also be used to generate a GPU profiling marker).

    PassData passData

    Instance of PassData that is passed to the render function and you must fill.

    ProfilingSampler sampler

    Profiling sampler used around the pass.

    Returns
    Type Description
    RenderGraphBuilder

    A new instance of a RenderGraphBuilder used to setup the new Render Pass.

    Type Parameters
    Name Description
    PassData

    Type of the class to use to provide data to the Render Pass.

    BeginProfilingSampler(ProfilingSampler)

    Begin a profiling scope.

    Declaration
    public void BeginProfilingSampler(ProfilingSampler sampler)
    Parameters
    Type Name Description
    ProfilingSampler sampler

    Sampler used for profiling.

    Cleanup()

    Cleanup the Render Graph.

    Declaration
    public void Cleanup()

    CreateComputeBuffer(in ComputeBufferDesc)

    Create a new Render Graph Compute Buffer resource.

    Declaration
    public ComputeBufferHandle CreateComputeBuffer(in ComputeBufferDesc desc)
    Parameters
    Type Name Description
    ComputeBufferDesc desc

    Compute Buffer descriptor.

    Returns
    Type Description
    ComputeBufferHandle

    A new ComputeBufferHandle.

    CreateComputeBuffer(in ComputeBufferHandle)

    Create a new Render Graph Compute Buffer resource using the descriptor from another compute buffer.

    Declaration
    public ComputeBufferHandle CreateComputeBuffer(in ComputeBufferHandle computeBuffer)
    Parameters
    Type Name Description
    ComputeBufferHandle computeBuffer

    Compute Buffer from which the descriptor should be used.

    Returns
    Type Description
    ComputeBufferHandle

    A new ComputeBufferHandle.

    CreateRendererList(in RendererListDesc)

    Creates a new Renderer List Render Graph resource.

    Declaration
    public RendererListHandle CreateRendererList(in RendererListDesc desc)
    Parameters
    Type Name Description
    RendererListDesc desc

    Renderer List descriptor.

    Returns
    Type Description
    RendererListHandle

    A new TextureHandle.

    CreateSharedTexture(in TextureDesc, bool)

    Create a new Render Graph Shared Texture resource. This texture will be persistent across render graph executions.

    Declaration
    public TextureHandle CreateSharedTexture(in TextureDesc desc, bool explicitRelease = false)
    Parameters
    Type Name Description
    TextureDesc desc

    Creation descriptor of the texture.

    bool explicitRelease

    Set to true if you want to manage the lifetime of the resource yourself. Otherwise the resource will be released automatically if unused for a time.

    Returns
    Type Description
    TextureHandle

    A new TextureHandle.

    CreateTexture(in TextureDesc)

    Create a new Render Graph Texture resource.

    Declaration
    public TextureHandle CreateTexture(in TextureDesc desc)
    Parameters
    Type Name Description
    TextureDesc desc

    Texture descriptor.

    Returns
    Type Description
    TextureHandle

    A new TextureHandle.

    CreateTexture(TextureHandle)

    Create a new Render Graph Texture resource using the descriptor from another texture.

    Declaration
    public TextureHandle CreateTexture(TextureHandle texture)
    Parameters
    Type Name Description
    TextureHandle texture

    Texture from which the descriptor should be used.

    Returns
    Type Description
    TextureHandle

    A new TextureHandle.

    CreateTextureIfInvalid(in TextureDesc, ref TextureHandle)

    Create a new Render Graph Texture if the passed handle is invalid and use said handle as output. If the passed handle is valid, no texture is created.

    Declaration
    public void CreateTextureIfInvalid(in TextureDesc desc, ref TextureHandle texture)
    Parameters
    Type Name Description
    TextureDesc desc

    Desc used to create the texture.

    TextureHandle texture

    Texture from which the descriptor should be used.

    EndFrame()

    End frame processing. Purge resources that have been used since last frame and resets internal states. This need to be called once per frame.

    Declaration
    public void EndFrame()

    EndProfilingSampler(ProfilingSampler)

    End a profiling scope.

    Declaration
    public void EndProfilingSampler(ProfilingSampler sampler)
    Parameters
    Type Name Description
    ProfilingSampler sampler

    Sampler used for profiling.

    GetComputeBufferDesc(in ComputeBufferHandle)

    Gets the descriptor of the specified Compute Buffer resource.

    Declaration
    public ComputeBufferDesc GetComputeBufferDesc(in ComputeBufferHandle computeBuffer)
    Parameters
    Type Name Description
    ComputeBufferHandle computeBuffer

    Compute Buffer resource from which the descriptor is requested.

    Returns
    Type Description
    ComputeBufferDesc

    The input compute buffer descriptor.

    GetRegisteredRenderGraphs()

    Get the list of all registered render graphs.

    Declaration
    public static List<RenderGraph> GetRegisteredRenderGraphs()
    Returns
    Type Description
    List<RenderGraph>

    The list of all registered render graphs.

    GetTextureDesc(TextureHandle)

    Gets the descriptor of the specified Texture resource.

    Declaration
    public TextureDesc GetTextureDesc(TextureHandle texture)
    Parameters
    Type Name Description
    TextureHandle texture

    Texture resource from which the descriptor is requested.

    Returns
    Type Description
    TextureDesc

    The input texture descriptor.

    ImportBackbuffer(RenderTargetIdentifier)

    Import the final backbuffer to render graph.

    Declaration
    public TextureHandle ImportBackbuffer(RenderTargetIdentifier rt)
    Parameters
    Type Name Description
    RenderTargetIdentifier rt

    Backbuffer render target identifier.

    Returns
    Type Description
    TextureHandle

    A new TextureHandle for the backbuffer.

    ImportComputeBuffer(ComputeBuffer)

    Import an external Compute Buffer to the Render Graph Any pass writing to an imported compute buffer will be considered having side effects and can't be automatically culled.

    Declaration
    public ComputeBufferHandle ImportComputeBuffer(ComputeBuffer computeBuffer)
    Parameters
    Type Name Description
    ComputeBuffer computeBuffer

    External Compute Buffer that needs to be imported.

    Returns
    Type Description
    ComputeBufferHandle

    A new ComputeBufferHandle.

    ImportTexture(RTHandle)

    Import an external texture to the Render Graph. Any pass writing to an imported texture will be considered having side effects and can't be automatically culled.

    Declaration
    public TextureHandle ImportTexture(RTHandle rt)
    Parameters
    Type Name Description
    RTHandle rt

    External RTHandle that needs to be imported.

    Returns
    Type Description
    TextureHandle

    A new TextureHandle.

    RecordAndExecute(in RenderGraphParameters)

    Starts the recording of the the render graph and then automatically execute when the return value goes out of scope. This must be called before adding any pass to the render graph.

    Declaration
    public RenderGraphExecution RecordAndExecute(in RenderGraphParameters parameters)
    Parameters
    Type Name Description
    RenderGraphParameters parameters

    Parameters necessary for the render graph execution.

    Returns
    Type Description
    RenderGraphExecution

    RenderGraphExecution

    Examples

    This shows how to increment an integer.

    using (renderGraph.RecordAndExecute(parameters))
    {
        // Add your render graph passes here.
    }
    See Also
    RenderGraphExecution

    RegisterDebug(Panel)

    Register the render graph to the debug window.

    Declaration
    public void RegisterDebug(DebugUI.Panel panel = null)
    Parameters
    Type Name Description
    DebugUI.Panel panel

    ReleaseSharedTexture(TextureHandle)

    Release a Render Graph shared texture resource.

    Declaration
    public void ReleaseSharedTexture(TextureHandle texture)
    Parameters
    Type Name Description
    TextureHandle texture

    The handle to the texture that needs to be release.

    UnRegisterDebug()

    Unregister render graph from the debug window.

    Declaration
    public void UnRegisterDebug()

    Extension Methods

    ReflectionUtils.GetField(object, string)
    ReflectionUtils.GetFields(object)
    ReflectionUtils.Invoke(object, string, params object[])
    ReflectionUtils.SetField(object, string, object)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)