Castor3D 0.16.0
Multiplatform 3D engine
Public Types | Public Member Functions | List of all members
castor::ResourceCacheT< castor3d::Material, String, castor3d::MaterialCacheTraits > Class Referencefinal

Material collection, with additional functions. More...

#include <MaterialCache.hpp>

Inheritance diagram for castor::ResourceCacheT< castor3d::Material, String, castor3d::MaterialCacheTraits >:
Inheritance graph
[legend]
Collaboration diagram for castor::ResourceCacheT< castor3d::Material, String, castor3d::MaterialCacheTraits >:
Collaboration graph
[legend]

Public Types

using ElementT = castor3d::Material
 
using ElementKeyT = String
 
using ElementCacheTraitsT = castor3d::MaterialCacheTraits
 
using ElementCacheT = ResourceCacheBaseT< ElementT, ElementKeyT, ElementCacheTraitsT >
 
using ElementPtrT = typename ElementCacheT::ElementPtrT
 
using ElementContT = typename ElementCacheT::ElementContT
 
using ElementInitialiserT = typename ElementCacheT::ElementInitialiserT
 
using ElementCleanerT = typename ElementCacheT::ElementCleanerT
 
using ElementMergerT = typename ElementCacheT::ElementMergerT
 
- Public Types inherited from castor::ResourceCacheBaseT< castor3d::Material, String, castor3d::MaterialCacheTraits >
using ElementT
 
using ElementKeyT
 
using ElementCacheTraitsT
 
using ElementCacheBaseT
 
using ElementCacheT
 
using ElementPtrT
 
using ElementObsT
 
using ElementContT
 
using ElementInitialiserT
 
using ElementCleanerT
 
using ElementMergerT
 

Public Member Functions

C3D_API ResourceCacheT (castor3d::Engine &engine)
 Constructor.
 
C3D_API void initialise (castor3d::RenderDevice const &device)
 Intialises the default material.
 
C3D_API void cleanup ()
 Sets all the elements to be cleaned up.
 
C3D_API void clear () noexcept
 Deletes the default material, flush the collection.
 
C3D_API void update (castor3d::CpuUpdater &updater)
 Updates the render pass, CPU wise.
 
C3D_API void update (castor3d::GpuUpdater &updater)
 Updates the render pass, GPU wise.
 
C3D_API void upload (castor3d::UploadData &uploader) const
 Uploads all GPU buffers to VRAM.
 
C3D_API void registerSpecificsBuffer (castor::String const &name, castor3d::SpecificsBuffer buffer)
 Registers a specific data shader buffer.
 
C3D_API void unregisterSpecificsBuffer (castor::String const &name) noexcept
 Unregisters a pass' specific data buffer.
 
C3D_API void addSpecificsBuffersBindings (ashes::VkDescriptorSetLayoutBindingArray &bindings, VkShaderStageFlags shaderStages, uint32_t &index) const
 Addw the pass' specific data buffer into the given descriptor layout bindings array.
 
C3D_API void addSpecificsBuffersDescriptors (ashes::WriteDescriptorSetArray &descriptorWrites, uint32_t &index) const
 Writes the pass' specific data buffer into the given descriptor writes array.
 
C3D_API void createSpecificsBuffersPassBindings (crg::FramePass &pass, uint32_t &index) const
 Writes the pass' specific data buffer bindings into given frame pass.
 
C3D_API void declareSpecificsShaderBuffers (sdw::ShaderWriter &writer, castor::StringMap< castor3d::shader::BufferBaseUPtr > &buffers, uint32_t &binding, uint32_t set) const
 Declares pass' specific data shader buffers.
 
C3D_API void getNames (StringArray &names)
 Puts all the materials names in the given array.
 
C3D_API uint32_t getMaxPassTypeCount () const
 
C3D_API std::tuple< castor3d::PassComponentCombineID, castor3d::TextureCombineIDgetPassTypeDetails (uint32_t passTypeIndex) const
 
C3D_API uint32_t getPassTypeIndex (castor3d::PassComponentCombineID passType, castor3d::TextureCombineID textureFlags) const
 
C3D_API bool registerPass (castor3d::Pass &pass)
 
C3D_API void unregisterPass (castor3d::Pass &pass) noexcept
 
C3D_API bool registerUnit (castor3d::TextureUnit &unit)
 
C3D_API void unregisterUnit (castor3d::TextureUnit &unit) noexcept
 
C3D_API bool registerTexture (castor3d::AnimatedTexture const &texture)
 
C3D_API void unregisterTexture (castor3d::AnimatedTexture const &texture) noexcept
 
C3D_API uint32_t getCurrentPassTypeCount () const
 
castor3d::MaterialObs getDefaultMaterial () const
 
castor3d::PassBuffer const & getPassBuffer () const
 
castor3d::SssProfileBuffer const & getSssProfileBuffer () const
 
castor3d::TextureConfigurationBuffer const & getTexConfigBuffer () const
 
castor3d::TextureAnimationBuffer const & getTexAnimBuffer () const
 
- Public Member Functions inherited from castor::ResourceCacheBaseT< castor3d::Material, String, castor3d::MaterialCacheTraits >
 ResourceCacheBaseT (ResourceCacheBaseT const &)=delete
 
 ResourceCacheBaseT (ResourceCacheBaseT &&) noexcept=delete
 
ResourceCacheBaseToperator= (ResourceCacheBaseT const &)=delete
 
ResourceCacheBaseToperator= (ResourceCacheBaseT &&) noexcept=delete
 
void cleanup () noexcept
 Sets all the elements to be cleaned up.
 
void clear () noexcept
 Flushes the collection.
 
ElementPtrT create (ElementKeyT const &name, ParametersT &&... parameters) const
 Creates an element.
 
ElementObsT tryAdd (ElementKeyT const &name, ElementPtrT &element, bool initialise=false)
 Adds an element.
 
ElementObsT tryAdd (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... parameters)
 Add an element, constructed in-place.
 
ElementObsT tryAddNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=false)
 Adds an element.
 
ElementObsT tryAddNoLock (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... parameters)
 Add an element, constructed in-place.
 
ElementObsT add (ElementKeyT const &name, ElementPtrT &element, bool initialise=true)
 Logging version of tryAdd.
 
ElementObsT add (ElementKeyT const &name, ParametersT &&... parameters)
 Logging version of tryAdd.
 
ElementObsT addNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=true)
 Logging version of tryAdd.
 
ElementObsT addNoLock (ElementKeyT const &name, ParametersT &&... parameters)
 Logging version of tryAdd.
 
ElementPtrT tryRemove (ElementKeyT const &name, bool cleanup=false) noexcept
 Removes an element, given a name.
 
ElementPtrT tryRemoveNoLock (ElementKeyT const &name, bool cleanup=false) noexcept
 Removes an element, given a name.
 
ElementPtrT remove (ElementKeyT const &name, bool cleanup=false) noexcept
 Logging version of tryRemove.
 
ElementPtrT removeNoLock (ElementKeyT const &name, bool cleanup=false) noexcept
 Logging version of tryRemove.
 
void rename (ElementKeyT const &oldName, ElementKeyT const &newName)
 Renames a resource.
 
ElementObsT tryFind (ElementKeyT const &name) const noexcept
 Looks for an element with given name.
 
ElementObsT tryFindNoLock (ElementKeyT const &name) const noexcept
 Looks for an element with given name.
 
ElementObsT find (ElementKeyT const &name) const
 Logging version of tryRemove.
 
ElementObsT findNoLock (ElementKeyT const &name) const
 Logging version of tryRemove.
 
void mergeInto (ElementCacheBaseT &destination)
 Merges this cache's elements to the one given.
 
void forEach (FuncType func) const
 
void forEach (FuncType func)
 
uint32_t getObjectCount () const noexcept
 
uint32_t getObjectCountNoLock () const noexcept
 
String const & getObjectTypeName () const noexcept
 
bool has (ElementKeyT const &name) const noexcept
 
bool hasNoLock (ElementKeyT const &name) const noexcept
 
bool isEmpty () const noexcept
 
bool isEmptyNoLock () const noexcept
 
void lock () const
 
void unlock () const noexcept
 
auto begin () noexcept
 
auto begin () const noexcept
 
auto end () noexcept
 
auto end () const noexcept
 
void reportCreation (String const &name) const
 
void reportAdded (String const &name) const
 
void reportDuplicate (String const &name) const
 
void reportNull () const
 
void reportUnknown (String const &name) const
 

Additional Inherited Members

- Protected Types inherited from castor::ResourceCacheBaseT< castor3d::Material, String, castor3d::MaterialCacheTraits >
using MutexT
 
- Protected Member Functions inherited from castor::ResourceCacheBaseT< castor3d::Material, String, castor3d::MaterialCacheTraits >
void doCleanupNoLock () const noexcept
 
void doClearNoLock () noexcept
 
ElementPtrT doCreateT (ElementKeyT const &name, ParametersT &&... parameters) const
 
ElementObsT doTryAddNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=true)
 
ElementObsT doAddNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=true)
 
ElementObsT doTryAddNoLockT (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... parameters)
 
ElementObsT doAddNoLockT (ElementKeyT const &name, ParametersT &&... parameters)
 
ElementPtrT doTryRemoveNoLock (ElementKeyT const &name, bool cleanup=false) noexcept
 
ElementObsT doTryFindNoLock (ElementKeyT const &name) const noexcept
 
 ResourceCacheBaseT (LoggerInstance &logger, ElementInitialiserT initialise=ElementInitialiserT{}, ElementCleanerT clean=ElementCleanerT{}, ElementMergerT merge=ElementMergerT{})
 
virtual ~ResourceCacheBaseT () noexcept=default
 
- Protected Attributes inherited from castor::ResourceCacheBaseT< castor3d::Material, String, castor3d::MaterialCacheTraits >
LoggerInstancem_logger
 
CheckedMutexT< MutexTm_mutex
 
ElementContT m_resources
 
ElementInitialiserT m_initialise
 
ElementCleanerT m_clean
 
ElementMergerT m_merge
 

Detailed Description

Material collection, with additional functions.

Member Typedef Documentation

◆ ElementCacheT

◆ ElementCacheTraitsT

◆ ElementCleanerT

◆ ElementContT

◆ ElementInitialiserT

◆ ElementKeyT

◆ ElementMergerT

◆ ElementPtrT

◆ ElementT

Constructor & Destructor Documentation

◆ ResourceCacheT()

Constructor.

Parameters
[in]engineThe engine.

Member Function Documentation

◆ addSpecificsBuffersBindings()

C3D_API void castor::ResourceCacheT< castor3d::Material, String, castor3d::MaterialCacheTraits >::addSpecificsBuffersBindings ( ashes::VkDescriptorSetLayoutBindingArray & bindings,
VkShaderStageFlags shaderStages,
uint32_t & index ) const

Addw the pass' specific data buffer into the given descriptor layout bindings array.

Parameters
[in,out]bindingsReceives the buffers descriptor layout bindings.
[in]shaderStagesThe shader stage flags.
[in,out]indexThe binding index.

◆ addSpecificsBuffersDescriptors()

C3D_API void castor::ResourceCacheT< castor3d::Material, String, castor3d::MaterialCacheTraits >::addSpecificsBuffersDescriptors ( ashes::WriteDescriptorSetArray & descriptorWrites,
uint32_t & index ) const

Writes the pass' specific data buffer into the given descriptor writes array.

Parameters
[in,out]descriptorWritesReceives the buffers descriptor writes.
[in,out]indexThe binding index.

◆ cleanup()

Sets all the elements to be cleaned up.

◆ clear()

Deletes the default material, flush the collection.

◆ createSpecificsBuffersPassBindings()

C3D_API void castor::ResourceCacheT< castor3d::Material, String, castor3d::MaterialCacheTraits >::createSpecificsBuffersPassBindings ( crg::FramePass & pass,
uint32_t & index ) const

Writes the pass' specific data buffer bindings into given frame pass.

Parameters
[in,out]passThe target frame pass.
[in,out]indexThe binding index.

◆ declareSpecificsShaderBuffers()

C3D_API void castor::ResourceCacheT< castor3d::Material, String, castor3d::MaterialCacheTraits >::declareSpecificsShaderBuffers ( sdw::ShaderWriter & writer,
castor::StringMap< castor3d::shader::BufferBaseUPtr > & buffers,
uint32_t & binding,
uint32_t set ) const

Declares pass' specific data shader buffers.

Parameters
[in,out]writerThe shader writer.
[out]buffersReceives the registered shader buffers.
[in,out]bindingThe descriptor binding index.
[in]setThe descriptor set index.

◆ getCurrentPassTypeCount()

C3D_API uint32_t castor::ResourceCacheT< castor3d::Material, String, castor3d::MaterialCacheTraits >::getCurrentPassTypeCount ( ) const

◆ getDefaultMaterial()

◆ getMaxPassTypeCount()

Returns
The maximum pass types count (for visibility buffer use).

◆ getNames()

Puts all the materials names in the given array.

Parameters
[out]namesThe array of names to be filled

◆ getPassBuffer()

References CU_Require.

◆ getPassTypeDetails()

Returns
The pass type details for given pass type index (for visibility buffer use).

◆ getPassTypeIndex()

Returns
The pass type index (for visibility buffer use).

◆ getSssProfileBuffer()

References CU_Require.

◆ getTexAnimBuffer()

References CU_Require.

◆ getTexConfigBuffer()

References CU_Require.

◆ initialise()

Intialises the default material.

Parameters
[in]deviceThe GPU device.

◆ registerPass()

◆ registerSpecificsBuffer()

Registers a specific data shader buffer.

Parameters
[in,out]nameThe shader buffer name.
[out]bufferThe shader buffer.

◆ registerTexture()

◆ registerUnit()

◆ unregisterPass()

◆ unregisterSpecificsBuffer()

C3D_API void castor::ResourceCacheT< castor3d::Material, String, castor3d::MaterialCacheTraits >::unregisterSpecificsBuffer ( castor::String const & name)
noexcept

Unregisters a pass' specific data buffer.

Parameters
[in,out]nameThe shader buffer name.

◆ unregisterTexture()

◆ unregisterUnit()

◆ update() [1/2]

Updates the render pass, CPU wise.

Parameters
[in,out]updaterThe update data.

◆ update() [2/2]

Updates the render pass, GPU wise.

Parameters
[in,out]updaterThe update data.

◆ upload()

Uploads all GPU buffers to VRAM.

Parameters
[in]uploaderReceives the upload requests.

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