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 15, 2024
1 parent ca81a57 commit 3fcc0d0
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,11 @@ 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;
// bool intermediateRenderTexture = (requireColorTexture || requireDepthTexture);

// The above is not correct, when using subpass, all textures should not have yflip, so we don't need them to be the same.
createDepthTexture = requireDepthTexture;
createColorTexture = requireColorTexture;
}

// Gather history render requests and manage camera history texture life-time.
Expand Down Expand Up @@ -1474,7 +1476,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 +1629,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 3fcc0d0

Please sign in to comment.