Harden render graph pass capture and feature source-color contract

This commit is contained in:
2026-04-14 21:11:04 +08:00
parent 1d171ea61c
commit 9980aa9be5
6 changed files with 204 additions and 102 deletions

View File

@@ -94,11 +94,14 @@ bool BuiltinForwardPipeline::SupportsMainSceneRenderGraph() const {
bool BuiltinForwardPipeline::RecordMainSceneRenderGraph(
const RenderPipelineMainSceneRenderGraphContext& context) {
const Containers::String passName = context.passName;
const RenderContext* const renderContext = &context.renderContext;
const RenderSceneData* const sceneData = &context.sceneData;
const RenderContext renderContext = context.renderContext;
const std::shared_ptr<const RenderSceneData> sceneData =
std::make_shared<RenderSceneData>(context.sceneData);
const RenderSurface surfaceTemplate =
BuildGraphManagedForwardSceneSurface(context.surfaceTemplate);
const RenderSurface* const sourceSurface = context.sourceSurface;
const bool hasSourceSurface = context.sourceSurface != nullptr;
const RenderSurface sourceSurface =
hasSourceSurface ? *context.sourceSurface : RenderSurface();
RHI::RHIResourceView* const sourceColorView = context.sourceColorView;
const RHI::ResourceStates sourceColorState = context.sourceColorState;
const std::vector<RenderGraphTextureHandle> colorTargets = context.colorTargets;
@@ -113,6 +116,7 @@ bool BuiltinForwardPipeline::RecordMainSceneRenderGraph(
graphExecutionState,
renderContext,
sceneData,
hasSourceSurface,
sourceSurface,
sourceColorView,
sourceColorState,
@@ -124,7 +128,7 @@ bool BuiltinForwardPipeline::RecordMainSceneRenderGraph(
}
if (!graphExecutionState->initialized) {
if (!Initialize(*renderContext)) {
if (!Initialize(renderContext)) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinForwardPipeline::RecordMainSceneRenderGraph failed during execution: Initialize returned false");
@@ -135,10 +139,10 @@ bool BuiltinForwardPipeline::RecordMainSceneRenderGraph(
}
const FrameExecutionContext executionContext(
*renderContext,
renderContext,
passContext.surface,
*sceneData,
sourceSurface,
hasSourceSurface ? &sourceSurface : nullptr,
sourceColorView,
sourceColorState);
if (!m_forwardSceneFeatureHost.Prepare(executionContext)) {
@@ -177,12 +181,13 @@ bool BuiltinForwardPipeline::RecordMainSceneRenderGraph(
const SceneRenderFeaturePassRenderGraphContext featureContext = {
context.graphBuilder,
passName,
*renderContext,
renderContext,
*sceneData,
surfaceTemplate,
sourceSurface,
hasSourceSurface ? &sourceSurface : nullptr,
sourceColorView,
sourceColorState,
{},
colorTargets,
depthTarget,
mainDirectionalShadowTexture,
@@ -214,6 +219,7 @@ bool BuiltinForwardPipeline::RecordMainSceneRenderGraph(
surfaceTemplate,
renderContext,
sceneData,
hasSourceSurface,
sourceSurface,
sourceColorView,
sourceColorState,
@@ -245,6 +251,7 @@ bool BuiltinForwardPipeline::RecordMainSceneRenderGraph(
surfaceTemplate,
renderContext,
sceneData,
hasSourceSurface,
sourceSurface,
sourceColorView,
sourceColorState,
@@ -259,10 +266,10 @@ bool BuiltinForwardPipeline::RecordMainSceneRenderGraph(
}
const FrameExecutionContext executionContext(
*renderContext,
renderContext,
surfaceTemplate,
*sceneData,
sourceSurface,
hasSourceSurface ? &sourceSurface : nullptr,
sourceColorView,
sourceColorState);
const RenderPassContext passContext =