External Render Target Resources in Framegraph Pipelines¶
Problem¶
Framegraph pipeline output is currently represented by special resource names such as OUTPUT and DISPLAY.
Runtime execution treats those names as external render target textures, but graph analysis and FBO introspection can
still treat them as ordinary internal framegraph resources. This allows invalid aliases such as:
OUTPUT == fbo_1
The intended relationship is different:
RT_COLOR == current RenderTarget.color texture
RT_DEPTH == current RenderTarget.depth texture
Internal FBOs keep their own allocation and format. External render target textures are provided by the render target that executes the pipeline.
Target Model¶
Render target textures enter the graph explicitly as external resources:
RenderTargetInput.color -> RT_COLOR
RenderTargetInput.depth -> RT_DEPTH
The final output node only marks pipeline completion:
PipelineOutput.color <- some resource
PipelineOutput.depth <- some resource
PipelineOutput does not allocate textures, copy/blit data, or rewrite resource names. If a copy into the render
target is needed, the pipeline author adds an explicit pass:
fbo_1 -> BlitPass(input_res=fbo_1, output_res=RT_COLOR)
RT_COLOR -> PipelineOutput.color
If a pass can write directly to the render target texture, it uses RT_COLOR as its output:
RT_COLOR -> InplacePass(input_res=RT_COLOR, output_res=RT_COLOR)
RT_COLOR -> PipelineOutput.color
Rules¶
RT_COLORandRT_DEPTHare external resources bound to the current render target.- External resources are not allocated by
FBOPool. - Internal resources may alias other internal resources.
- External resources must not be canonicalized to internal FBOs.
- No implicit blit is inserted by the compiler.
- Blits/copies into render target textures are explicit graph passes.
- Framegraph Debugger must show the actual runtime texture behind an external resource.
- Legacy
OUTPUT/DISPLAYmay remain as compatibility aliases during migration, but new graph authoring should use explicit external resources.
Migration Plan¶
- Add compiler/runtime support for external resource names:
RT_COLORRT_DEPTH- temporary compatibility:
OUTPUT,DISPLAY - Add graph nodes:
RenderTargetInputwith outputscolor,depthPipelineOutputwith inputscolor,depth- Update graph compiler:
- register
RenderTargetInputoutputs as external resources - stop rewriting upstream pass outputs to
OUTPUT - make
PipelineOutputa validation/completion marker only - keep legacy output-node handling behind compatibility logic
- Update
RenderEngine: - map external color resources to
ViewportContext.output_color_tex - map external depth resources to
ViewportContext.output_depth_tex - skip
FBOPoolallocation for external resources - Update Framegraph Debugger:
- list external resources as resources
- show real runtime texture info for external resources
- keep internal FBO info from
FBOPool - Rewrite built-in pipelines:
- Default pipeline
- Editor pipeline
- Migrate saved
.pipelinegraph files: - old
RenderTargetoutput nodes becomePipelineOutput - add
RenderTargetInput - insert explicit blit/copy pass when old graph expected an implicit final write
- Add tests:
- compiler does not alias external resources to internal FBOs
- external resources are not allocated by
FBOPool - debugger reports external resource format from the actual render target texture
- Default and Editor pipelines finish through explicit external resources
First Vertical Slice¶
Implement external resources in compiler/runtime while preserving legacy names:
RT_COLOR -> output_color_tex
RT_DEPTH -> output_depth_tex
OUTPUT -> output_color_tex (legacy)
DISPLAY -> output_color_tex (legacy)
Then migrate FovPipeline.pipeline to use explicit render-target input/output nodes and verify:
fbo_1: r32f
RT_COLOR: rgba16f
RT_DEPTH: depth32f
Progress¶
- Done: compiler parses
render_target_inputandpipeline_outputgraph-boundary nodes. - Done:
RenderTargetInput.colorresolves to externalRT_COLOR;RenderTargetInput.depthresolves to externalRT_DEPTH. - Done: runtime skips
FBOPoolallocation forRT_COLOR/RT_DEPTHand binds them to the current render target textures. - Done: tcgui pipeline editor can load, save, and create explicit render target input/output nodes.
- Done: Framegraph Debugger queries actual render target texture info for
OUTPUT,DISPLAY,RT_COLOR, andRT_DEPTHbefore consulting internal FBO aliases. - Done: graph compiler initializes the C++ inspect dispatcher before applying socket/param fields, so compiled passes
receive
input_res/output_resinstead of keeping constructor defaults. - Done:
/home/mirmik/project/chronosquad-termin/Assets/Pipelines/FovPipeline.pipelinemigrated toRenderTargetInput+PipelineOutput;DepthPass.output_resresolves toRT_COLOR, while the internal FBO remainsfbo_1. - Still pending: rewrite built-in Default/Editor pipelines to the explicit input/output model.
- Still pending: migrate remaining project pipeline assets.