SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::IFrameBuffer Class Referenceabstract

Interface for a frame buffer. More...

#include <FrameBuffer.h>

Inheritance diagram for spark::render::IFrameBuffer:
spark::render::FrameBuffer< VulkanCommandBuffer > spark::render::FrameBuffer< CommandBufferType > spark::render::vk::VulkanFrameBuffer

Public Member Functions

virtual unsigned int bufferIndex () const noexcept=0
 Gets the index of the frame buffer within the IRenderPass.
 
virtual spark::math::Vector2< unsigned > size () const noexcept=0
 Gets the current size of the frame buffer.
 
std::vector< std::shared_ptr< const ICommandBuffer > > commandBuffers () const noexcept
 Gets all command buffers of the frame buffer.
 
std::shared_ptr< const ICommandBuffercommandBuffer (unsigned int index) const
 Gets the command buffer that records draw commands for the frame buffer.
 
std::vector< const IImage * > images () const noexcept
 Gets all images storing the output attachments for the render targets of the IRenderPass.
 
const IImageimage (unsigned int location) const
 Gets the image storing the output attachment for the render target mapped at given location.
 
virtual void resize (const spark::math::Vector2< unsigned > &render_area)=0
 Invalidate and resize the frame buffer with given render_area.
 

Detailed Description

Interface for a frame buffer.

Member Function Documentation

◆ bufferIndex()

virtual unsigned int spark::render::IFrameBuffer::bufferIndex ( ) const
nodiscardpure virtualnoexcept

Gets the index of the frame buffer within the IRenderPass.

Returns
The index of the frame buffer within the IRenderPass.

A render pass stores multiple frame buffers, each with their own index. Calling IRenderPass::frameBuffer() with this index on the frame buffers render pass returns the current frame buffer instance (i.e. the same instance, as the one, the index has been requested from).

Implemented in spark::render::vk::VulkanFrameBuffer.

◆ commandBuffer()

std::shared_ptr< const ICommandBuffer > spark::render::IFrameBuffer::commandBuffer ( unsigned int index) const
inlinenodiscard

Gets the command buffer that records draw commands for the frame buffer.

Parameters
indexThe index of the command buffer to get.
Returns
A std::shared_ptr to the command buffer at index.
Exceptions
spark::base::ArgumentOutOfRangeExceptionif the frame buffer does not have a command buffer at given index.

◆ commandBuffers()

std::vector< std::shared_ptr< const ICommandBuffer > > spark::render::IFrameBuffer::commandBuffers ( ) const
inlinenodiscardnoexcept

Gets all command buffers of the frame buffer.

Returns
A std::vector containing a std::shared_ptr to each command buffer of the frame buffer.

◆ image()

const IImage & spark::render::IFrameBuffer::image ( unsigned int location) const
inlinenodiscard

Gets the image storing the output attachment for the render target mapped at given location.

Parameters
locationThe location of the render target to get the image for.
Returns
A std::shared_ptr to the image storing the output attachment for the render target mapped at given location.

◆ images()

std::vector< const IImage * > spark::render::IFrameBuffer::images ( ) const
inlinenodiscardnoexcept

Gets all images storing the output attachments for the render targets of the IRenderPass.

Returns
A std::vector containing each image of the frame buffer.

◆ resize()

virtual void spark::render::IFrameBuffer::resize ( const spark::math::Vector2< unsigned > & render_area)
pure virtual

Invalidate and resize the frame buffer with given render_area.

Parameters
render_areaThe new size of the frame buffer.

A frame buffer resize causes all render target resources (i.e. images) to be re-created. This is done by the implementation itself, except for present targets, which require a view of an image created on a ISwapChain. If the frame buffer has a present target, it calls ISwapChain::images() on the parent devices' swap chain.

Warning
There should only be one render pass, that contains present targets, otherwise the images are written by different render passes, which may result in undefined behavior.

Implemented in spark::render::vk::VulkanFrameBuffer.

◆ size()

virtual spark::math::Vector2< unsigned > spark::render::IFrameBuffer::size ( ) const
nodiscardpure virtualnoexcept

Gets the current size of the frame buffer.

Returns
A spark::math::Vector2 containing the current size of the frame buffer.

Implemented in spark::render::vk::VulkanFrameBuffer.