Files
XCEngine/managed/XCEngine.ScriptCore/ScriptableRenderPipelinePlanningContext.cs
ssdfasd 2b6d62a127 refactor(rendering): unify managed fullscreen planning stage api
replace post-process and final-output specific planning calls with a single fullscreen stage bridge

align managed planning with the native CameraFrameStage fullscreen seam
2026-04-18 15:12:41 +08:00

68 lines
2.3 KiB
C#

using System;
namespace XCEngine
{
public sealed class ScriptableRenderPipelinePlanningContext
{
private readonly ulong m_nativeHandle;
internal ScriptableRenderPipelinePlanningContext(ulong nativeHandle)
{
m_nativeHandle = nativeHandle;
}
public void ClearFullscreenStage(
CameraFrameStage stage)
{
ValidateFullscreenStage(stage);
InternalCalls.Rendering_ScriptableRenderPipelinePlanningContext_ClearFullscreenStage(
m_nativeHandle,
(int)stage);
}
public void RequestFullscreenStage(
CameraFrameStage stage,
CameraFrameColorSource source,
bool usesGraphManagedOutputColor = false)
{
ValidateFullscreenStage(stage);
if (source == CameraFrameColorSource.ExplicitSurface)
{
throw new ArgumentException(
"Managed planning currently requires a graph-managed color source for fullscreen stages.",
nameof(source));
}
if (stage == CameraFrameStage.FinalOutput && usesGraphManagedOutputColor)
{
throw new ArgumentException(
"FinalOutput fullscreen stages cannot publish a graph-managed output color.",
nameof(usesGraphManagedOutputColor));
}
if (!InternalCalls
.Rendering_ScriptableRenderPipelinePlanningContext_RequestFullscreenStage(
m_nativeHandle,
(int)stage,
(int)source,
usesGraphManagedOutputColor))
{
throw new InvalidOperationException(
$"Failed to request the managed fullscreen stage '{stage}'.");
}
}
private static void ValidateFullscreenStage(
CameraFrameStage stage)
{
if (stage != CameraFrameStage.PostProcess &&
stage != CameraFrameStage.FinalOutput)
{
throw new ArgumentException(
"Managed planning currently supports only fullscreen sequence stages.",
nameof(stage));
}
}
}
}