docs.unity3d.com
    Show / Hide Table of Contents

    Class RenderGraph

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

    Inheritance
    Object
    RenderGraph
    Namespace: UnityEngine.Experimental.Rendering.RenderGraphModule
    Syntax
    public class RenderGraph : object

    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
    Int32

    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.

    Begin(in RenderGraphParameters)

    Begin using the render graph. This must be called before adding any pass to the render graph.

    Declaration
    public void Begin(in RenderGraphParameters parameters)
    Parameters
    Type Name Description
    RenderGraphParameters parameters

    Parameters necessary for the render graph execution.

    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.

    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
    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.

    Execute()

    Execute the Render Graph in its current state.

    Declaration
    public void Execute()

    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.

    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.

    In This Article
    • Constructors
      • RenderGraph(String)
    • Fields
      • kMaxMRTCount
    • Properties
      • defaultResources
      • name
    • Methods
      • AddRenderPass<PassData>(String, out PassData)
      • AddRenderPass<PassData>(String, out PassData, ProfilingSampler)
      • Begin(in RenderGraphParameters)
      • BeginProfilingSampler(ProfilingSampler)
      • Cleanup()
      • CreateComputeBuffer(in ComputeBufferDesc)
      • CreateComputeBuffer(in ComputeBufferHandle)
      • CreateRendererList(in RendererListDesc)
      • CreateTexture(in TextureDesc)
      • CreateTexture(TextureHandle)
      • CreateTextureIfInvalid(in TextureDesc, ref TextureHandle)
      • EndFrame()
      • EndProfilingSampler(ProfilingSampler)
      • Execute()
      • GetComputeBufferDesc(in ComputeBufferHandle)
      • GetTextureDesc(TextureHandle)
      • ImportBackbuffer(RenderTargetIdentifier)
      • ImportComputeBuffer(ComputeBuffer)
      • ImportTexture(RTHandle)
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023