LiteFX 0.3.1.2022
Computer Graphics Engine
LiteFX::Rendering::IRenderTarget Class Referenceabstract

Represents a render target, i.e. an abstract view of the output of an RenderPass. More...

#include <rendering_api.hpp>

Inherited by LiteFX::Rendering::RenderTarget.

Classes

struct  BlendState
 Describes the blend state of the render target. More...
 

Public Member Functions

virtual ~IRenderTarget () noexcept=default
 
virtual const Stringname () const noexcept=0
 Returns the name of the render target. More...
 
virtual const UInt32location () const noexcept=0
 Returns the location of the render target output attachment within the fragment shader. More...
 
virtual const RenderTargetType & type () const noexcept=0
 Returns the type of the render target. More...
 
virtual const Format & format () const noexcept=0
 Returns the internal format of the render target. More...
 
virtual const bool & clearBuffer () const noexcept=0
 Returns true, if the render target should be cleared, when the render pass is started. If the format is set to a depth format, this clears the depth buffer. Otherwise it clears the color buffer. More...
 
virtual const bool & clearStencil () const noexcept=0
 Returns true, if the render target stencil should be cleared, when the render pass is started. If the format is does not contain a stencil channel, this has no effect. More...
 
virtual const Vector4fclearValues () const noexcept=0
 Returns the value, the render target is cleared with, if clearBuffer either or clearStencil is specified. More...
 
virtual const bool & isVolatile () const noexcept=0
 Returns true, if the target should not be made persistent for access after the render pass has finished. More...
 
virtual const BlendStateblendState () const noexcept=0
 Returns the render targets blend state. More...
 

Detailed Description

Represents a render target, i.e. an abstract view of the output of an RenderPass.

A render target represents one output of a render pass, stored within an IImage. It is contained by a RenderPass, that contains the FrameBuffer, that stores the actual render target image resource.

See also
RenderTarget, RenderPass, FrameBuffer, IImage

Constructor & Destructor Documentation

◆ ~IRenderTarget()

virtual LiteFX::Rendering::IRenderTarget::~IRenderTarget ( )
virtualdefaultnoexcept

Member Function Documentation

◆ blendState()

virtual const BlendState & LiteFX::Rendering::IRenderTarget::blendState ( ) const
pure virtualnoexcept

Returns the render targets blend state.

Returns
The render targets blend state.

Implemented in LiteFX::Rendering::RenderTarget.

◆ clearBuffer()

virtual const bool & LiteFX::Rendering::IRenderTarget::clearBuffer ( ) const
pure virtualnoexcept

Returns true, if the render target should be cleared, when the render pass is started. If the format is set to a depth format, this clears the depth buffer. Otherwise it clears the color buffer.

Returns
true, if the render target should be cleared, when the render pass is started
See also
clearStencil, clearValues

Implemented in LiteFX::Rendering::RenderTarget.

◆ clearStencil()

virtual const bool & LiteFX::Rendering::IRenderTarget::clearStencil ( ) const
pure virtualnoexcept

Returns true, if the render target stencil should be cleared, when the render pass is started. If the format is does not contain a stencil channel, this has no effect.

Returns
true, if the render target stencil should be cleared, when the render pass is started
See also
clearStencil, clearValues

Implemented in LiteFX::Rendering::RenderTarget.

◆ clearValues()

virtual const Vector4f & LiteFX::Rendering::IRenderTarget::clearValues ( ) const
pure virtualnoexcept

Returns the value, the render target is cleared with, if clearBuffer either or clearStencil is specified.

If the format is a color format and clearBuffer is specified, this contains the clear color. However, if the format is a depth/stencil format, the R and G channels contain the depth and stencil value to clear the buffer with. Note that the stencil buffer is only cleared, if clearStencil is specified and vice versa.

Returns
The value, the render target is cleared with, if clearBuffer either or clearStencil is specified.

Implemented in LiteFX::Rendering::RenderTarget.

◆ format()

virtual const Format & LiteFX::Rendering::IRenderTarget::format ( ) const
pure virtualnoexcept

Returns the internal format of the render target.

Returns
The internal format of the render target.

Implemented in LiteFX::Rendering::RenderTarget.

◆ isVolatile()

virtual const bool & LiteFX::Rendering::IRenderTarget::isVolatile ( ) const
pure virtualnoexcept

Returns true, if the target should not be made persistent for access after the render pass has finished.

A render target can be marked as volatile if it does not need to be accessed after the render pass has finished. This can be used to optimize away unnecessary GPU/CPU memory round-trips. For example a depth buffer may only be used as an input for the lighting stage of a deferred renderer, but is not required after this. So instead of reading it from the GPU after the lighting pass has finished and then discarding it anyway, it can be marked as volatile in order to prevent it from being read from the GPU memory again in the first place.

Returns
true, if the target should not be made persistent for access after the render pass has finished.

Implemented in LiteFX::Rendering::RenderTarget.

◆ location()

virtual const UInt32 & LiteFX::Rendering::IRenderTarget::location ( ) const
pure virtualnoexcept

Returns the location of the render target output attachment within the fragment shader.

The locations of all render targets of a frame buffer must be within a continuous domain, starting at 0. A frame buffer validates the render target locations when it is initialized and will raise an exception, if a location is either not mapped or assigned multiple times.

Returns
The location of the render target output attachment within the fragment shader

Implemented in LiteFX::Rendering::RenderTarget.

◆ name()

virtual const String & LiteFX::Rendering::IRenderTarget::name ( ) const
pure virtualnoexcept

Returns the name of the render target.

Returns
The name of the render target.

Implemented in LiteFX::Rendering::RenderTarget.

◆ type()

virtual const RenderTargetType & LiteFX::Rendering::IRenderTarget::type ( ) const
pure virtualnoexcept

Returns the type of the render target.

Returns
The type of the render target.

Implemented in LiteFX::Rendering::RenderTarget.