Interface IBaseRenderGraphBuilder
Common base interface for the different render graph builders. These functions are supported on all builders.
Inherited Members
Namespace: UnityEngine .Rendering.RenderGraphModule
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
[MovedFrom(true, "UnityEngine.Experimental.Rendering.RenderGraphModule", "UnityEngine.Rendering.RenderGraphModule", null)]
public interface IBaseRenderGraphBuilder : IDisposable
Methods
AllowGlobalStateModification(bool)
Allow commands in the command buffer to modify global state. This will introduce a render graph sync-point in the frame and cause all passes after this pass to never be reordered before this pass. This may nave negative impact on performance and memory use if not used carefully so it is recommended to only allow this in specific use cases. This will also set AllowPassCulling to false.
Declaration
void AllowGlobalStateModification(bool value)
Parameters
Type | Name | Description |
---|---|---|
bool | value | True to allow global state modification. |
AllowPassCulling(bool)
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
void AllowPassCulling(bool value)
Parameters
Type | Name | Description |
---|---|---|
bool | value | True to allow pass culling. |
CreateTransientBuffer(in BufferDesc)
Create a new Render Graph Graphics Buffer resource. This Graphics 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
BufferHandle CreateTransientBuffer(in BufferDesc desc)
Parameters
Type | Name | Description |
---|---|---|
Buffer |
desc | Compute Buffer descriptor. |
Returns
Type | Description |
---|---|
Buffer |
A new transient BufferHandle. |
CreateTransientBuffer(in BufferHandle)
Create a new Render Graph Graphics Buffer resource using the descriptor from another Graphics Buffer. This Graphics 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
BufferHandle CreateTransientBuffer(in BufferHandle computebuffer)
Parameters
Type | Name | Description |
---|---|---|
Buffer |
computebuffer | Graphics Buffer from which the descriptor should be used. |
Returns
Type | Description |
---|---|
Buffer |
A new transient BufferHandle. |
CreateTransientTexture(in 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
TextureHandle CreateTransientTexture(in TextureDesc desc)
Parameters
Type | Name | Description |
---|---|---|
Texture |
desc | Texture descriptor. |
Returns
Type | Description |
---|---|
Texture |
A new transient TextureHandle. |
CreateTransientTexture(in 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
TextureHandle CreateTransientTexture(in TextureHandle texture)
Parameters
Type | Name | Description |
---|---|---|
Texture |
texture | Texture from which the descriptor should be used. |
Returns
Type | Description |
---|---|
Texture |
A new transient TextureHandle. |
EnableAsyncCompute(bool)
Enable asynchronous compute for this pass.
Declaration
void EnableAsyncCompute(bool value)
Parameters
Type | Name | Description |
---|---|---|
bool | value | Set to true to enable asynchronous compute. |
EnableFoveatedRasterization(bool)
Enable foveated rendering for this pass.
Declaration
void EnableFoveatedRasterization(bool value)
Parameters
Type | Name | Description |
---|---|---|
bool | value | True to enable foveated rendering. |
SetGlobalTextureAfterPass(in TextureHandle, int)
Make this pass set a global texture slot at the end of this pass. During this pass the global texture will still have it's old value. Only after this pass the global texture slot will take on the new value specified. Generally this pass will also do a UseTexture(write) on this texture handle to indicate it is generating this texture, but this is not really a requirement you can have a pass that simply sets up a new value in a global texture slot but doesn't write it. Although counter-intuitive at first, this call doesn't actually have a dependency on the passed in texture handle. It's only when a subsequent pass has a dependency on the global texture slot that subsequent pass will get a dependency on the currently set global texture for that slot. This means globals slots can be set without overhead if you're unsure if a resource will be used or not, the graph will still maintain the correct lifetimes.
NOTE: When the RENDER_GRAPH_CLEAR_GLOBALS
define is set, all shader bindings set through this function will be cleared once graph execution completes.
Declaration
void SetGlobalTextureAfterPass(in TextureHandle input, int propertyId)
Parameters
Type | Name | Description |
---|---|---|
Texture |
input | The texture value to set in the global texture slot. This can be an null handle to clear the global texture slot. |
int | propertyId | The global texture slot to set the value for. Use Shader.PropertyToID to generate the id. |
UseAllGlobalTextures(bool)
Indicate that this pass will reference all textures in global texture slots known to the graph. The default setting is false. It is highly recommended if you know which globals you pass will access to use UseTexture(glboalTextureSlotId) with individual texture slots instead of UseAllGlobalTextures(true) to ensure the graph can maximally optimize resource use and lifetimes.
This function should only be used in cases where it is difficult/impossible to know which globals a pass will access. This is for example true if your pass renders objects in the scene (e.g. using CommandBuffer.DrawRendererList) that might be using arbitrary shaders which in turn may access arbitrary global textures. To avoid having to do a UseAllGlobalTextures(true) in this situation, you will either have to ensure all shaders are well behaved and do not access spurious globals our make sure your renderer list filters allow only shaders that are known to be well behaved to pass.
Declaration
void UseAllGlobalTextures(bool enable)
Parameters
Type | Name | Description |
---|---|---|
bool | enable | If true the pass from which this is called will reference all global textures. |
UseBuffer(in BufferHandle, AccessFlags)
Declare that this pass uses the input compute buffer.
Declaration
BufferHandle UseBuffer(in BufferHandle input, AccessFlags flags = AccessFlags.Read)
Parameters
Type | Name | Description |
---|---|---|
Buffer |
input | The compute buffer resource to use during the pass. |
Access |
flags | A combination of flags indicating how the resource will be used during the pass. Default value is set to AccessFlag.Read |
Returns
Type | Description |
---|---|
Buffer |
The value passed to 'input'. You should not use the returned value it will be removed in the future. |
UseGlobalTexture(int, AccessFlags)
Declare that this pass uses the texture assigned to the global texture slot. The actual texture referenced is indirectly specified here it depends on the value previous passes that were added to the graph set for the global texture slot. If no previous pass set a texture to the global slot an exception will be raised.
Declaration
void UseGlobalTexture(int propertyId, AccessFlags flags = AccessFlags.Read)
Parameters
Type | Name | Description |
---|---|---|
int | propertyId | The global texture slot read by shaders in this pass. Use Shader.PropertyToID to generate these ids. |
Access |
flags | A combination of flags indicating how the resource will be used during the pass. Default value is set to AccessFlag.Read |
UseRendererList(in RendererListHandle)
This pass will read from this renderer list. RendererLists are always read-only in the graph so have no access flags.
Declaration
void UseRendererList(in RendererListHandle input)
Parameters
Type | Name | Description |
---|---|---|
Renderer |
input | The Renderer List resource to use during the pass. |
UseTexture(in TextureHandle, AccessFlags)
Declare that this pass uses the input texture.
Declaration
void UseTexture(in TextureHandle input, AccessFlags flags = AccessFlags.Read)
Parameters
Type | Name | Description |
---|---|---|
Texture |
input | The texture resource to use during the pass. |
Access |
flags | A combination of flags indicating how the resource will be used during the pass. Default value is set to AccessFlag.Read |