Class RenderGraph | Core RP Library | 10.0.0-preview.30
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

    Constructors

    RenderGraph(String)

    Render Graph constructor.

    Declaration
    public RenderGraph(string name = "")
    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

    Methods

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

    Add a new Render Pass to the current Render Graph.

    Declaration
    public RenderGraphBuilder AddRenderPass<PassData>(string passName, out PassData passData, ProfilingSampler sampler = null)
        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

    Optional profiling sampler.

    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.

    Cleanup()

    Cleanup the Render Graph.

    Declaration
    public void Cleanup()

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

    Execute(RenderGraphExecuteParams)

    Execute the Render Graph in its current state.

    Declaration
    public void Execute(in RenderGraphExecuteParams parameters)
    Parameters
    Type Name Description
    RenderGraphExecuteParams parameters

    Render Graph execution parameters.

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

    PurgeUnusedResources()

    Purge resources that have been used since last frame. This need to be called once per frame to avoid over usage of GPU memory.

    Declaration
    public void PurgeUnusedResources()
    Back to top
    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