in unity/Assets/PostProcessingV2/Runtime/PostProcessLayer.cs [619:703]
public void Render(PostProcessRenderContext context)
{
if (RuntimeUtilities.scriptableRenderPipelineActive)
SetupContext(context);
TextureLerper.instance.BeginFrame(context);
var cmd = context.command;
// Update & override layer settings first (volume blending) if the opaque only pass
// hasn't been called this frame.
UpdateSettingsIfNeeded(context);
// Do a NaN killing pass if needed
int lastTarget = -1;
if (stopNaNPropagation && !m_NaNKilled)
{
lastTarget = m_TargetPool.Get();
context.GetScreenSpaceTemporaryRT(cmd, lastTarget, 24, context.sourceFormat);
cmd.BlitFullscreenTriangle(context.source, lastTarget, RuntimeUtilities.copySheet, 1);
context.source = lastTarget;
m_NaNKilled = true;
}
// Do temporal anti-aliasing first
if (context.IsTemporalAntialiasingActive())
{
if (!RuntimeUtilities.scriptableRenderPipelineActive)
{
if (context.stereoActive)
{
// We only need to configure all of this once for stereo, during OnPreCull
if (context.camera.stereoActiveEye != Camera.MonoOrStereoscopicEye.Right)
temporalAntialiasing.ConfigureStereoJitteredProjectionMatrices(context);
}
else
{
temporalAntialiasing.ConfigureJitteredProjectionMatrix(context);
}
}
var taaTarget = m_TargetPool.Get();
var finalDestination = context.destination;
context.GetScreenSpaceTemporaryRT(cmd, taaTarget, 24, context.sourceFormat);
context.destination = taaTarget;
temporalAntialiasing.Render(context);
context.source = taaTarget;
context.destination = finalDestination;
if (lastTarget > -1)
cmd.ReleaseTemporaryRT(lastTarget);
lastTarget = taaTarget;
}
bool hasBeforeStackEffects = HasActiveEffects(PostProcessEvent.BeforeStack, context);
bool hasAfterStackEffects = HasActiveEffects(PostProcessEvent.AfterStack, context) && !breakBeforeColorGrading;
bool needsFinalPass = (hasAfterStackEffects
|| (antialiasingMode == Antialiasing.FastApproximateAntialiasing) || (antialiasingMode == Antialiasing.SubpixelMorphologicalAntialiasing && subpixelMorphologicalAntialiasing.IsSupported()))
&& !breakBeforeColorGrading;
// Right before the builtin stack
if (hasBeforeStackEffects)
lastTarget = RenderInjectionPoint(PostProcessEvent.BeforeStack, context, "BeforeStack", lastTarget);
// Builtin stack
lastTarget = RenderBuiltins(context, !needsFinalPass, lastTarget);
// After the builtin stack but before the final pass (before FXAA & Dithering)
if (hasAfterStackEffects)
lastTarget = RenderInjectionPoint(PostProcessEvent.AfterStack, context, "AfterStack", lastTarget);
// And close with the final pass
if (needsFinalPass)
RenderFinalPass(context, lastTarget);
// Render debug monitors & overlay if requested
debugLayer.RenderSpecialOverlays(context);
debugLayer.RenderMonitors(context);
// End frame cleanup
TextureLerper.instance.EndFrame();
debugLayer.EndFrame();
m_SettingsUpdateNeeded = true;
m_NaNKilled = false;
}