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
defaultResources
Declaration
public RenderGraphDefaultResources defaultResources { get; }
Property Value
Type | Description |
---|---|
RenderGraphDefaultResources |
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 RendererListHandle CreateRendererList(in RendererListDesc desc)
Parameters
Type | Name | Description |
---|---|---|
RendererListDesc | desc | Renderer List descriptor. |
Returns
Type | Description |
---|---|
RendererListHandle | A new TextureHandle. |
CreateTexture(TextureDesc, Int32)
Create a new Render Graph Texture resource.
Declaration
public TextureHandle 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 |
---|---|
TextureHandle | A new TextureHandle. |
CreateTexture(TextureHandle, Int32)
Create a new Render Graph Texture resource using the descriptor from another texture.
Declaration
public TextureHandle CreateTexture(TextureHandle texture, int shaderProperty = 0)
Parameters
Type | Name | Description |
---|---|---|
TextureHandle | 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 |
---|---|
TextureHandle | A new TextureHandle. |
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(TextureHandle)
Gets the descriptor of the specified Texture resource.
Declaration
public TextureDesc GetTextureDesc(TextureHandle texture)
Parameters
Type | Name | Description |
---|---|---|
TextureHandle | texture |
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 pruned.
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, Int32)
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 pruned.
Declaration
public TextureHandle 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 |
---|---|
TextureHandle | A new TextureHandle. |
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()