![]() |
Lysa
0.0
Lysa 3D Engine
|
High-level scene renderer.
Owns and manages the set of render passes required by a rendering path (depth pre-pass, opaque/transparent color, shader-material passes, post-processing). Allocates per-frame color/depth attachments and exposes them to callers. Updates and rebuilds graphics pipelines when the set of materials changes.
Inheritance diagram for Renderer:Classes | |
| struct | FrameData |
Public Member Functions | |
| virtual std::shared_ptr< vireo::RenderTarget > | getColorRenderTarget (const uint32 frameIndex) const |
| auto | getColorAttachment (const uint32 frameIndex) const |
| auto | getDepthAttachment (const uint32 frameIndex) const |
| std::shared_ptr< vireo::Image > | getCurrentColorAttachment (uint32 frameIndex) const |
| virtual std::shared_ptr< vireo::Image > | getBrightnessAttachment (uint32 frameIndex) const = 0 |
| virtual void | resize (const vireo::Extent &extent, const std::shared_ptr< vireo::CommandList > &commandList) |
| void | updatePipelines (const SceneFrameData &scene) |
| virtual void | updatePipelines (const std::unordered_map< pipeline_id, std::vector< unique_id >> &pipelineIds) |
| virtual void | update (uint32 frameIndex) |
| void | prepare (const std::shared_ptr< vireo::CommandList > &commandList, const SceneFrameData &scene, const vireo::Viewport &viewport, const vireo::Rect &scissors, uint32 frameIndex) |
| void | render (const std::shared_ptr< vireo::CommandList > &commandList, const SceneFrameData &scene, const vireo::Viewport &viewport, const vireo::Rect &scissors, bool clearAttachment, uint32 frameIndex) |
| std::shared_ptr< vireo::Image > | postprocessBloom (const std::shared_ptr< vireo::CommandList > &commandList, uint32 frameIndex) const |
| std::shared_ptr< vireo::Image > | postprocess (const std::shared_ptr< vireo::CommandList > &commandList, const std::shared_ptr< vireo::Image > &colorAttachment, uint32 frameIndex) |
| std::shared_ptr< vireo::Image > | postprocessAA (const std::shared_ptr< vireo::CommandList > &commandList, const std::shared_ptr< vireo::Image > &colorAttachment, uint32 frameIndex) const |
| void | renderCustomRenderPasses (const std::shared_ptr< vireo::CommandList > &commandList, const SceneFrameData &scene, RenderingPhase stage, uint32 frameIndex) |
| void | addPostprocessing (FullScreenCompute &postProcessingPass) |
| void | removePostprocessing (const std::string &fragShaderName) |
| void | removePostprocessing (const FullScreenCompute &postProcessingPass) |
| void | addRenderPass (RenderingPhase phase, CustomRenderpass &pass) |
| void | removeRenderPass (RenderingPhase phase, const CustomRenderpass &pass) |
| TransparencyPass & | getTransparencyPass () |
| FXAAPass & | getFXAAPass () const |
| SMAAPass & | getSMAAPass () const |
| BloomPass & | getBloomPass () const |
| GammaCorrectionPass & | getGammaCorrectionPass () const |
| vireo::ImageFormat | getOutputFormat () const |
| const auto & | getExtent () const |
| virtual | ~Renderer () = default |
| Renderer (Renderer &) = delete | |
| Renderer & | operator= (Renderer &) = delete |
Static Public Member Functions | |
| static std::unique_ptr< Renderer > | create (const RendererConfiguration &config, vireo::ImageFormat outputFormat) |
Protected Member Functions | |
| Renderer (const RendererConfiguration &config, vireo::ImageFormat outputFormat) | |
| virtual void | colorPass (const std::shared_ptr< vireo::CommandList > &commandList, const SceneFrameData &scene, const vireo::Viewport &viewport, const vireo::Rect &scissors, bool clearAttachment, uint32 frameIndex) = 0 |
Protected Attributes | |
| const bool | withStencil |
| True if stencil testing must be enabled. More... | |
| const RendererConfiguration | config |
| Global rendering configuration. More... | |
| vireo::ImageFormat | outputFormat |
| Final output format after the gamma/tonemapping pass. More... | |
| std::vector< FrameData > | framesData |
| Per-frame attachment data, one entry per frame in flight. More... | |
| DepthPrepass | depthPrePass |
| Depth-only pre-pass shared by forward and deferred renderers. More... | |
|
virtualdefault |
|
delete |
|
protected |
Constructs the base renderer, allocating per-frame attachments.
| config | Rendering configuration. |
| outputFormat | Color format of the final output attachment. |
| void addPostprocessing | ( | FullScreenCompute & | postProcessingPass | ) |
Adds a full-screen compute post-processing pass to the pipeline. The pass is inserted after the color and bloom passes, but before the AA pass. The caller retains ownership; the pass must outlive the Renderer.
| postProcessingPass | The compute pass to add. |
| void addRenderPass | ( | RenderingPhase | phase, |
| CustomRenderpass & | pass | ||
| ) |
Registers a custom render pass to be executed at the given RenderingPhase, after the built-in ShaderMaterialPass for that phase. The caller retains ownership; the pass must outlive the Renderer.
| phase | The RenderingPhase slot to attach to. |
| pass | The custom pass to register. |
|
protectedpure virtual |
Records the pipeline-specific color pass for the concrete renderer. Implementations dispatch scene draws into colorAttachment and depthAttachment.
| commandList | Command list to record into. |
| scene | Per-frame scene data. |
| viewport | Viewport rectangle for this frame. |
| scissors | Scissor rectangle for this frame. |
| clearAttachment | If true, the color attachment is cleared before rendering. |
| frameIndex | Index of the frame in flight. |
Implemented in lysa::DeferredRenderer::colorPass(), lysa::ForwardRenderer::colorPass()
|
static |
Factory method: creates a concrete Renderer (forward or deferred) from configuration.
| config | Rendering configuration (attachments, frames in flight, feature flags). |
| outputFormat | Color format of the final output attachment after tonemapping. |
|
inline |
Returns the bloom post-processing pass.
|
pure virtual |
Returns the brightness buffer used as input for the bloom extraction pass.
| frameIndex | Index of the frame in flight. |
Implemented in lysa::DeferredRenderer::getBrightnessAttachment(), lysa::ForwardRenderer::getBrightnessAttachment()
|
inline |
Returns the raw color image attachment for a given frame.
| frameIndex | Index of the frame in flight. |
|
inlinevirtual |
Returns the color render target for a given frame. Overridden by subclasses that apply a TAA or sharpening pass as the final step.
| frameIndex | Index of the frame in flight. |
Reimplemented in lysa::DeferredRenderer::getColorRenderTarget()
| std::shared_ptr<vireo::Image> getCurrentColorAttachment | ( | uint32 | frameIndex | ) | const |
Returns the color attachment that will be consumed by the next post-processing step. This may differ from the raw color attachment when a TAA or sharpening pass is active.
| frameIndex | Index of the frame in flight. |
|
inline |
Returns the depth render target for a given frame.
| frameIndex | Index of the frame in flight. |
|
inline |
Returns the current rendering extent (swap chain extent or configured rendering resolution).
|
inline |
Returns the gamma correction post-processing pass.
|
inline |
Returns the final output format, used after the tonemapping pass.
|
inline |
Returns the transparency (order-independent blending) pass.
|
delete |
| std::shared_ptr<vireo::Image> postprocess | ( | const std::shared_ptr< vireo::CommandList > & | commandList, |
| const std::shared_ptr< vireo::Image > & | colorAttachment, | ||
| uint32 | frameIndex | ||
| ) |
Applies the full post-processing chain, including tonemapping and gamma correction.
| commandList | Command list to record into. |
| colorAttachment | Input color image to process. |
| frameIndex | Index of the frame in flight. |
| std::shared_ptr<vireo::Image> postprocessAA | ( | const std::shared_ptr< vireo::CommandList > & | commandList, |
| const std::shared_ptr< vireo::Image > & | colorAttachment, | ||
| uint32 | frameIndex | ||
| ) | const |
| std::shared_ptr<vireo::Image> postprocessBloom | ( | const std::shared_ptr< vireo::CommandList > & | commandList, |
| uint32 | frameIndex | ||
| ) | const |
Applies the bloom pass to the current color attachment.
| commandList | Command list to record into. |
| frameIndex | Index of the frame in flight. |
| void prepare | ( | const std::shared_ptr< vireo::CommandList > & | commandList, |
| const SceneFrameData & | scene, | ||
| const vireo::Viewport & | viewport, | ||
| const vireo::Rect & | scissors, | ||
| uint32 | frameIndex | ||
| ) |
Pre-render stage: uploads scene data, performs layout transitions, records the depth pre-pass, and renders shadow maps.
| commandList | Command list to record into. |
| scene | Per-frame scene data (transforms, lights, camera). |
| viewport | Viewport rectangle for this frame. |
| scissors | Scissor rectangle for this frame. |
| frameIndex | Index of the frame in flight. |
|
inline |
Removes a previously added post-processing pass. A pass not found is silently ignored.
| postProcessingPass | The pass to remove. |
| void removePostprocessing | ( | const std::string & | fragShaderName | ) |
Removes a previously added post-processing pass identified by its compute shader name. A pass not found is silently ignored.
| fragShaderName | The compute shader name used to identify the pass. |
| void removeRenderPass | ( | RenderingPhase | phase, |
| const CustomRenderpass & | pass | ||
| ) |
Removes a previously registered custom render pass from the given phase. A pass not registered for that phase is silently ignored.
| phase | The RenderingPhase slot to detach from. |
| pass | The custom pass to remove. |
| void render | ( | const std::shared_ptr< vireo::CommandList > & | commandList, |
| const SceneFrameData & | scene, | ||
| const vireo::Viewport & | viewport, | ||
| const vireo::Rect & | scissors, | ||
| bool | clearAttachment, | ||
| uint32 | frameIndex | ||
| ) |
Main render stage: records opaque and transparent draw calls.
| commandList | Command list to record into. |
| scene | Per-frame scene data (transforms, lights, camera). |
| viewport | Viewport rectangle for this frame. |
| scissors | Scissor rectangle for this frame. |
| clearAttachment | If true, the color attachment is cleared before rendering. |
| frameIndex | Index of the frame in flight. |
| void renderCustomRenderPasses | ( | const std::shared_ptr< vireo::CommandList > & | commandList, |
| const SceneFrameData & | scene, | ||
| RenderingPhase | stage, | ||
| uint32 | frameIndex | ||
| ) |
Executes all custom render passes registered for the given pipeline stage.
| commandList | Command list to record into. |
| scene | Per-frame scene data. |
| stage | The RenderingPhase whose custom passes should be executed. |
| frameIndex | Index of the frame in flight. |
|
virtual |
Recreates attachments and pipelines after a render target resize.
| extent | New swap chain extent. |
| commandList | Command list used for any required layout transitions or copies. |
Reimplemented in lysa::DeferredRenderer::resize(), lysa::ForwardRenderer::resize()
|
virtual |
Performs per-frame housekeeping such as pass-local data uploads.
| frameIndex | Index of the frame in flight. |
Reimplemented in lysa::ForwardRenderer::update(), lysa::DeferredRenderer::update()
| void updatePipelines | ( | const SceneFrameData & | scene | ) |
Updates graphics pipelines according to the Scene material mapping. Convenience overload that pulls the mapping from the provided SceneFrameData.
| scene | Current frame scene data containing the pipeline-to-material mapping. |
|
virtual |
Updates graphics pipelines according to the provided materials mapping.
| pipelineIds | Map of pipeline family id to the list of material unique ids. |
Reimplemented in lysa::DeferredRenderer::updatePipelines(), lysa::ForwardRenderer::updatePipelines()
|
protected |
Global rendering configuration.
|
protected |
Depth-only pre-pass shared by forward and deferred renderers.
|
protected |
Per-frame attachment data, one entry per frame in flight.
|
protected |
Final output format after the gamma/tonemapping pass.
|
protected |
True if stencil testing must be enabled.