Struct RenderGraphBuilder
Use this struct to set up a new Render Pass.
Namespace: UnityEngine.Experimental.Rendering.RenderGraphModule
Syntax
public struct RenderGraphBuilder : IDisposable
Methods
AllowPassCulling(Boolean)
Allow or not pass culling By default all passes can be culled out if the render graph detects it's not actually used. In some cases, a pass may not write or read any texture but rather do something with side effects (like setting a global texture parameter for example). This function can be used to tell the system that it should not cull this pass.
Declaration
public void AllowPassCulling(bool value)
Parameters
Type | Name | Description |
---|---|---|
Boolean | value | True to allow pass culling. |
CreateTransientComputeBuffer(ComputeBufferDesc)
Create a new Render Graph Compute Buffer resource. This Compute Buffer will only be available for the current pass and will be assumed to be both written and read so users don't need to add explicit read/write declarations.
Declaration
public ComputeBufferHandle CreateTransientComputeBuffer(in ComputeBufferDesc desc)
Parameters
Type | Name | Description |
---|---|---|
ComputeBufferDesc | desc | Compute Buffer descriptor. |
Returns
Type | Description |
---|---|
ComputeBufferHandle | A new transient ComputeBufferHandle. |
CreateTransientComputeBuffer(ComputeBufferHandle)
Create a new Render Graph Compute Buffer resource using the descriptor from another Compute Buffer. This Compute Buffer will only be available for the current pass and will be assumed to be both written and read so users don't need to add explicit read/write declarations.
Declaration
public ComputeBufferHandle CreateTransientComputeBuffer(in ComputeBufferHandle computebuffer)
Parameters
Type | Name | Description |
---|---|---|
ComputeBufferHandle | computebuffer | Compute Buffer from which the descriptor should be used. |
Returns
Type | Description |
---|---|
ComputeBufferHandle | A new transient ComputeBufferHandle. |
CreateTransientTexture(TextureDesc)
Create a new Render Graph Texture resource. This texture will only be available for the current pass and will be assumed to be both written and read so users don't need to add explicit read/write declarations.
Declaration
public TextureHandle CreateTransientTexture(in TextureDesc desc)
Parameters
Type | Name | Description |
---|---|---|
TextureDesc | desc | Texture descriptor. |
Returns
Type | Description |
---|---|
TextureHandle | A new transient TextureHandle. |
CreateTransientTexture(TextureHandle)
Create a new Render Graph Texture resource using the descriptor from another texture. This texture will only be available for the current pass and will be assumed to be both written and read so users don't need to add explicit read/write declarations.
Declaration
public TextureHandle CreateTransientTexture(in TextureHandle texture)
Parameters
Type | Name | Description |
---|---|---|
TextureHandle | texture | Texture from which the descriptor should be used. |
Returns
Type | Description |
---|---|
TextureHandle | A new transient TextureHandle. |
Dispose()
Dispose the RenderGraphBuilder instance.
Declaration
public void Dispose()
EnableAsyncCompute(Boolean)
Enable asynchronous compute for this pass.
Declaration
public void EnableAsyncCompute(bool value)
Parameters
Type | Name | Description |
---|---|---|
Boolean | value | Set to true to enable asynchronous compute. |
ReadComputeBuffer(ComputeBufferHandle)
Specify a Compute Buffer resource to read from during the pass.
Declaration
public ComputeBufferHandle ReadComputeBuffer(in ComputeBufferHandle input)
Parameters
Type | Name | Description |
---|---|---|
ComputeBufferHandle | input | The Compute Buffer resource to read from during the pass. |
Returns
Type | Description |
---|---|
ComputeBufferHandle | An updated resource handle to the input resource. |
ReadTexture(TextureHandle)
Specify a Texture resource to read from during the pass.
Declaration
public TextureHandle ReadTexture(in TextureHandle input)
Parameters
Type | Name | Description |
---|---|---|
TextureHandle | input | The Texture resource to read from during the pass. |
Returns
Type | Description |
---|---|
TextureHandle | An updated resource handle to the input resource. |
SetRenderFunc<PassData>(RenderFunc<PassData>)
Specify the render function to use for this pass. A call to this is mandatory for the pass to be valid.
Declaration
public void SetRenderFunc<PassData>(RenderFunc<PassData> renderFunc)
where PassData : class, new()
Parameters
Type | Name | Description |
---|---|---|
RenderFunc<PassData> | renderFunc | Render function for the pass. |
Type Parameters
Name | Description |
---|---|
PassData | The Type of the class that provides data to the Render Pass. |
UseColorBuffer(TextureHandle, Int32)
Specify that the pass will use a Texture resource as a color render target. This has the same effect as WriteTexture and also automatically sets the Texture to use as a render target.
Declaration
public TextureHandle UseColorBuffer(in TextureHandle input, int index)
Parameters
Type | Name | Description |
---|---|---|
TextureHandle | input | The Texture resource to use as a color render target. |
Int32 | index | Index for multiple render target usage. |
Returns
Type | Description |
---|---|
TextureHandle | An updated resource handle to the input resource. |
UseDepthBuffer(TextureHandle, DepthAccess)
Specify that the pass will use a Texture resource as a depth buffer.
Declaration
public TextureHandle UseDepthBuffer(in TextureHandle input, DepthAccess flags)
Parameters
Type | Name | Description |
---|---|---|
TextureHandle | input | The Texture resource to use as a depth buffer during the pass. |
DepthAccess | flags | Specify the access level for the depth buffer. This allows you to say whether you will read from or write to the depth buffer, or do both. |
Returns
Type | Description |
---|---|
TextureHandle | An updated resource handle to the input resource. |
UseRendererList(RendererListHandle)
Specify a Renderer List resource to use during the pass.
Declaration
public RendererListHandle UseRendererList(in RendererListHandle input)
Parameters
Type | Name | Description |
---|---|---|
RendererListHandle | input | The Renderer List resource to use during the pass. |
Returns
Type | Description |
---|---|
RendererListHandle | An updated resource handle to the input resource. |
WriteComputeBuffer(ComputeBufferHandle)
Specify a Compute Buffer resource to write to during the pass.
Declaration
public ComputeBufferHandle WriteComputeBuffer(in ComputeBufferHandle input)
Parameters
Type | Name | Description |
---|---|---|
ComputeBufferHandle | input | The Compute Buffer resource to write to during the pass. |
Returns
Type | Description |
---|---|
ComputeBufferHandle | An updated resource handle to the input resource. |
WriteTexture(TextureHandle)
Specify a Texture resource to write to during the pass.
Declaration
public TextureHandle WriteTexture(in TextureHandle input)
Parameters
Type | Name | Description |
---|---|---|
TextureHandle | input | The Texture resource to write to during the pass. |
Returns
Type | Description |
---|---|
TextureHandle | An updated resource handle to the input resource. |