SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::RenderPass< RenderPipelineType, FrameBufferType, InputAttachmentMappingType > Class Template Referenceabstract

Represents a render pass. More...

#include <RenderPass.h>

Inheritance diagram for spark::render::RenderPass< RenderPipelineType, FrameBufferType, InputAttachmentMappingType >:
spark::render::StateResource spark::render::IRenderPass spark::render::InputAttachmentMappingSource< FrameBufferType > spark::render::IStateResource spark::render::IStateResource

Public Types

using frame_buffer_type = FrameBufferType
 
using render_pipeline_type = RenderPipelineType
 
using input_attachment_mapping_type = InputAttachmentMappingType
 
using pipeline_layout_type = typename render_pipeline_type::pipeline_layout_type
 
using descriptor_set_layout_type = typename pipeline_layout_type::descriptor_set_layout_type
 
using descriptor_set_type = typename descriptor_set_layout_type::descriptor_set_type
 
- Public Types inherited from spark::render::InputAttachmentMappingSource< FrameBufferType >
using FrameBuffer = FrameBufferType
 

Public Member Functions

virtual const frame_buffer_type & activeFrameBuffer () const =0
 Gets the active frame buffer from the render pass.
 
virtual std::vector< const frame_buffer_type * > frameBuffers () const noexcept=0
 Gets all frame buffers owned by the render pass.
 
virtual std::vector< const render_pipeline_type * > pipelines () const noexcept=0
 Gets all render pipelines owned by the render pass.
 
virtual std::span< const input_attachment_mapping_type > inputAttachments () const noexcept=0
 Gets the input attachments the render pass is consuming.
 
virtual void updateAttachments (const descriptor_set_type &descriptor_set) const =0
 Resolves the input attachments mapped to the render pass and updates them on the descriptor set provided with descriptor_set.
 
- Public Member Functions inherited from spark::render::StateResource
 StateResource (std::string_view name) noexcept
 Initializes a new StateResource instance.
 
 StateResource (const StateResource &other)=delete
 
 StateResource (StateResource &&other) noexcept
 
StateResourceoperator= (const StateResource &other)=delete
 
StateResourceoperator= (StateResource &&other) noexcept
 
const std::string & name () const noexcept final
 Gets the name of the state resource.
 
- Public Member Functions inherited from spark::render::IRenderPass
virtual void begin (unsigned int buffer)=0
 Begins the render pass.
 
virtual void end () const =0
 Ends the render pass.
 
const IFrameBufferactiveFrameBuffer () const
 Gets the active frame buffer from the render pass.
 
std::vector< const IFrameBuffer * > frameBuffers () const noexcept
 Gets all frame buffers owned by the render pass.
 
virtual void resizeFrameBuffers (const math::Vector2< unsigned int > &new_render_area)=0
 Resets the frame buffers owned by the render pass.
 
std::vector< const IRenderPipeline * > pipelines () const noexcept
 Gets all render pipelines owned by the render pass.
 
virtual const RenderTargetrenderTarget (unsigned int location) const =0
 Gets the render target at the specified location.
 
virtual std::span< const RenderTargetrenderTargets () const noexcept=0
 Gets all render targets the render pass is rendering to.
 
virtual bool hasPresentRenderTarget () const noexcept=0
 Checks if one of the render targets is used for presentation in a ISwapChain.
 
virtual MultiSamplingLevel multiSamplingLevel () const noexcept=0
 Gets the number of samples the render targets are sampled with.
 
void updateAttachments (const IDescriptorSet &descriptor_set) const
 Resolves the input attachments mapped to the render pass and updates them on the descriptor set provided with descriptor_set.
 
- Public Member Functions inherited from spark::render::InputAttachmentMappingSource< FrameBufferType >
virtual const FrameBufferType & frameBuffer (unsigned buffer) const =0
 Gets the frame buffer with the index provided in buffer.
 

Additional Inherited Members

- Protected Member Functions inherited from spark::render::StateResource
 StateResource () noexcept
 Initializes a new StateResource instance with an empty name.
 
std::string & name () noexcept
 Gets the name of the state resource.
 

Detailed Description

template<typename RenderPipelineType, typename FrameBufferType, typename InputAttachmentMappingType>
class spark::render::RenderPass< RenderPipelineType, FrameBufferType, InputAttachmentMappingType >

Represents a render pass.

Template Parameters
RenderPipelineTypeType of the render pipeline. (inherits from IRenderPipeline)
FrameBufferTypeType of the frame buffer. (inherits from IFrameBuffer)
InputAttachmentMappingTypeType of the input attachment mapping. (inherits from IInputAttachmentMapping)

A render pass is a conceptual layer, that may not have any logical representation within the actual implementation. It is a high-level view on a specific workload on the GPU, that processes data using different IRenderPipeline and stores the outputs in the IRenderTarget of a IFrameBuffer.

Member Function Documentation

◆ activeFrameBuffer()

template<typename RenderPipelineType , typename FrameBufferType , typename InputAttachmentMappingType >
virtual const frame_buffer_type & spark::render::RenderPass< RenderPipelineType, FrameBufferType, InputAttachmentMappingType >::activeFrameBuffer ( ) const
nodiscardpure virtual

Gets the active frame buffer from the render pass.

Returns
A IFrameBuffer used as back buffer by the render pass.
Exceptions
k2::base::RenderPassNotStartedExceptionif the render pass has not been started.

Implemented in spark::render::vk::VulkanRenderPass.

◆ frameBuffers()

template<typename RenderPipelineType , typename FrameBufferType , typename InputAttachmentMappingType >
virtual std::vector< const frame_buffer_type * > spark::render::RenderPass< RenderPipelineType, FrameBufferType, InputAttachmentMappingType >::frameBuffers ( ) const
nodiscardpure virtualnoexcept

Gets all frame buffers owned by the render pass.

Returns
A std::vector of IFrameBuffer owned by the render pass.

Implemented in spark::render::vk::VulkanRenderPass.

◆ inputAttachments()

template<typename RenderPipelineType , typename FrameBufferType , typename InputAttachmentMappingType >
virtual std::span< const input_attachment_mapping_type > spark::render::RenderPass< RenderPipelineType, FrameBufferType, InputAttachmentMappingType >::inputAttachments ( ) const
nodiscardpure virtualnoexcept

Gets the input attachments the render pass is consuming.

Returns
A std::span of IInputAttachmentMapping the render pass is consuming.

Implemented in spark::render::vk::VulkanRenderPass.

◆ pipelines()

template<typename RenderPipelineType , typename FrameBufferType , typename InputAttachmentMappingType >
virtual std::vector< const render_pipeline_type * > spark::render::RenderPass< RenderPipelineType, FrameBufferType, InputAttachmentMappingType >::pipelines ( ) const
nodiscardpure virtualnoexcept

Gets all render pipelines owned by the render pass.

Returns
A std::vector of IRenderPipeline owned by the render pass.

Implemented in spark::render::vk::VulkanRenderPass.

◆ updateAttachments()

template<typename RenderPipelineType , typename FrameBufferType , typename InputAttachmentMappingType >
virtual void spark::render::RenderPass< RenderPipelineType, FrameBufferType, InputAttachmentMappingType >::updateAttachments ( const descriptor_set_type & descriptor_set) const
pure virtual

Resolves the input attachments mapped to the render pass and updates them on the descriptor set provided with descriptor_set.

Parameters
descriptor_setThe IDescriptorSet to update the input attachments on.