Lysa  0.0
Lysa 3D Engine
PostProcessing Class Reference

Detailed Description

Base class for post-processing render passes

+ Inheritance diagram for PostProcessing:

Classes

struct  FrameData
 
struct  PostProcessingParams
 

Public Member Functions

 PostProcessing (const RendererConfiguration &config, vireo::ImageFormat outputFormat, const std::string &fragShaderName, void *data=nullptr, uint32 dataSize=0, const std::string &name="")
 
void update (uint32 frameIndex) override
 
virtual void render (vireo::CommandList &commandList, const std::shared_ptr< vireo::RenderTarget > &colorAttachment, const std::shared_ptr< vireo::RenderTarget > &depthAttachment, uint32 frameIndex)
 
virtual void render (vireo::CommandList &commandList, const std::shared_ptr< vireo::RenderTarget > &colorAttachment, uint32 frameIndex)
 
virtual void resize (const vireo::Extent &extent)
 
void resize (const vireo::Extent &extent, const std::shared_ptr< vireo::CommandList > &commandList) override
 
virtual std::shared_ptr< vireo::RenderTarget > getColorAttachment (const uint32 frameIndex)
 
const auto & getFragShaderName () const
 
- Public Member Functions inherited from Renderpass
 Renderpass (const RendererConfiguration &config, const std::string &name)
 
virtual ~Renderpass () = default
 
 Renderpass (Renderpass &) = delete
 
Renderpass & operator= (Renderpass &) = delete
 

Static Public Attributes

static const std::string VERTEX_SHADER {"quad.vert"}
 
static constexpr vireo::DescriptorIndex BINDING_PARAMS {0}
 
static constexpr vireo::DescriptorIndex BINDING_DATA {1}
 
static constexpr vireo::DescriptorIndex BINDING_TEXTURES {2}
 
static constexpr int INPUT_BUFFER {0}
 
static constexpr int DEPTH_BUFFER {1}
 
static constexpr int BLOOM_BUFFER {2}
 
static constexpr int TEXTURES_COUNT {BLOOM_BUFFER+1}
 

Protected Member Functions

virtual void render (vireo::CommandList &commandList, const std::shared_ptr< vireo::RenderTarget > &colorAttachment, const std::shared_ptr< vireo::RenderTarget > &depthAttachment, const std::shared_ptr< vireo::RenderTarget > &bloomColorAttachment, uint32 frameIndex)
 
- Protected Member Functions inherited from Renderpass
std::shared_ptr< vireo::ShaderModule > loadShader (const std::string &shaderName) const
 
void init (vireo::GraphicPipelineConfiguration &pipelineConfig, vireo::RenderingConfiguration &renderingConfig, const std::shared_ptr< vireo::DescriptorLayout > &descriptorLayout, bool withStencil)
 
void init (vireo::GraphicPipelineConfiguration &pipelineConfig, vireo::RenderingConfiguration &renderingConfig, bool withStencil) const
 
void initRendering (vireo::CommandList &commandList, const std::shared_ptr< vireo::Image > &image, const std::shared_ptr< vireo::GraphicPipeline > &pipeline, const std::shared_ptr< vireo::DescriptorSet > &sceneDescriptorSet, const std::shared_ptr< vireo::DescriptorSet > &descriptorSet)
 

Protected Attributes

vireo::GraphicPipelineConfiguration pipelineConfig
 
vireo::RenderingConfiguration renderingConfig
 
const std::string fragShaderName
 
uint8 dummyData {0}
 
void * data {nullptr}
 
std::shared_ptr< vireo::Buffer > dataUniform {nullptr}
 
std::vector< FrameDataframesData
 
std::vector< std::shared_ptr< vireo::Image > > textures
 
std::shared_ptr< vireo::DescriptorLayout > descriptorLayout
 
std::shared_ptr< vireo::GraphicPipeline > pipeline
 
- Protected Attributes inherited from Renderpass
const std::string name
 
const RendererConfigurationconfig
 

Additional Inherited Members

- Static Public Member Functions inherited from Renderpass
static void destroyShaderModules ()
 
- Static Protected Attributes inherited from Renderpass
static std::mutex shaderModulesMutex
 
static std::unordered_map< std::string, std::shared_ptr< vireo::ShaderModule > > shaderModules
 

Constructor & Destructor Documentation

PostProcessing ( const RendererConfiguration config,
vireo::ImageFormat  outputFormat,
const std::string &  fragShaderName,
void *  data = nullptr,
uint32  dataSize = 0,
const std::string &  name = "" 
)

Constructs a PostProcessing render pass

Parameters
configThe renderer configuration
outputFormatFormat of the output image
fragShaderNameName of the fragment shader to use
dataPointer to custom data for the shader
dataSizeSize of the custom data
nameName of the render pass

Member Function Documentation

virtual std::shared_ptr<vireo::RenderTarget> getColorAttachment ( const uint32  frameIndex)
inlinevirtual

Gets the color attachment for a specific frame

Parameters
frameIndexIndex of the frame
Returns
A shared pointer to the render target
const auto& getFragShaderName ( ) const
inline

Gets the name of the fragment shader

Returns
The fragment shader name
virtual void render ( vireo::CommandList &  commandList,
const std::shared_ptr< vireo::RenderTarget > &  colorAttachment,
const std::shared_ptr< vireo::RenderTarget > &  depthAttachment,
const std::shared_ptr< vireo::RenderTarget > &  bloomColorAttachment,
uint32  frameIndex 
)
protectedvirtual

Renders the post-processing effect

Parameters
frameIndexIndex of the current frame
colorAttachmentThe input color attachment
depthAttachmentThe input depth attachment
bloomColorAttachmentThe input bloom color attachment
commandListThe command list to record rendering commands into
virtual void render ( vireo::CommandList &  commandList,
const std::shared_ptr< vireo::RenderTarget > &  colorAttachment,
const std::shared_ptr< vireo::RenderTarget > &  depthAttachment,
uint32  frameIndex 
)
virtual

Renders the post-processing effect

Parameters
frameIndexIndex of the current frame
colorAttachmentThe input color attachment
depthAttachmentThe input depth attachment
commandListThe command list to record rendering commands into

Reimplemented in lysa::BloomPass::render()

virtual void render ( vireo::CommandList &  commandList,
const std::shared_ptr< vireo::RenderTarget > &  colorAttachment,
uint32  frameIndex 
)
virtual

Renders the post-processing effect

Parameters
frameIndexIndex of the current frame
colorAttachmentThe input color attachment
commandListThe command list to record rendering commands into
virtual void resize ( const vireo::Extent &  extent)
virtual

Resizes the render pass resources

Parameters
extentThe new extent

Reimplemented in lysa::BloomPass::resize()

void resize ( const vireo::Extent &  extent,
const std::shared_ptr< vireo::CommandList > &  commandList 
)
inlineoverridevirtual

Recreate pass resources after a resize (default: no-op).

Reimplemented from lysa::Renderpass::resize()

void update ( uint32  frameIndex)
overridevirtual

Update any per-frame state (default: no-op).

Reimplemented from lysa::Renderpass::update()

Member Data Documentation

constexpr vireo::DescriptorIndex BINDING_DATA {1}
staticconstexpr

Descriptor binding index for custom data uniform buffer

constexpr vireo::DescriptorIndex BINDING_PARAMS {0}
staticconstexpr

Descriptor binding index for parameters uniform buffer

constexpr vireo::DescriptorIndex BINDING_TEXTURES {2}
staticconstexpr

Descriptor binding index for input textures

constexpr int BLOOM_BUFFER {2}
staticconstexpr

Index for the bloom buffer texture

void* data {nullptr}
protected
std::shared_ptr<vireo::Buffer> dataUniform {nullptr}
protected
constexpr int DEPTH_BUFFER {1}
staticconstexpr

Index for the depth buffer texture

std::shared_ptr<vireo::DescriptorLayout> descriptorLayout
protected
uint8 dummyData {0}
protected
const std::string fragShaderName
protected
std::vector<FrameData> framesData
protected
constexpr int INPUT_BUFFER {0}
staticconstexpr

Index for the input color buffer texture

std::shared_ptr<vireo::GraphicPipeline> pipeline
protected
vireo::GraphicPipelineConfiguration pipelineConfig
protected
Initial value:
{
.colorBlendDesc = {{}}
}
vireo::RenderingConfiguration renderingConfig
protected
Initial value:
{
.colorRenderTargets = {{}}
}
std::vector<std::shared_ptr<vireo::Image> > textures
protected
constexpr int TEXTURES_COUNT {BLOOM_BUFFER+1}
staticconstexpr

Total number of input textures

const std::string VERTEX_SHADER {"quad.vert"}
inlinestatic

Name of the default vertex shader for post-processing