Add render-graph blackboard for camera frame resources

This commit is contained in:
2026-04-14 16:59:10 +08:00
parent 3e6e997485
commit 4fe456c1a2
8 changed files with 118 additions and 3 deletions

View File

@@ -771,7 +771,10 @@ bool ExecuteRenderGraphPlan(
CameraFrameExecutionState& executionState) {
RenderGraph graph = {};
RenderGraphBuilder graphBuilder(graph);
RenderGraphBlackboard blackboard = {};
RenderGraphImportedTextureRegistry importedTextures = {};
CameraFrameRenderGraphResources& frameResources =
blackboard.Emplace<CameraFrameRenderGraphResources>();
bool stageExecutionSucceeded = true;
RenderGraphTextureHandle mainDirectionalShadowTexture = {};
@@ -896,6 +899,14 @@ bool ExecuteRenderGraphPlan(
shadowState.HasShadowSampling() &&
outputSurface.depthTexture.IsValid()) {
mainDirectionalShadowTexture = outputSurface.depthTexture;
frameResources.mainDirectionalShadow = outputSurface.depthTexture;
}
if (stage == CameraFrameStage::MainScene) {
frameResources.mainSceneColor = GetPrimaryColorTexture(outputSurface);
frameResources.mainSceneDepth = outputSurface.depthTexture;
}
if (stage == CameraFrameStage::ObjectId) {
frameResources.objectIdColor = GetPrimaryColorTexture(outputSurface);
}
const RenderSurface stageSurfaceTemplate = stagePassContext.surface;
const bool hasStageSourceSurface = stagePassContext.sourceSurface != nullptr;
@@ -921,7 +932,8 @@ bool ExecuteRenderGraphPlan(
outputSurface.colorTextures,
outputSurface.depthTexture,
mainDirectionalShadowTexture,
&stageExecutionSucceeded
&stageExecutionSucceeded,
&blackboard
};
if (!executionState.pipeline->RecordMainSceneRenderGraph(mainSceneContext)) {
Debug::Logger::Get().Error(