in unity/Assets/PostProcessingV2/Runtime/PostProcessLayer.cs [860:911]
void RenderFinalPass(PostProcessRenderContext context, int releaseTargetAfterUse = -1)
{
var cmd = context.command;
cmd.BeginSample("FinalPass");
if (breakBeforeColorGrading)
{
var sheet = context.propertySheets.Get(context.resources.shaders.discardAlpha);
cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
}
else
{
var uberSheet = context.propertySheets.Get(context.resources.shaders.finalPass);
uberSheet.ClearKeywords();
uberSheet.properties.Clear();
context.uberSheet = uberSheet;
int tempTarget = -1;
if (antialiasingMode == Antialiasing.FastApproximateAntialiasing)
{
uberSheet.EnableKeyword(fastApproximateAntialiasing.fastMode
? "FXAA_LOW"
: "FXAA"
);
if (fastApproximateAntialiasing.keepAlpha)
uberSheet.EnableKeyword("FXAA_KEEP_ALPHA");
}
else if (antialiasingMode == Antialiasing.SubpixelMorphologicalAntialiasing && subpixelMorphologicalAntialiasing.IsSupported())
{
tempTarget = m_TargetPool.Get();
var finalDestination = context.destination;
context.GetScreenSpaceTemporaryRT(context.command, tempTarget, 24, context.sourceFormat);
context.destination = tempTarget;
subpixelMorphologicalAntialiasing.Render(context);
context.source = tempTarget;
context.destination = finalDestination;
}
dithering.Render(context);
cmd.BlitFullscreenTriangle(context.source, context.destination, uberSheet, (context.flip && !context.isSceneView) ? 1 : 0);
if (tempTarget > -1)
cmd.ReleaseTemporaryRT(tempTarget);
}
if (releaseTargetAfterUse > -1)
cmd.ReleaseTemporaryRT(releaseTargetAfterUse);
cmd.EndSample("FinalPass");
}