refactor(rendering): add override helpers for shared recording contexts
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user