refactor(rendering): add override helpers for shared recording contexts

This commit is contained in:
2026-04-15 13:01:04 +08:00
parent 8aee665d32
commit ea2e44976a
5 changed files with 128 additions and 34 deletions

View File

@@ -18,15 +18,21 @@ bool SceneRenderFeaturePass::RecordRenderGraph(
[](RenderGraphTextureHandle handle) {
return handle.IsValid();
});
RenderGraphRecordingContext recordingContext =
const RenderGraphRecordingContext baseRecordingContext =
BuildRenderGraphRecordingContext(context);
const RenderSurface sourceSurfaceTemplate =
recordingContext.sourceSurface != nullptr
? *recordingContext.sourceSurface
baseRecordingContext.sourceSurface != nullptr
? *baseRecordingContext.sourceSurface
: (usesSourceColor ? context.surface : RenderSurface());
if (recordingContext.sourceSurface == nullptr && usesSourceColor) {
recordingContext.sourceSurface = &sourceSurfaceTemplate;
}
RenderGraphRecordingContextOverrides overrides = {};
overrides.overrideSourceSurface =
baseRecordingContext.sourceSurface == nullptr && usesSourceColor;
overrides.sourceSurface =
overrides.overrideSourceSurface ? &sourceSurfaceTemplate : nullptr;
const RenderGraphRecordingContext recordingContext =
CloneRenderGraphRecordingContext(
baseRecordingContext,
overrides);
const RenderPassGraphBeginCallback beginPassCallback =
context.beginPassCallback