diff --git a/engine/src/Rendering/SceneRenderFeaturePass.cpp b/engine/src/Rendering/SceneRenderFeaturePass.cpp index 00b00b3f..992b9c47 100644 --- a/engine/src/Rendering/SceneRenderFeaturePass.cpp +++ b/engine/src/Rendering/SceneRenderFeaturePass.cpp @@ -1,5 +1,6 @@ #include "Rendering/SceneRenderFeaturePass.h" +#include #include #include @@ -10,12 +11,6 @@ namespace Rendering { bool SceneRenderFeaturePass::RecordRenderGraph( const SceneRenderFeaturePassRenderGraphContext& context) { const bool usesSourceColor = context.sourceColorTexture.IsValid(); - const bool hasSourceSurfaceTemplate = - context.sourceSurface != nullptr || usesSourceColor; - const RenderSurface sourceSurfaceTemplate = - context.sourceSurface != nullptr - ? *context.sourceSurface - : (usesSourceColor ? context.surface : RenderSurface()); const bool writesColor = std::any_of( context.colorTargets.begin(), @@ -23,6 +18,16 @@ bool SceneRenderFeaturePass::RecordRenderGraph( [](RenderGraphTextureHandle handle) { return handle.IsValid(); }); + RenderGraphRecordingContext recordingContext = + BuildRenderGraphRecordingContext(context); + const RenderSurface sourceSurfaceTemplate = + recordingContext.sourceSurface != nullptr + ? *recordingContext.sourceSurface + : (usesSourceColor ? context.surface : RenderSurface()); + if (recordingContext.sourceSurface == nullptr && usesSourceColor) { + recordingContext.sourceSurface = &sourceSurfaceTemplate; + } + const RenderPassGraphBeginCallback beginPassCallback = context.beginPassCallback ? RenderPassGraphBeginCallback( @@ -32,23 +37,11 @@ bool SceneRenderFeaturePass::RecordRenderGraph( return beginPass(passContext, clearAttachments); }) : RenderPassGraphBeginCallback(); - const RenderPassRenderGraphContext passContext = { - context.graphBuilder, - context.passName, - context.renderContext, - context.sceneData, - context.surface, - hasSourceSurfaceTemplate ? &sourceSurfaceTemplate : nullptr, - context.sourceColorView, - context.sourceColorState, - context.sourceColorTexture, - context.colorTargets, - context.depthTarget, - context.executionSucceeded, - beginPassCallback, - context.endPassCallback, - context.blackboard - }; + const RenderPassRenderGraphContext passContext = + BuildRenderPassRenderGraphContext( + recordingContext, + beginPassCallback, + context.endPassCallback); return RecordRasterRenderPass( *this, passContext,