CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::GPUResourceSetBindings Class Reference

#include <CeresEngine/RenderAPI/GPUResourceSet.hpp>

Inheritance diagram for CeresEngine::GPUResourceSetBindings:
CeresEngine::BasicIndexedMultimap< Key, Value, Container > CeresEngine::GPUShaderResourceSetBindings

Public Member Functions

 GPUResourceSetBindings ()=default
 
 GPUResourceSetBindings (InitializerList< Pair< UInt32, Variant< GPUResourceBinding, InitializerList< GPUResourceBinding > > > > initializer)
 Initializes a new GPUResourceSetBindings object with one or more bindings per slot.
 
const GPUResourceBindingget (const UInt32 slot, const UInt32 index=0) const
 Gets a GPUResourceBinding by it's reflection slot and index.
 
GPUResourceBindingget (const UInt32 slot, const UInt32 index=0)
 Gets a GPUResourceBinding by it's reflection slot and index.
 
GPUResourceBindingset (const UInt32 slot, const UInt32 index, GPUResourceBinding binding)
 Sets the GPUResourceBinding for the given binding slot and index.
 
GPUResourceBindingset (UInt32 slot, GPUResourceBinding binding)
 Sets the GPUResourceBinding for the given binding slot and index.
 
UInt32 add (const UInt32 slot, GPUResourceBinding binding)
 Adds a new GPUResourceBinding for the given binding slot.
 
void remove (const UInt32 slot, const UInt32 index)
 Removes a GPUResourceBinding for the given binding slot and index.
 
void remove (UInt32 slot)
 Removes a GPUResourceBinding for the given binding slot.
 
UInt32 size (const UInt32 slot) const
 Gets the number of GPUResourceBinding by on the given slot.
 
UInt32 size () const
 Gets the total number of GPUResourceBinding on the bindings object.
 
GPUResourceSetBindingSlot operator[] (UInt32 slot)
 Helper method to have expressive access of the resource bindings.
 
GPUResourceSetConstBindingSlot operator[] (UInt32 slot) const
 Helper method to have expressive access of the resource bindings.
 
Generator< Pair< Pair< UInt32, UInt32 >, GPUResourceBinding & > > forEach ()
 Iterates over each of the entries in the GPUResourceSetBindings.
 
Generator< Pair< Pair< UInt32, UInt32 >, const GPUResourceBinding & > > forEach () const
 Iterates over each of the entries in the GPUResourceSetBindings.
 
GPUResourceSetDescriptor createDescriptor () const &
 
GPUResourceSetDescriptor createDescriptor () &&
 
void reserve (size_type newCapacity)
 Tries to increase capacity by allocating additional memory.
 
template<typename K = Key>
void resize (const K &key, size_type newSize, const Value &value=Value())
 Resizes the container and ensures that there are exactly newSize items on the given key.
 
template<typename K = Key>
void clear (const K &key)
 Clears all values of the given key.
 

Private Types

using super = SmallFlatIndexedMultimap< UInt32, GPUResourceBinding, kGPUResourceSetBindingsSmallSize >
 
- Private Types inherited from CeresEngine::BasicIndexedMultimap< Key, Value, Container >
using key_type = typename super::key_type
 
using mapped_type = typename super::mapped_type
 
using value_type = typename super::value_type
 
using size_type = typename super::size_type
 
using difference_type = typename super::difference_type
 
using key_compare = typename super::key_compare
 
using allocator_type = typename super::allocator_type
 
using reference = typename super::reference
 
using const_reference = typename super::const_reference
 
using pointer = typename super::pointer
 
using const_pointer = typename super::const_pointer
 
using iterator = typename super::iterator
 
using const_iterator = typename super::const_iterator
 
using reverse_iterator = typename super::reverse_iterator
 
using const_reverse_iterator = typename super::const_reverse_iterator
 

Additional Inherited Members

- Private Member Functions inherited from CeresEngine::BasicIndexedMultimap< Key, Value, Container >
auto keys () const
 Gets a range that iterates over all the keys on the map.
 
template<typename K = Key>
auto values (const K &key) const
 Gets a range that iterates over all values of the given key.
 
template<typename K = Key>
auto values (const Key &key)
 Gets a range that iterates over all values of the given key.
 
template<typename K = Key>
mapped_typeat (const K &key, size_t index)
 Gets the index-th value for the given key.
 
template<typename K = Key>
const mapped_typeat (const K &key, size_t index) const
 Gets the index-th value for the given key.
 
template<typename K = Key>
bool contains (const K &key, size_t index) const
 Returns true if the container contains an element at index with key equivalent to key, otherwise returns false.
 
void reserve (size_type newCapacity)
 Tries to increase capacity by allocating additional memory.
 
void shrink_to_fit ()
 Tries to reduce memory usage by freeing unused memory.
 
template<typename K = Key>
void resize (const K &key, size_type newSize, const Value &value=Value())
 Resizes the container and ensures that there are exactly newSize items on the given key.
 
template<typename K = Key>
void clear (const K &key)
 Clears all values of the given key.
 
size_type capacity () const
 Returns the number of elements that the container has currently allocated space for.
 
template<typename K = Key>
size_type size (const K &key) const
 Computes the number of elements for the given key.
 
template<typename K = Key>
iterator erase (const K &key, size_type index) const
 Erases the element at the given index for the given key.
 
template<typename K = Key, typename... Args>
mapped_typeemplace_back (const K &key, Args &&... args)
 Emplaces a new element for key at the end of container.
 
template<typename K = Key>
mapped_typepush_back (const K &key, const Value &value)
 Pushes a new element for key at the end of container.
 
template<typename K = Key>
mapped_typepush_back (const K &key, Value &&value)
 Pushes a new element for key at the end of container.
 
template<typename K = Key>
const mapped_typeoperator() (const K &key, size_type index) const
 
template<typename K = Key>
mapped_typeoperator() (const K &key, size_type index)
 
- Static Private Attributes inherited from CeresEngine::BasicIndexedMultimap< Key, Value, Container >
static constexpr bool has_reserve = requires(super & container) { container.reserve(size_type()); }
 Determines if the container has the reserve() method available.
 
static constexpr bool has_shrink_to_fit = requires(super & container) { container.shrink_to_fit(); }
 Determines if the container has the shrink_to_fit() method available.
 
static constexpr bool has_capacity
 Determines if the container has the capacity() method available.
 

Member Typedef Documentation

◆ super

Constructor & Destructor Documentation

◆ GPUResourceSetBindings() [1/2]

CeresEngine::GPUResourceSetBindings::GPUResourceSetBindings ( )
default

◆ GPUResourceSetBindings() [2/2]

CeresEngine::GPUResourceSetBindings::GPUResourceSetBindings ( InitializerList< Pair< UInt32, Variant< GPUResourceBinding, InitializerList< GPUResourceBinding > > > >  initializer)

Initializes a new GPUResourceSetBindings object with one or more bindings per slot.

Member Function Documentation

◆ add()

UInt32 CeresEngine::GPUResourceSetBindings::add ( const UInt32  slot,
GPUResourceBinding  binding 
)
inline

Adds a new GPUResourceBinding for the given binding slot.

Note
This method will append a new entry to the end of the binding array.
Parameters
slotThe slot of the binding to be set.
bindingThe value to set the binding to.
Returns
The index of the newly bound array entry.

◆ clear()

template<typename K = Key>
void CeresEngine::BasicIndexedMultimap< Key, Value, Container >::clear ( const K key)
inline

Clears all values of the given key.

◆ createDescriptor() [1/2]

GPUResourceSetDescriptor CeresEngine::GPUResourceSetBindings::createDescriptor ( ) &&

◆ createDescriptor() [2/2]

GPUResourceSetDescriptor CeresEngine::GPUResourceSetBindings::createDescriptor ( ) const &

◆ forEach() [1/2]

Generator< Pair< Pair< UInt32, UInt32 >, GPUResourceBinding & > > CeresEngine::GPUResourceSetBindings::forEach ( )

Iterates over each of the entries in the GPUResourceSetBindings.

Note
Bindings to the null slot (~0u) are ignored.

◆ forEach() [2/2]

Generator< Pair< Pair< UInt32, UInt32 >, const GPUResourceBinding & > > CeresEngine::GPUResourceSetBindings::forEach ( ) const

Iterates over each of the entries in the GPUResourceSetBindings.

Note
Bindings to the null slot (~0u) are ignored.

◆ get() [1/2]

GPUResourceBinding * CeresEngine::GPUResourceSetBindings::get ( const UInt32  slot,
const UInt32  index = 0 
)
inline

Gets a GPUResourceBinding by it's reflection slot and index.

Parameters
slotThe slot of the binding to be retrieved.
indexThe index of the binding to be retrieved.
Returns
A pointer to the binding if it exists or nullptr if it's not present on the resource binding set.

◆ get() [2/2]

const GPUResourceBinding * CeresEngine::GPUResourceSetBindings::get ( const UInt32  slot,
const UInt32  index = 0 
) const
inline

Gets a GPUResourceBinding by it's reflection slot and index.

Parameters
slotThe slot of the binding to be retrieved.
indexThe index of the binding to be retrieved.
Returns
A pointer to the binding if it exists or nullptr if it's not present on the resource binding set.

◆ operator[]() [1/2]

GPUResourceSetBindingSlot CeresEngine::GPUResourceSetBindings::operator[] ( UInt32  slot)
inline

Helper method to have expressive access of the resource bindings.

Parameters
slotThe slot of the binding to be accessed.

◆ operator[]() [2/2]

GPUResourceSetConstBindingSlot CeresEngine::GPUResourceSetBindings::operator[] ( UInt32  slot) const
inline

Helper method to have expressive access of the resource bindings.

Parameters
slotThe slot of the binding to be accessed.

◆ remove() [1/2]

void CeresEngine::GPUResourceSetBindings::remove ( const UInt32  slot,
const UInt32  index 
)
inline

Removes a GPUResourceBinding for the given binding slot and index.

Parameters
slotThe slot of the binding to be removed.
indexThe index of the binding to be removed.

◆ remove() [2/2]

void CeresEngine::GPUResourceSetBindings::remove ( UInt32  slot)
inline

Removes a GPUResourceBinding for the given binding slot.

Note
This method will remove all bound resources to the given slot.
Parameters
slotThe slot of the binding to be removed.

◆ reserve()

void CeresEngine::BasicIndexedMultimap< Key, Value, Container >::reserve ( size_type  newCapacity)
inline

Tries to increase capacity by allocating additional memory.

If newCapacity > capacity(), the function allocates memory for new storage of capacity equal to the value of newCapacity, moves elements from old storage to new storage, and deallocates memory used by old storage. Otherwise the function does nothing.

This function does not change size of the container.

If the capacity is changed, all iterators and all references to the elements are invalidated. Otherwise, no iterators or references are invalidated.

◆ resize()

template<typename K = Key>
void CeresEngine::BasicIndexedMultimap< Key, Value, Container >::resize ( const K key,
size_type  newSize,
const Value &  value = Value() 
)
inline

Resizes the container and ensures that there are exactly newSize items on the given key.

If any new value must be created on the map, they will be initialized by constructing a copy of value.

Parameters
keyThe key to resize the elements on.
newSizeThe new size to set on the key.
valueThe value to initialize any new value with.

◆ set() [1/2]

GPUResourceBinding & CeresEngine::GPUResourceSetBindings::set ( const UInt32  slot,
const UInt32  index,
GPUResourceBinding  binding 
)
inline

Sets the GPUResourceBinding for the given binding slot and index.

Parameters
slotThe slot of the binding to be set.
indexThe index of the binding to be set.
bindingThe value to set the binding to.

◆ set() [2/2]

GPUResourceBinding & CeresEngine::GPUResourceSetBindings::set ( UInt32  slot,
GPUResourceBinding  binding 
)
inline

Sets the GPUResourceBinding for the given binding slot and index.

Note
If the binding already has one or more elements on it, they will all be replaced and set to binding.
Parameters
slotThe slot of the binding to be set.
bindingThe value to set the binding to.

◆ size() [1/2]

UInt32 CeresEngine::GPUResourceSetBindings::size ( ) const
inline

Gets the total number of GPUResourceBinding on the bindings object.

Returns
The total number of bindings.

◆ size() [2/2]

UInt32 CeresEngine::GPUResourceSetBindings::size ( const UInt32  slot) const
inline

Gets the number of GPUResourceBinding by on the given slot.

Parameters
slotThe slot of the binding to count the number of bound resources.
Returns
The number of bindings in the given slot.

The documentation for this class was generated from the following file: