refactor(rendering): formalize shared render-graph recording context

This commit is contained in:
2026-04-15 12:17:33 +08:00
parent 9c5b19a928
commit 5bf258df6d
3 changed files with 185 additions and 42 deletions

View File

@@ -8,29 +8,6 @@
namespace XCEngine {
namespace Rendering {
namespace {
RenderGraphRecordingContext BuildCommonContext(
const RenderPipelineMainSceneRenderGraphContext& context,
Containers::String passName) {
return {
context.graphBuilder,
passName,
context.renderContext,
context.sceneData,
context.surfaceTemplate,
context.sourceSurface,
context.sourceColorView,
context.sourceColorState,
context.sourceColorTexture,
context.colorTargets,
context.depthTarget,
context.executionSucceeded,
context.blackboard
};
}
} // namespace
Containers::String BuildRenderPipelineMainScenePhasePassName(
const Containers::String& baseName,
@@ -54,7 +31,7 @@ bool RecordRenderPipelineMainSceneFeaturePasses(
bool* recordedAnyPass) {
const SceneRenderFeaturePassRenderGraphContext featureContext =
BuildSceneRenderFeaturePassRenderGraphContext(
BuildCommonContext(context, context.passName),
BuildRenderGraphRecordingContext(context),
clearAttachments,
beginPassCallback,
endPassCallback);
@@ -73,8 +50,8 @@ bool RecordRenderPipelineMainScenePhasePass(
std::vector<RenderGraphTextureHandle> additionalReadTextures) {
const RenderPassRenderGraphContext passContext =
BuildRenderPassRenderGraphContext(
BuildCommonContext(
context,
CloneRenderGraphRecordingContext(
BuildRenderGraphRecordingContext(context),
BuildRenderPipelineMainScenePhasePassName(
context.passName,
scenePhase)),