Class ScriptableRenderPass
ScriptableRenderPass
implements a logical rendering pass that can be used to extend Universal RP renderer.
Inherited Members
Namespace: UnityEngine.Rendering.Universal
Assembly: Unity.RenderPipelines.Universal.Runtime.dll
Syntax
public abstract class ScriptableRenderPass
Constructors
ScriptableRenderPass()
Declaration
public ScriptableRenderPass()
Properties
clearColor
Declaration
public Color clearColor { get; }
Property Value
Type | Description |
---|---|
Color |
clearFlag
Declaration
public ClearFlag clearFlag { get; }
Property Value
Type | Description |
---|---|
ClearFlag |
colorAttachment
Declaration
public RenderTargetIdentifier colorAttachment { get; }
Property Value
Type | Description |
---|---|
RenderTargetIdentifier |
colorAttachments
Declaration
public RenderTargetIdentifier[] colorAttachments { get; }
Property Value
Type | Description |
---|---|
RenderTargetIdentifier[] |
colorStoreActions
Declaration
public RenderBufferStoreAction[] colorStoreActions { get; }
Property Value
Type | Description |
---|---|
RenderBufferStoreAction[] |
depthAttachment
Declaration
public RenderTargetIdentifier depthAttachment { get; }
Property Value
Type | Description |
---|---|
RenderTargetIdentifier |
depthStoreAction
Declaration
public RenderBufferStoreAction depthStoreAction { get; }
Property Value
Type | Description |
---|---|
RenderBufferStoreAction |
input
The input requirements for the ScriptableRenderPass
, which has been set using ConfigureInput
Declaration
public ScriptableRenderPassInput input { get; }
Property Value
Type | Description |
---|---|
ScriptableRenderPassInput |
See Also
profilingSampler
A ProfilingSampler for the entire render pass. Used as a profiling name by ScriptableRenderer
when executing the pass.
Default is Unnamed_ScriptableRenderPass
.
Set base.profilingSampler
from the sub-class constructor to set a profiling name for a custom ScriptableRenderPass
.
Declaration
protected ProfilingSampler profilingSampler { get; set; }
Property Value
Type | Description |
---|---|
ProfilingSampler |
renderPassEvent
Declaration
public RenderPassEvent renderPassEvent { get; set; }
Property Value
Type | Description |
---|---|
RenderPassEvent |
Methods
Blit(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, Material, int)
Add a blit command to the context for execution. This changes the active render target in the ScriptableRenderer to destination.
Declaration
public void Blit(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Material material = null, int passIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | Command buffer to record command for execution. |
RenderTargetIdentifier | source | Source texture or target identifier to blit from. |
RenderTargetIdentifier | destination | Destination texture or target identifier to blit into. This becomes the renderer active render target. |
Material | material | Material to use. |
int | passIndex | Shader pass to use. Default is 0. |
See Also
Blit(CommandBuffer, ref RenderingData, Material, int)
Add a blit command to the context for execution. This applies the material to the color target.
Declaration
public void Blit(CommandBuffer cmd, ref RenderingData data, Material material, int passIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | Command buffer to record command for execution. |
RenderingData | data | RenderingData to access the active renderer. |
Material | material | Material to use. |
int | passIndex | Shader pass to use. Default is 0. |
Configure(CommandBuffer, RenderTextureDescriptor)
This method is called by the renderer before executing the render pass.
Override this method if you need to to configure render targets and their clear state, and to create temporary render target textures.
If a render pass doesn't override this method, this render pass renders to the active Camera's render target.
You should never call CommandBuffer.SetRenderTarget. Instead call ConfigureTarget
and ConfigureClear
.
Declaration
public virtual void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | CommandBuffer to enqueue rendering commands. This will be executed by the pipeline. |
RenderTextureDescriptor | cameraTextureDescriptor | Render texture descriptor of the camera render target. |
See Also
ConfigureClear(ClearFlag, Color)
Configures clearing for the render targets for this render pass. Call this inside Configure.
Declaration
public void ConfigureClear(ClearFlag clearFlag, Color clearColor)
Parameters
Type | Name | Description |
---|---|---|
ClearFlag | clearFlag | ClearFlag containing information about what targets to clear. |
Color | clearColor | Clear color. |
See Also
ConfigureColorStoreAction(RenderBufferStoreAction, uint)
Configures the Store Action for a color attachment of this render pass.
Declaration
public void ConfigureColorStoreAction(RenderBufferStoreAction storeAction, uint attachmentIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
RenderBufferStoreAction | storeAction | RenderBufferStoreAction to use |
uint | attachmentIndex | Index of the color attachment |
ConfigureColorStoreActions(RenderBufferStoreAction[])
Configures the Store Actions for all the color attachments of this render pass.
Declaration
public void ConfigureColorStoreActions(RenderBufferStoreAction[] storeActions)
Parameters
Type | Name | Description |
---|---|---|
RenderBufferStoreAction[] | storeActions | Array of RenderBufferStoreActions to use |
ConfigureDepthStoreAction(RenderBufferStoreAction)
Configures the Store Action for the depth attachment of this render pass.
Declaration
public void ConfigureDepthStoreAction(RenderBufferStoreAction storeAction)
Parameters
Type | Name | Description |
---|---|---|
RenderBufferStoreAction | storeAction | RenderBufferStoreAction to use |
ConfigureInput(ScriptableRenderPassInput)
Configures Input Requirements for this render pass.
This method should be called inside ScriptableRendererFeature.AddRenderPasses
.
Declaration
public void ConfigureInput(ScriptableRenderPassInput passInput)
Parameters
Type | Name | Description |
---|---|---|
ScriptableRenderPassInput | passInput | ScriptableRenderPassInput containing information about what requirements the pass needs. |
See Also
ConfigureTarget(RenderTargetIdentifier)
Configures render targets for this render pass. Call this instead of CommandBuffer.SetRenderTarget. This method should be called inside Configure.
Declaration
public void ConfigureTarget(RenderTargetIdentifier colorAttachment)
Parameters
Type | Name | Description |
---|---|---|
RenderTargetIdentifier | colorAttachment | Color attachment identifier. |
See Also
ConfigureTarget(RenderTargetIdentifier, RenderTargetIdentifier)
Configures render targets for this render pass. Call this instead of CommandBuffer.SetRenderTarget. This method should be called inside Configure.
Declaration
public void ConfigureTarget(RenderTargetIdentifier colorAttachment, RenderTargetIdentifier depthAttachment)
Parameters
Type | Name | Description |
---|---|---|
RenderTargetIdentifier | colorAttachment | Color attachment identifier. |
RenderTargetIdentifier | depthAttachment | Depth attachment identifier. |
See Also
ConfigureTarget(RenderTargetIdentifier[])
Configures render targets for this render pass. Call this instead of CommandBuffer.SetRenderTarget. This method should be called inside Configure.
Declaration
public void ConfigureTarget(RenderTargetIdentifier[] colorAttachments)
Parameters
Type | Name | Description |
---|---|---|
RenderTargetIdentifier[] | colorAttachments |
See Also
ConfigureTarget(RenderTargetIdentifier[], RenderTargetIdentifier)
Configures render targets for this render pass. Call this instead of CommandBuffer.SetRenderTarget. This method should be called inside Configure.
Declaration
public void ConfigureTarget(RenderTargetIdentifier[] colorAttachments, RenderTargetIdentifier depthAttachment)
Parameters
Type | Name | Description |
---|---|---|
RenderTargetIdentifier[] | colorAttachments | |
RenderTargetIdentifier | depthAttachment | Depth attachment identifier. |
See Also
CreateDrawingSettings(List<ShaderTagId>, ref RenderingData, SortingCriteria)
Creates DrawingSettings
based on current rendering state.
Declaration
public DrawingSettings CreateDrawingSettings(List<ShaderTagId> shaderTagIdList, ref RenderingData renderingData, SortingCriteria sortingCriteria)
Parameters
Type | Name | Description |
---|---|---|
List<ShaderTagId> | shaderTagIdList | List of shader pass tag to render. |
RenderingData | renderingData | Current rendering state. |
SortingCriteria | sortingCriteria | Criteria to sort objects being rendered. |
Returns
Type | Description |
---|---|
DrawingSettings |
See Also
CreateDrawingSettings(ShaderTagId, ref RenderingData, SortingCriteria)
Creates DrawingSettings
based on current the rendering state.
Declaration
public DrawingSettings CreateDrawingSettings(ShaderTagId shaderTagId, ref RenderingData renderingData, SortingCriteria sortingCriteria)
Parameters
Type | Name | Description |
---|---|---|
ShaderTagId | shaderTagId | Shader pass tag to render. |
RenderingData | renderingData | Current rendering state. |
SortingCriteria | sortingCriteria | Criteria to sort objects being rendered. |
Returns
Type | Description |
---|---|
DrawingSettings |
See Also
Execute(ScriptableRenderContext, ref RenderingData)
Execute the pass. This is where custom rendering occurs. Specific details are left to the implementation
Declaration
public abstract void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
Parameters
Type | Name | Description |
---|---|---|
ScriptableRenderContext | context | Use this render context to issue any draw commands during execution |
RenderingData | renderingData | Current rendering state information |
OnCameraCleanup(CommandBuffer)
Called upon finish rendering a camera. You can use this callback to release any resources created by this render pass that need to be cleanup once camera has finished rendering. This method should be called for all cameras in a camera stack.
Declaration
public virtual void OnCameraCleanup(CommandBuffer cmd)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | Use this CommandBuffer to cleanup any generated data |
OnCameraSetup(CommandBuffer, ref RenderingData)
This method is called by the renderer before rendering a camera
Override this method if you need to to configure render targets and their clear state, and to create temporary render target textures.
If a render pass doesn't override this method, this render pass renders to the active Camera's render target.
You should never call CommandBuffer.SetRenderTarget. Instead call ConfigureTarget
and ConfigureClear
.
Declaration
public virtual void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | CommandBuffer to enqueue rendering commands. This will be executed by the pipeline. |
RenderingData | renderingData | Current rendering state information |
See Also
OnFinishCameraStackRendering(CommandBuffer)
Called upon finish rendering a camera stack. You can use this callback to release any resources created by this render pass that need to be cleanup once all cameras in the stack have finished rendering. This method will be called once after rendering the last camera in the camera stack. Cameras that don't have an explicit camera stack are also considered stacked rendering. In that case the Base camera is the first and last camera in the stack.
Declaration
public virtual void OnFinishCameraStackRendering(CommandBuffer cmd)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | Use this CommandBuffer to cleanup any generated data |
ResetTarget()
Resets render targets to default. This method effectively reset changes done by ConfigureTarget.
Declaration
public void ResetTarget()
See Also
Operators
operator >(ScriptableRenderPass, ScriptableRenderPass)
Declaration
public static bool operator >(ScriptableRenderPass lhs, ScriptableRenderPass rhs)
Parameters
Type | Name | Description |
---|---|---|
ScriptableRenderPass | lhs | |
ScriptableRenderPass | rhs |
Returns
Type | Description |
---|---|
bool |
operator <(ScriptableRenderPass, ScriptableRenderPass)
Declaration
public static bool operator <(ScriptableRenderPass lhs, ScriptableRenderPass rhs)
Parameters
Type | Name | Description |
---|---|---|
ScriptableRenderPass | lhs | |
ScriptableRenderPass | rhs |
Returns
Type | Description |
---|---|
bool |