75 lines
2.3 KiB
C#
75 lines
2.3 KiB
C#
using XCEngine;
|
|
using XCEngine.Rendering;
|
|
|
|
namespace XCEngine.Rendering.Universal
|
|
{
|
|
internal sealed class UniversalFinalOutputBlock
|
|
{
|
|
private readonly BuiltinFinalColorPass m_builtinFinalColorPass =
|
|
new BuiltinFinalColorPass();
|
|
|
|
public void FinalizeCameraFramePlan(
|
|
ScriptableRenderPipelinePlanningContext context)
|
|
{
|
|
if (context == null ||
|
|
!context.HasFinalColorProcessing())
|
|
{
|
|
return;
|
|
}
|
|
|
|
context.ClearFullscreenStage(
|
|
CameraFrameStage.FinalOutput);
|
|
|
|
CameraFrameColorSource finalOutputSource =
|
|
CameraFrameColorSource.MainSceneColor;
|
|
if (context.IsStageRequested(
|
|
CameraFrameStage.PostProcess))
|
|
{
|
|
CameraFrameColorSource postProcessSource =
|
|
context.GetStageColorSource(
|
|
CameraFrameStage.PostProcess);
|
|
if (postProcessSource !=
|
|
CameraFrameColorSource.ExplicitSurface)
|
|
{
|
|
if (!context.UsesGraphManagedOutputColor(
|
|
CameraFrameStage.PostProcess))
|
|
{
|
|
context.ClearFullscreenStage(
|
|
CameraFrameStage.PostProcess);
|
|
context.RequestFullscreenStage(
|
|
CameraFrameStage.PostProcess,
|
|
postProcessSource,
|
|
true);
|
|
}
|
|
|
|
finalOutputSource =
|
|
CameraFrameColorSource.PostProcessColor;
|
|
}
|
|
}
|
|
|
|
context.RequestFullscreenStage(
|
|
CameraFrameStage.FinalOutput,
|
|
finalOutputSource);
|
|
}
|
|
|
|
public void EnqueueRenderPasses(
|
|
ScriptableRenderer renderer,
|
|
RenderingData renderingData)
|
|
{
|
|
if (renderer == null ||
|
|
renderingData == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!renderingData.isFinalOutputStage &&
|
|
!renderingData.finalColorData.requiresProcessing)
|
|
{
|
|
return;
|
|
}
|
|
|
|
renderer.EnqueuePass(m_builtinFinalColorPass);
|
|
}
|
|
}
|
|
}
|