refactor(rendering): extract native scene renderer contract for srp

This commit is contained in:
2026-04-18 01:19:02 +08:00
parent df02a4e741
commit 1ba73fdf0a
7 changed files with 280 additions and 39 deletions

View File

@@ -59,6 +59,15 @@ bool BuiltinForwardPipeline::ShouldSampleMainDirectionalShadowMap(const RenderSc
IsDepthFormat(sceneData.lighting.mainDirectionalShadow.shadowMap->GetFormat());
}
bool BuiltinForwardPipeline::PrepareScene(
const FrameExecutionContext& executionContext) {
return m_forwardSceneFeatureHost.Prepare(executionContext);
}
SceneRenderFeatureHost* BuiltinForwardPipeline::GetFeatureHost() {
return &m_forwardSceneFeatureHost;
}
bool BuiltinForwardPipeline::SupportsStageRenderGraph(
CameraFrameStage stage) const {
return SupportsCameraFramePipelineGraphRecording(stage);
@@ -85,19 +94,19 @@ bool BuiltinForwardPipeline::ExecuteForwardSceneFrame(
return false;
}
if (!m_forwardSceneFeatureHost.Prepare(executionContext)) {
if (!PrepareScene(executionContext)) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinForwardPipeline::Render failed: SceneRenderFeatureHost::Prepare returned false");
"BuiltinForwardPipeline::Render failed: PrepareScene returned false");
return false;
}
const RenderPassContext passContext = BuildRenderPassContext(executionContext);
if (!BeginForwardScenePass(passContext)) {
if (!BeginScenePass(passContext)) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinForwardPipeline::Render failed: BeginForwardScenePass returned false");
"BuiltinForwardPipeline::Render failed: BeginScenePass returned false");
return false;
}
@@ -117,11 +126,19 @@ bool BuiltinForwardPipeline::ExecuteForwardSceneFrame(
executionContext.renderContext,
executionContext.sceneData);
}
EndForwardScenePass(passContext);
EndScenePass(passContext);
return renderResult;
}
bool BuiltinForwardPipeline::BeginScenePass(
const RenderPassContext& context,
bool clearAttachments) {
return BeginForwardScenePass(
context,
clearAttachments);
}
bool BuiltinForwardPipeline::BeginForwardScenePass(
const RenderPassContext& passContext,
bool clearAttachments) {
@@ -212,6 +229,10 @@ bool BuiltinForwardPipeline::Render(
return Render(FrameExecutionContext(context, surface, sceneData));
}
void BuiltinForwardPipeline::EndScenePass(const RenderPassContext& passContext) {
EndForwardScenePass(passContext);
}
void BuiltinForwardPipeline::EndForwardScenePass(const RenderPassContext& passContext) {
const RenderContext& context = passContext.renderContext;
const RenderSurface& surface = passContext.surface;