Class RenderGraph
This class is the main entry point of the Render Graph system.
Namespace: UnityEngine.Experimental.Rendering.RenderGraphModule
Syntax
public class RenderGraph
Constructors
RenderGraph(Boolean, MSAASamples)
Render Graph constructor.
Declaration
public RenderGraph(bool supportMSAA, MSAASamples initialSampleCount)
Parameters
Type | Name | Description |
---|---|---|
Boolean | supportMSAA | Specify if this Render Graph should support MSAA. |
MSAASamples | initialSampleCount | Specify the initial sample count of MSAA render textures. |
Fields
kMaxMRTCount
Maximum number of MRTs supported by Render Graph.
Declaration
public static readonly int kMaxMRTCount
Field Value
Type | Description |
---|---|
Int32 |
Properties
enabled
Returns true if rendering with Render Graph is enabled.
Declaration
public bool enabled { get; }
Property Value
Type | Description |
---|---|
Boolean |
rtHandleProperties
Gets the RTHandleProperties structure associated with the Render Graph's RTHandle System.
Declaration
public RTHandleProperties rtHandleProperties { get; }
Property Value
Type | Description |
---|---|
RTHandleProperties |
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()
CreateRendererList(RendererListDesc)
Creates a new Renderer List Render Graph resource.
Declaration
public RenderGraphResource CreateRendererList(in RendererListDesc desc)
Parameters
Type | Name | Description |
---|---|---|
RendererListDesc | desc | Renderer List descriptor. |
Returns
Type | Description |
---|---|
RenderGraphResource | A new RenderGraphResource. |
CreateTexture(RenderGraphResource, Int32)
Create a new Render Graph Texture resource using the descriptor from another texture.
Declaration
public RenderGraphMutableResource CreateTexture(in RenderGraphResource texture, int shaderProperty = 0)
Parameters
Type | Name | Description |
---|---|---|
RenderGraphResource | texture | Texture from which the descriptor should be used. |
Int32 | shaderProperty | Optional property that allows you to specify a Shader property name to use for automatic resource binding. |
Returns
Type | Description |
---|---|
RenderGraphMutableResource | A new RenderGraphMutableResource. |
CreateTexture(TextureDesc, Int32)
Create a new Render Graph Texture resource.
Declaration
public RenderGraphMutableResource CreateTexture(TextureDesc desc, int shaderProperty = 0)
Parameters
Type | Name | Description |
---|---|---|
TextureDesc | desc | Texture descriptor. |
Int32 | shaderProperty | Optional property that allows you to specify a Shader property name to use for automatic resource binding. |
Returns
Type | Description |
---|---|
RenderGraphMutableResource | A new RenderGraphMutableResource. |
Execute(ScriptableRenderContext, CommandBuffer, RenderGraphExecuteParams)
Execute the Render Graph in its current state.
Declaration
public void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, in RenderGraphExecuteParams parameters)
Parameters
Type | Name | Description |
---|---|---|
ScriptableRenderContext | renderContext | ScriptableRenderContext used to execute Scriptable Render Pipeline. |
CommandBuffer | cmd | Command Buffer used for Render Passes rendering. |
RenderGraphExecuteParams | parameters | Render Graph execution parameters. |
GetTextureDesc(RenderGraphResource)
Gets the descriptor of the specified Texture resource.
Declaration
public TextureDesc GetTextureDesc(in RenderGraphResource texture)
Parameters
Type | Name | Description |
---|---|---|
RenderGraphResource | texture |
Returns
Type | Description |
---|---|
TextureDesc | The input texture descriptor. |
ImportTexture(RTHandle, Int32)
Import an external texture to the Render Graph.
Declaration
public RenderGraphMutableResource ImportTexture(RTHandle rt, int shaderProperty = 0)
Parameters
Type | Name | Description |
---|---|---|
RTHandle | rt | External RTHandle that needs to be imported. |
Int32 | shaderProperty | Optional property that allows you to specify a Shader property name to use for automatic resource binding. |
Returns
Type | Description |
---|---|
RenderGraphMutableResource | A new RenderGraphMutableResource. |
RegisterDebug()
Register this Render Graph to the debug window.
Declaration
public void RegisterDebug()
ResetRTHandleReferenceSize(Int32, Int32)
Resets the reference size of the internal RTHandle System. This allows users to reduce the memory footprint of render textures after doing a super sampled rendering pass for example.
Declaration
public void ResetRTHandleReferenceSize(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | New width of the internal RTHandle System. |
Int32 | height | New height of the internal RTHandle System. |
UnRegisterDebug()
Unregister this Render Graph from the debug window.
Declaration
public void UnRegisterDebug()