feat(srp): formalize scene recording and draw entrypoints

This commit is contained in:
2026-04-20 18:54:04 +08:00
parent b521616e27
commit 3df87e941c
20 changed files with 1054 additions and 181 deletions

View File

@@ -11,23 +11,6 @@ namespace XCEngine.Rendering.Universal
private const string kShaderVectorFullscreenPassName =
"Universal.ShaderVectorFullscreen";
private enum RecordedScenePhase
{
Opaque = 0,
Skybox = 1,
Transparent = 3
}
private enum RecordedSceneInjectionPoint
{
BeforeOpaque = 0,
AfterOpaque = 1,
BeforeSkybox = 2,
AfterSkybox = 3,
BeforeTransparent = 4,
AfterTransparent = 5
}
protected ScriptableRenderPass()
{
}
@@ -58,87 +41,6 @@ namespace XCEngine.Rendering.Universal
ScriptableRenderContext context,
RenderingData renderingData);
protected bool RecordScene(
ScriptableRenderContext context)
{
return context != null &&
InternalCalls
.Rendering_ScriptableRenderContext_RecordScene(
context.nativeHandle);
}
protected bool RecordOpaqueScenePhase(
ScriptableRenderContext context)
{
return RecordScenePhaseInternal(
context,
RecordedScenePhase.Opaque);
}
protected bool RecordSkyboxScenePhase(
ScriptableRenderContext context)
{
return RecordScenePhaseInternal(
context,
RecordedScenePhase.Skybox);
}
protected bool RecordTransparentScenePhase(
ScriptableRenderContext context)
{
return RecordScenePhaseInternal(
context,
RecordedScenePhase.Transparent);
}
protected bool RecordBeforeOpaqueInjection(
ScriptableRenderContext context)
{
return RecordSceneInjectionPointInternal(
context,
RecordedSceneInjectionPoint.BeforeOpaque);
}
protected bool RecordAfterOpaqueInjection(
ScriptableRenderContext context)
{
return RecordSceneInjectionPointInternal(
context,
RecordedSceneInjectionPoint.AfterOpaque);
}
protected bool RecordBeforeSkyboxInjection(
ScriptableRenderContext context)
{
return RecordSceneInjectionPointInternal(
context,
RecordedSceneInjectionPoint.BeforeSkybox);
}
protected bool RecordAfterSkyboxInjection(
ScriptableRenderContext context)
{
return RecordSceneInjectionPointInternal(
context,
RecordedSceneInjectionPoint.AfterSkybox);
}
protected bool RecordBeforeTransparentInjection(
ScriptableRenderContext context)
{
return RecordSceneInjectionPointInternal(
context,
RecordedSceneInjectionPoint.BeforeTransparent);
}
protected bool RecordAfterTransparentInjection(
ScriptableRenderContext context)
{
return RecordSceneInjectionPointInternal(
context,
RecordedSceneInjectionPoint.AfterTransparent);
}
protected bool RecordColorScaleFullscreenPass(
ScriptableRenderContext context,
Vector4 colorScale)
@@ -285,28 +187,6 @@ namespace XCEngine.Rendering.Universal
}
}
private bool RecordScenePhaseInternal(
ScriptableRenderContext context,
RecordedScenePhase scenePhase)
{
return context != null &&
InternalCalls
.Rendering_ScriptableRenderContext_RecordScenePhase(
context.nativeHandle,
(int)scenePhase);
}
private bool RecordSceneInjectionPointInternal(
ScriptableRenderContext context,
RecordedSceneInjectionPoint injectionPoint)
{
return context != null &&
InternalCalls
.Rendering_ScriptableRenderContext_RecordSceneInjectionPoint(
context.nativeHandle,
(int)injectionPoint);
}
private static bool TryResolveDefaultFullscreenTargets(
ScriptableRenderContext context,
out RenderGraphTextureHandle sourceColor,