Skip to content

Commit

Permalink
Avoid copy depth pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Argent1024 committed Nov 21, 2024
1 parent ca81a57 commit 66af601
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,19 @@ void RequiresColorAndDepthAttachments(RenderGraph renderGraph, out bool createCo

useDepthPriming = IsDepthPrimingEnabled(cameraData);

// Intermediate texture has different yflip state than backbuffer. In case we use intermediate texture, we must use both color and depth together.
bool intermediateRenderTexture = (requireColorTexture || requireDepthTexture);
createDepthTexture = intermediateRenderTexture;
createColorTexture = intermediateRenderTexture;
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Vulkan)
{
// With vulkan subpass, we expect no "yFlip" is needed, so we don't need color and depth to be the same
createDepthTexture = requireDepthTexture;
createColorTexture = requireColorTexture;
}
else
{
// Intermediate texture has different yflip state than backbuffer. In case we use intermediate texture, we must use both color and depth together.
bool intermediateRenderTexture = (requireColorTexture || requireDepthTexture);
createDepthTexture = intermediateRenderTexture;
createColorTexture = intermediateRenderTexture;
}
}

// Gather history render requests and manage camera history texture life-time.
Expand Down Expand Up @@ -1474,7 +1483,6 @@ private void OnAfterRendering(RenderGraph renderGraph)

bool resolvePostProcessingToCameraTarget = !hasCaptureActions && !hasPassesAfterPostProcessing && !applyFinalPostProcessing;
bool needsColorEncoding = DebugHandler == null || !DebugHandler.HDRDebugViewIsActive(cameraData.resolveFinalTarget);
bool xrDepthTargetResolved = resourceData.activeDepthID == UniversalResourceData.ActiveID.BackBuffer;

DebugHandler debugHandler = ScriptableRenderPass.GetActiveDebugHandler(cameraData);
bool resolveToDebugScreen = debugHandler != null && debugHandler.WriteToDebugScreenTexture(cameraData.resolveFinalTarget);
Expand Down Expand Up @@ -1628,6 +1636,8 @@ private void OnAfterRendering(RenderGraph renderGraph)
#if ENABLE_VR && ENABLE_XR_MODULE
if (cameraData.xr.enabled)
{
// resolve might happens in post processing pass
bool xrDepthTargetResolved = resourceData.activeDepthID == UniversalResourceData.ActiveID.BackBuffer;
// Populate XR depth as requested by XR provider.
if (!xrDepthTargetResolved && cameraData.xr.copyDepth)
{
Expand Down

0 comments on commit 66af601

Please sign in to comment.