|
Nebula
|
Material special version of variant.
Classes | |
| struct | [struct].materialLoaderState |
| struct | MaterialBuffer |
| struct | MaterialConstant |
| struct | MaterialId |
| struct | MaterialInstanceId |
| class | MaterialLoader |
| struct | MaterialTexture |
| struct | MaterialVariant |
| struct | ShaderConfigBatchTexture |
Typedefs | |
| typedef IndexT | BatchIndex |
| typedef Ids::IdAllocator< Util::StringAtom, float, Util::Array< Resources::ResourceId >, Util::FixedArray< CoreGraphics::ResourceTableId >, CoreGraphics::BufferId, Util::FixedArray< Util::FixedArray< CoreGraphics::ResourceTableId > >, Util::FixedArray< Util::Tuple< IndexT, SizeT > >, Util::FixedArray< Util::Array< MaterialTexture > >, Util::FixedArray< Util::Array< MaterialConstant > >, IndexT, const MaterialTemplatesGPULang::Entry *, uint > | MaterialAllocator |
| typedef Ids::IdAllocator< uint > | MaterialInstanceAllocator |
| using | LoaderFunc = void(*)(Ptr<IO::BXmlReader>, Materials::MaterialId, Util::StringAtom) |
Enumerations | |
| enum | BindlessBufferDirtyBits { Graphics = 0x1 , Compute = 0x2 , All = Graphics | Compute } |
| enum | { Material_Name , Material_MinLOD , Material_LODTextures , Material_Table , Material_Buffer , Material_InstanceTables , Material_InstanceBuffers , Material_Textures , Material_Constants , Material_BufferOffset , Material_Template , Material_Version } |
| enum | MaterialInstanceMembers { MaterialInstance_Offsets } |
Functions | |
| static void | MaterialSetupTemplate (const Ids::Id32 id, const MaterialTemplatesGPULang::Entry *entry) |
| Build everything of a material that depends on its template: the constant buffer with the template's defaults, the resource tables of the template's passes and the default textures. | |
| static void | MaterialReleaseTemplate (const Ids::Id32 id) |
| Release what MaterialSetupTemplate built. | |
| MaterialId | CreateMaterial (const MaterialTemplatesGPULang::Entry *entry, const Util::StringAtom &name) |
| Create material. | |
| void | MaterialReloadTemplate (const MaterialId mat, const MaterialTemplatesGPULang::Entry *entry) |
| Rebuild the material for a template under the same id, so everything holding the material keeps working with it. | |
| void | DestroyMaterial (const MaterialId id) |
| Destroy material. | |
| uint | MaterialGetVersion (const MaterialId mat) |
| Callbacks that outlive a reload of the material, like those of textures still loading, compare this with the version they were issued for. | |
| void | MaterialSetTexture (const MaterialId mat, const ShaderConfigBatchTexture *bind, const Resources::ResourceId tex) |
| Set texture. | |
| void | MaterialSetTexture (const MaterialId mat, uint name, const Resources::ResourceId tex) |
| Set texture. | |
| void | MaterialSetTextureBindless (const MaterialId mat, uint name, const uint handle, const uint offset, const Resources::ResourceId tex) |
| Set bindless texture. | |
| void | MaterialSetConstants (const MaterialId mat, const void *data, const uint size) |
| Set all material constants. | |
| void | MaterialSetConstant (const MaterialId mat, const void *data, const uint size, const uint offset) |
| Set a material constant. | |
| void | MaterialSetData (const MaterialId mat, const void *data, const uint size) |
| Set the entire material buffer. | |
| void | MaterialSetBufferBinding (const MaterialId id, IndexT index) |
| Set material GPU buffer binding. | |
| IndexT | MaterialGetBufferBinding (const MaterialId id) |
| Get material GPU buffer binding. | |
| const Util::StringAtom & | MaterialGetName (const MaterialId id) |
| Get name of material. | |
| void | MaterialAddLODTexture (const MaterialId mat, const Resources::ResourceId tex) |
| Add texture to LOD update. | |
| void | MaterialSetLowestLod (const MaterialId mat, float lod) |
| Update LOD for material. | |
| const MaterialTemplatesGPULang::Entry * | MaterialGetTemplate (const MaterialId mat) |
| Get material shader config. | |
| const Materials::BatchIndex | MaterialGetBatchIndex (const MaterialId mat, const MaterialTemplatesGPULang::BatchGroup batch) |
| Get batch index from code. | |
| uint64_t | MaterialGetSortCode (const MaterialId mat) |
| Get sort code. | |
| void | MaterialApply (const MaterialId id, const CoreGraphics::CmdBufferId buf, IndexT index) |
| Apply material. | |
| MaterialInstanceId | CreateMaterialInstance (const MaterialId material) |
| Create material instance. | |
| void | DestroyMaterialInstance (const MaterialInstanceId materialInstance) |
| Destroy material instance. | |
| CoreGraphics::ConstantBufferOffset | MaterialInstanceAllocate (const MaterialInstanceId mat, const BatchIndex batch) |
| Allocate instance constants, call per frame when instance constants are needed. | |
| void | MaterialInstanceApply (const MaterialInstanceId id, const CoreGraphics::CmdBufferId buf, IndexT index, IndexT bufferIndex) |
| Apply material instance. | |
| SizeT | MaterialInstanceBufferSize (const MaterialInstanceId sur, const BatchIndex batch) |
| Get material instance buffer size for batch. | |
| __ImplementClass (Materials::MaterialLoader, 'MALO', Resources::ResourceLoader) | |
| void | LoadTexture (const Ptr< IO::BXmlReader > &reader, CoreGraphics::TextureId def, const char *name, const char *tag, uint &handle, bool &dirtyFlag, void *data, size_t dataSize, const Materials::MaterialId mat) |
| void | LoadVec4 (const Ptr< IO::BXmlReader > &reader, const char *name, float value[4], const Math::vec4 &def) |
| void | LoadVec3 (const Ptr< IO::BXmlReader > &reader, const char *name, float value[3], const Math::vec3 &def) |
| void | LoadFloat (const Ptr< IO::BXmlReader > &reader, const char *name, float &value, const float def) |
| void | LoadMaterialParameter (Ptr< IO::BXmlReader > reader, Util::StringAtom name, const MaterialTemplatesGPULang::Entry *entry, const Materials::MaterialId id, bool immediate) |
| static void | LoadMaterialParams (const Ptr< IO::BXmlReader > &reader, const MaterialId id, const MaterialTemplatesGPULang::Entry *materialTemplate, const Util::StringAtom &tag, const IO::URI &uri) |
| Apply the material's values and textures in the Params node, the reader has to be at the surface node. | |
Variables | |
| MaterialAllocator | materialAllocator |
| MaterialInstanceAllocator | materialInstanceAllocator |
| Threading::CriticalSection | materialTextureLoadSection |
| static uint | materialVersionCounter = 0 |
| material | |
| Util::Dictionary< MaterialTemplatesGPULang::MaterialProperties, LoaderFunc > | LoaderMap |
| struct | materialLoaderState |
| typedef IndexT Materials::BatchIndex |
| using Materials::LoaderFunc = void(*)(Ptr<IO::BXmlReader>, Materials::MaterialId, Util::StringAtom) |
| typedef Ids::IdAllocator< Util::StringAtom, float, Util::Array<Resources::ResourceId>, Util::FixedArray<CoreGraphics::ResourceTableId>, CoreGraphics::BufferId, Util::FixedArray<Util::FixedArray<CoreGraphics::ResourceTableId> >, Util::FixedArray<Util::Tuple<IndexT, SizeT> >, Util::FixedArray<Util::Array<MaterialTexture> >, Util::FixedArray<Util::Array<MaterialConstant> >, IndexT, const MaterialTemplatesGPULang::Entry*, uint > Materials::MaterialAllocator |
| anonymous enum |
| Materials::__ImplementClass | ( | Materials::MaterialLoader | , |
| 'MALO' | , | ||
| Resources::ResourceLoader | ) |
| MaterialId Materials::CreateMaterial | ( | const MaterialTemplatesGPULang::Entry * | entry, |
| const Util::StringAtom & | name ) |
Create material.
| MaterialInstanceId Materials::CreateMaterialInstance | ( | const MaterialId | material | ) |
Create material instance.
| void Materials::DestroyMaterial | ( | const MaterialId | id | ) |
Destroy material.
| void Materials::DestroyMaterialInstance | ( | const MaterialInstanceId | materialInstance | ) |
Destroy material instance.
| void Materials::LoadFloat | ( | const Ptr< IO::BXmlReader > & | reader, |
| const char * | name, | ||
| float & | value, | ||
| const float | def ) |
| void Materials::LoadMaterialParameter | ( | Ptr< IO::BXmlReader > | reader, |
| Util::StringAtom | name, | ||
| const MaterialTemplatesGPULang::Entry * | entry, | ||
| const Materials::MaterialId | id, | ||
| bool | immediate ) |
|
static |
Apply the material's values and textures in the Params node, the reader has to be at the surface node.
| void Materials::LoadTexture | ( | const Ptr< IO::BXmlReader > & | reader, |
| CoreGraphics::TextureId | def, | ||
| const char * | name, | ||
| const char * | tag, | ||
| uint & | handle, | ||
| bool & | dirtyFlag, | ||
| void * | data, | ||
| size_t | dataSize, | ||
| const Materials::MaterialId | mat ) |
| void Materials::LoadVec3 | ( | const Ptr< IO::BXmlReader > & | reader, |
| const char * | name, | ||
| float | value[3], | ||
| const Math::vec3 & | def ) |
| void Materials::LoadVec4 | ( | const Ptr< IO::BXmlReader > & | reader, |
| const char * | name, | ||
| float | value[4], | ||
| const Math::vec4 & | def ) |
| void Materials::MaterialAddLODTexture | ( | const MaterialId | mat, |
| const Resources::ResourceId | tex ) |
Add texture to LOD update.
| void Materials::MaterialApply | ( | const MaterialId | id, |
| const CoreGraphics::CmdBufferId | buf, | ||
| IndexT | index ) |
Apply material.
| const Materials::BatchIndex Materials::MaterialGetBatchIndex | ( | const MaterialId | mat, |
| const MaterialTemplatesGPULang::BatchGroup | batch ) |
Get batch index from code.
| IndexT Materials::MaterialGetBufferBinding | ( | const MaterialId | id | ) |
Get material GPU buffer binding.
| const Util::StringAtom & Materials::MaterialGetName | ( | const MaterialId | id | ) |
Get name of material.
| uint64_t Materials::MaterialGetSortCode | ( | const MaterialId | mat | ) |
Get sort code.
| const MaterialTemplatesGPULang::Entry * Materials::MaterialGetTemplate | ( | const MaterialId | mat | ) |
Get material shader config.
| uint Materials::MaterialGetVersion | ( | const MaterialId | mat | ) |
Callbacks that outlive a reload of the material, like those of textures still loading, compare this with the version they were issued for.
Get the version of the material, it changes every time the material is built for a template.
| CoreGraphics::ConstantBufferOffset Materials::MaterialInstanceAllocate | ( | const MaterialInstanceId | mat, |
| const BatchIndex | batch ) |
Allocate instance constants, call per frame when instance constants are needed.
| void Materials::MaterialInstanceApply | ( | const MaterialInstanceId | id, |
| const CoreGraphics::CmdBufferId | buf, | ||
| IndexT | index, | ||
| IndexT | bufferIndex ) |
Apply material instance.
| SizeT Materials::MaterialInstanceBufferSize | ( | const MaterialInstanceId | mat, |
| const BatchIndex | batch ) |
Get material instance buffer size for batch.
|
static |
Release what MaterialSetupTemplate built.
The tables and the buffer are deleted once the frames in flight are done with them
| void Materials::MaterialReloadTemplate | ( | const MaterialId | mat, |
| const MaterialTemplatesGPULang::Entry * | entry ) |
Rebuild the material for a template under the same id, so everything holding the material keeps working with it.
Rebuild a material in place for a template, for reloading, see MaterialLoader::ReinitializeResource.
The values and textures start out as the template's defaults, the caller applies the material's own. The buffer binding and the LOD are kept, they belong to the loader and to the material's distance.
Nodes cache the template of their material, the reload listener in ModelContext::Create updates them
| void Materials::MaterialSetBufferBinding | ( | const MaterialId | id, |
| IndexT | index ) |
Set material GPU buffer binding.
| void Materials::MaterialSetConstant | ( | const MaterialId | mat, |
| const void * | data, | ||
| const uint | size, | ||
| const uint | offset ) |
Set a material constant.
| void Materials::MaterialSetConstants | ( | const MaterialId | mat, |
| const void * | data, | ||
| const uint | size ) |
Set all material constants.
| void Materials::MaterialSetData | ( | const MaterialId | mat, |
| const void * | data, | ||
| const uint | size ) |
Set the entire material buffer.
| void Materials::MaterialSetLowestLod | ( | const MaterialId | mat, |
| float | lod ) |
Update LOD for material.
| void Materials::MaterialSetTexture | ( | const MaterialId | mat, |
| const ShaderConfigBatchTexture * | bind, | ||
| const Resources::ResourceId | tex ) |
Set texture.
| void Materials::MaterialSetTexture | ( | const MaterialId | mat, |
| uint | name, | ||
| const Resources::ResourceId | tex ) |
Set texture.
| void Materials::MaterialSetTextureBindless | ( | const MaterialId | mat, |
| uint | name, | ||
| const uint | handle, | ||
| const uint | offset, | ||
| const Resources::ResourceId | tex ) |
Set bindless texture.
|
static |
Build everything of a material that depends on its template: the constant buffer with the template's defaults, the resource tables of the template's passes and the default textures.
| Util::Dictionary<MaterialTemplatesGPULang::MaterialProperties, LoaderFunc> Materials::LoaderMap |
| Materials::material |
| MaterialAllocator Materials::materialAllocator |
| MaterialInstanceAllocator Materials::materialInstanceAllocator |
| struct Materials::[struct].materialLoaderState Materials::materialLoaderState |
| Threading::CriticalSection Materials::materialTextureLoadSection |
|
static |