LiteFX 0.4.1.2025
Computer Graphics Engine
Loading...
Searching...
No Matches
LiteFX::Rendering::PushConstantsLayout< TPushConstantsRange > Class Template Referenceabstract

Describes the layout of the pipelines push constant ranges. More...

#include <rendering.hpp>

Inherits LiteFX::Rendering::IPushConstantsLayout.

Public Types

using push_constants_range_type = TPushConstantsRange
 

Public Member Functions

 ~PushConstantsLayout () noexcept override=default
 
virtual const Array< UniquePtr< push_constants_range_type > > & ranges () const =0
 
- Public Member Functions inherited from LiteFX::Rendering::IPushConstantsLayout
virtual ~IPushConstantsLayout () noexcept=default
 
virtual UInt32 size () const noexcept=0
 Returns the size (in bytes) of the push constants backing memory.
 
virtual const IPushConstantsRangerange (ShaderStage stage) const =0
 Returns the push constant range associated with the shader stage provided in stage .
 
Enumerable< const IPushConstantsRange & > ranges () const
 Returns all push constant ranges.
 

Protected Member Functions

 PushConstantsLayout () noexcept=default
 
 PushConstantsLayout (const PushConstantsLayout &)=default
 
 PushConstantsLayout (PushConstantsLayout &&) noexcept=default
 
PushConstantsLayoutoperator= (const PushConstantsLayout &)=default
 
PushConstantsLayoutoperator= (PushConstantsLayout &&) noexcept=default
 
- Protected Member Functions inherited from LiteFX::Rendering::IPushConstantsLayout
 IPushConstantsLayout () noexcept=default
 
 IPushConstantsLayout (const IPushConstantsLayout &)=default
 
 IPushConstantsLayout (IPushConstantsLayout &&) noexcept=default
 
IPushConstantsLayoutoperator= (const IPushConstantsLayout &)=default
 
IPushConstantsLayoutoperator= (IPushConstantsLayout &&) noexcept=default
 

Detailed Description

template<typename TPushConstantsRange>
requires meta::implements<TPushConstantsRange, IPushConstantsRange>
class LiteFX::Rendering::PushConstantsLayout< TPushConstantsRange >

Describes the layout of the pipelines push constant ranges.

Push constants are very efficient, yet quite limited ways of passing per-draw data to shaders. They are mapped directly, so no buffer must be created or transitioned in order to use them. Conceptually a push constant is a single piece of memory that gets transferred to a command buffer directly. Each shader stage has a view into this piece of memory, described by an offset and a size. Since the memory is directly dumped in the command buffer, the backing memory can be incrementally updated and there is no need to store an array of buffers, as long as updates happen sequentially from the same thread. However, there are certain restrictions when using push constants:

  • Only one push constant layout per pipeline layout is supported.
  • A push constant layout may not define a overall memory size larger than 128 bytes. This is a soft restriction that will issue a warning, however it might be supported on some hardware or for some back-ends.
  • The elements and offsets of a push constant memory block must be aligned to 4 bytes.
  • Accordingly, the size of a push constant layout must align to 4 bytes.
  • Only one IPushConstantsRange per shader stage is permitted. Shader stages can be combined together, however in this case, no other ranges must be defined for the stages.

Push constants can be updated by calling CommandBuffer::PushConstants and are visible to subsequent draw calls immediately, until another update is performed or the command buffer is ended.

Template Parameters
TPushConstantsRangeThe type of the push constant range. Must implement IPushConstantsRange.
See also
IPushConstantsRange, DescriptorSetLayout

Member Typedef Documentation

◆ push_constants_range_type

template<typename TPushConstantsRange >
using LiteFX::Rendering::PushConstantsLayout< TPushConstantsRange >::push_constants_range_type = TPushConstantsRange

Constructor & Destructor Documentation

◆ PushConstantsLayout() [1/3]

template<typename TPushConstantsRange >
LiteFX::Rendering::PushConstantsLayout< TPushConstantsRange >::PushConstantsLayout ( )
protecteddefaultnoexcept

◆ PushConstantsLayout() [2/3]

template<typename TPushConstantsRange >
LiteFX::Rendering::PushConstantsLayout< TPushConstantsRange >::PushConstantsLayout ( const PushConstantsLayout< TPushConstantsRange > & )
protecteddefault

◆ PushConstantsLayout() [3/3]

template<typename TPushConstantsRange >
LiteFX::Rendering::PushConstantsLayout< TPushConstantsRange >::PushConstantsLayout ( PushConstantsLayout< TPushConstantsRange > && )
protecteddefaultnoexcept

◆ ~PushConstantsLayout()

template<typename TPushConstantsRange >
LiteFX::Rendering::PushConstantsLayout< TPushConstantsRange >::~PushConstantsLayout ( )
overridedefaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

template<typename TPushConstantsRange >
PushConstantsLayout & LiteFX::Rendering::PushConstantsLayout< TPushConstantsRange >::operator= ( const PushConstantsLayout< TPushConstantsRange > & )
protecteddefault

◆ operator=() [2/2]

template<typename TPushConstantsRange >
PushConstantsLayout & LiteFX::Rendering::PushConstantsLayout< TPushConstantsRange >::operator= ( PushConstantsLayout< TPushConstantsRange > && )
protecteddefaultnoexcept

◆ ranges()

template<typename TPushConstantsRange >
virtual const Array< UniquePtr< push_constants_range_type > > & LiteFX::Rendering::PushConstantsLayout< TPushConstantsRange >::ranges ( ) const
pure virtual