LiteFX 0.4.1.2025
Computer Graphics Engine
Loading...
Searching...
No Matches
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 UInt64 identifier () const noexcept=0
 A unique identifier for the render target.
 
virtual const Stringname () const noexcept=0
 Returns the name of the render target.
 
virtual UInt32 location () const noexcept=0
 Returns the location of the render target output attachment within the fragment shader.
 
virtual RenderTargetType type () const noexcept=0
 Returns the type of the render target.
 
virtual Format format () const noexcept=0
 Returns the internal format of the render target.
 
virtual RenderTargetFlags flags () const noexcept=0
 Returns the flags that control the behavior of the render target.
 
virtual 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.
 
virtual 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.
 
virtual const Vector4fclearValues () const noexcept=0
 Returns the value, the render target is cleared with, if clearBuffer either or clearStencil is specified.
 
virtual bool isVolatile () const noexcept=0
 Returns true, if the target should not be made persistent for access after the render pass has finished.
 
virtual const BlendStateblendState () const noexcept=0
 Returns the render targets blend state.
 

Protected Member Functions

 IRenderTarget () noexcept=default
 
 IRenderTarget (const IRenderTarget &)=default
 
 IRenderTarget (IRenderTarget &&) noexcept=default
 
IRenderTargetoperator= (const IRenderTarget &)=default
 
IRenderTargetoperator= (IRenderTarget &&) noexcept=default
 

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 maps it to an image resource on the FrameBuffer the render pass operates on. The IRenderTarget::identifier is used to associate an image within a frame buffer to a render target.

When using a IRenderPipeline during rendering, a similar lookup is performed to bind frame buffer images to input attachments.

See also
RenderTarget, RenderPass, FrameBuffer, IImage

Constructor & Destructor Documentation

◆ IRenderTarget() [1/3]

LiteFX::Rendering::IRenderTarget::IRenderTarget ( )
protecteddefaultnoexcept

◆ IRenderTarget() [2/3]

LiteFX::Rendering::IRenderTarget::IRenderTarget ( const IRenderTarget & )
protecteddefault

◆ IRenderTarget() [3/3]

LiteFX::Rendering::IRenderTarget::IRenderTarget ( IRenderTarget && )
protecteddefaultnoexcept

◆ ~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 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, flags, RenderTargetFlags

Implemented in LiteFX::Rendering::RenderTarget.

◆ clearStencil()

virtual 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, flags, RenderTargetFlags

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.

◆ flags()

virtual RenderTargetFlags LiteFX::Rendering::IRenderTarget::flags ( ) const
pure virtualnoexcept

Returns the flags that control the behavior of the render target.

Returns
The flags that control the behavior of the render target.

Implemented in LiteFX::Rendering::RenderTarget.

◆ format()

virtual 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.

◆ identifier()

virtual UInt64 LiteFX::Rendering::IRenderTarget::identifier ( ) const
pure virtualnoexcept

A unique identifier for the render target.

Returns
The unique identifier for the render target.

Implemented in LiteFX::Rendering::RenderTarget.

◆ isVolatile()

virtual 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.
See also
flags, RenderTargetFlags

Implemented in LiteFX::Rendering::RenderTarget.

◆ location()

virtual 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.

◆ operator=() [1/2]

IRenderTarget & LiteFX::Rendering::IRenderTarget::operator= ( const IRenderTarget & )
protecteddefault

◆ operator=() [2/2]

IRenderTarget & LiteFX::Rendering::IRenderTarget::operator= ( IRenderTarget && )
protecteddefaultnoexcept

◆ type()

virtual 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.