Class CopyDepthPass
Copy the given depth buffer into the given destination depth buffer.
You can use this pass to copy a depth buffer to a destination, so you can use it later in rendering. If the source texture has MSAA enabled, the pass uses a custom MSAA resolve. If the source texture does not have MSAA enabled, the pass uses a Blit or a Copy Texture operation, depending on what the current platform supports.
Implements
Inherited Members
Namespace: UnityEngine.Rendering.Universal.Internal
Assembly: Unity.RenderPipelines.Universal.Runtime.dll
Syntax
public class CopyDepthPass : ScriptableRenderPass, IRenderGraphRecorder
Constructors
CopyDepthPass(RenderPassEvent, Shader, bool, bool, bool, string)
Creates a new CopyDepthPass
instance.
Declaration
public CopyDepthPass(RenderPassEvent evt, Shader copyDepthShader, bool shouldClear = false, bool copyToDepth = false, bool copyResolvedDepth = false, string customPassName = null)
Parameters
Type | Name | Description |
---|---|---|
RenderPassEvent | evt | The |
Shader | copyDepthShader | The |
bool | shouldClear | Controls whether it should do a clear before copying the depth. |
bool | copyToDepth | Controls whether it should do a copy to a depth format target. |
bool | copyResolvedDepth | Set to true if the source depth is MSAA resolved. |
string | customPassName | An optional custom profiling name to disambiguate multiple copy passes. |
See Also
Methods
Dispose()
Cleans up resources used by the pass.
Declaration
public void Dispose()
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 override void OnCameraCleanup(CommandBuffer cmd)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | Use this CommandBuffer to cleanup any generated data |
Overrides
Render(RenderGraph, ContextContainer, TextureHandle, TextureHandle, bool, string)
Sets up the Copy Depth pass for RenderGraph execution
Declaration
public void Render(RenderGraph renderGraph, ContextContainer frameData, TextureHandle destination, TextureHandle source, bool bindAsCameraDepth = false, string passName = "Copy Depth")
Parameters
Type | Name | Description |
---|---|---|
RenderGraph | renderGraph | The current RenderGraph used for recording and execution of a frame. |
ContextContainer | frameData | The renderer settings containing rendering data of the current frame. |
TextureHandle | destination |
|
TextureHandle | source |
|
bool | bindAsCameraDepth | If this is true, the destination texture is bound as _CameraDepthTexture after the copy pass |
string | passName | The pass name used for debug and identifying the pass. |
Render(RenderGraph, TextureHandle, TextureHandle, UniversalResourceData, UniversalCameraData, bool, string)
Sets up the Copy Depth pass for RenderGraph execution
Declaration
public void Render(RenderGraph renderGraph, TextureHandle destination, TextureHandle source, UniversalResourceData resourceData, UniversalCameraData cameraData, bool bindAsCameraDepth = false, string passName = "Copy Depth")
Parameters
Type | Name | Description |
---|---|---|
RenderGraph | renderGraph | The current RenderGraph used for recording and execution of a frame. |
TextureHandle | destination |
|
TextureHandle | source |
|
UniversalResourceData | resourceData | URP texture handles for the current frame. |
UniversalCameraData | cameraData | Camera settings for the current frame. |
bool | bindAsCameraDepth | If this is true, the destination texture is bound as _CameraDepthTexture after the copy pass |
string | passName | The pass name used for debug and identifying the pass. |
Setup(RTHandle, RTHandle)
Configure the pass with the source and destination to execute on.
Declaration
public void Setup(RTHandle source, RTHandle destination)
Parameters
Type | Name | Description |
---|---|---|
RTHandle | source | Source Render Target |
RTHandle | destination | Destination Render Target |