Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::GLTF::ResourceManager Class Referencefinal

GLTF resource manager. More...

#include <GLTFResourceManager.hpp>

Inheritance diagram for Diligent::GLTF::ResourceManager:
Diligent::ObjectBase< IObject > Diligent::RefCountedObject< Base >

Classes

struct  CreateInfo
 Resource manager create info. More...
 
struct  DefaultVertexPoolDesc
 
struct  TransitionResourceStatesInfo
 Parameters of the TransitionResourceStates() method. More...
 
struct  VertexLayoutKey
 Vertex layout key used to select the vertex pool. More...
 

Public Member Functions

RefCntAutoPtr< ITextureAtlasSuballocationAllocateTextureSpace (TEXTURE_FORMAT Fmt, Uint32 Width, Uint32 Height, const char *CacheId=nullptr, IObject *pUserData=nullptr)
 Allocates texture space in the texture atlas that matches the specified format.
 
RefCntAutoPtr< ITextureAtlasSuballocationFindTextureAllocation (const char *CacheId)
 
RefCntAutoPtr< IBufferSuballocationAllocateIndices (Uint32 Size, Uint32 Alignment=4)
 
RefCntAutoPtr< IVertexPoolAllocationAllocateVertices (const VertexLayoutKey &LayoutKey, Uint32 VertexCount)
 Allocates vertices in the vertex pool that matches the specified layout.
 
Uint32 GetTextureVersion () const
 
Uint32 GetIndexBufferVersion () const
 
Uint32 GetVertexPoolsVersion () const
 
IBufferUpdateIndexBuffer (IRenderDevice *pDevice, IDeviceContext *pContext, Uint32 Index=0)
 
void UpdateIndexBuffers (IRenderDevice *pDevice, IDeviceContext *pContext)
 
size_t GetIndexBufferCount () const
 
Uint32 GetIndexAllocatorIndex (IBufferSuballocator *pAllocator) const
 
void UpdateVertexBuffers (IRenderDevice *pDevice, IDeviceContext *pContext)
 
IBufferGetIndexBuffer (Uint32 Index=0) const
 
IVertexPoolGetVertexPool (const VertexLayoutKey &Key, Uint32 Index=0)
 
size_t GetVertexPoolCount (const VertexLayoutKey &Key) const
 
std::vector< IVertexPool * > GetVertexPools (const VertexLayoutKey &Key) const
 
Uint32 GetVertexPoolIndex (const VertexLayoutKey &Key, IVertexPool *pPool) const
 
ITextureUpdateTexture (TEXTURE_FORMAT Fmt, IRenderDevice *pDevice, IDeviceContext *pContext)
 
void UpdateTextures (IRenderDevice *pDevice, IDeviceContext *pContext)
 
ITextureGetTexture (TEXTURE_FORMAT Fmt) const
 
void UpdateAllResources (IRenderDevice *pDevice, IDeviceContext *pContext)
 
TextureDesc GetAtlasDesc (TEXTURE_FORMAT Fmt)
 Returns the texture atlas description for the given format.
 
Uint32 GetAllocationAlignment (TEXTURE_FORMAT Fmt, Uint32 Width, Uint32 Height)
 
BufferSuballocatorUsageStats GetIndexBufferUsageStats ()
 
DynamicTextureAtlasUsageStats GetAtlasUsageStats (TEXTURE_FORMAT Fmt=TEX_FORMAT_UNKNOWN)
 Returns the texture atlas usage stats.
 
VertexPoolUsageStats GetVertexPoolUsageStats (const VertexLayoutKey &Key=VertexLayoutKey{})
 Returns the vertex pool usage stats.
 
void TransitionResourceStates (IRenderDevice *pDevice, IDeviceContext *pContext, const TransitionResourceStatesInfo &Info)
 Transitions resource states of all vertex buffers, index buffer and texture atlases.
 
std::vector< TEXTURE_FORMATGetAllocatedAtlasFormats () const
 

Static Public Member Functions

static RefCntAutoPtr< ResourceManagerCreate (IRenderDevice *pDevice, const CreateInfo &CI)
 Creates a new resource manager instance.
 

Detailed Description

GLTF resource manager.

Member Function Documentation

◆ AllocateIndices()

RefCntAutoPtr< IBufferSuballocation > Diligent::GLTF::ResourceManager::AllocateIndices ( Uint32 Size,
Uint32 Alignment = 4 )

Allocates indices in the index buffer.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ AllocateTextureSpace()

RefCntAutoPtr< ITextureAtlasSuballocation > Diligent::GLTF::ResourceManager::AllocateTextureSpace ( TEXTURE_FORMAT Fmt,
Uint32 Width,
Uint32 Height,
const char * CacheId = nullptr,
IObject * pUserData = nullptr )

Allocates texture space in the texture atlas that matches the specified format.

Parameters
[in]Fmt- Texture format.
[in]Width- Texture width.
[in]Height- Texture height.
[in]CacheId- Optional cache ID.
[in]pUserData- Optional user data to set in the texture atlas suballocation.

If the texture atlas for the given format does not exist and if the default atlas description allows creating new atlases (Desc.Type != Diligent::RESOURCE_DIM_UNDEFINED), new atlas will be added. Otherwise, the function will return null.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ AllocateVertices()

RefCntAutoPtr< IVertexPoolAllocation > Diligent::GLTF::ResourceManager::AllocateVertices ( const VertexLayoutKey & LayoutKey,
Uint32 VertexCount )

Allocates vertices in the vertex pool that matches the specified layout.

Parameters
[in]LayoutKey- Vertex layout key, see VertexLayoutKey.
[in]VertexCount- The number of vertices to allocate.

If the vertex pool for the given key does not exist and if the default pool description allows creating new pools (VertexCount != 0), new pool will be added.

If existing pools run out of space, a new vertex pool will be created and vertices will be allocated from this pool.

If no pull exists for the given key and the default pool description does not allow creating new pools (VertexCount == 0), the function returns null.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ FindTextureAllocation()

RefCntAutoPtr< ITextureAtlasSuballocation > Diligent::GLTF::ResourceManager::FindTextureAllocation ( const char * CacheId)

Finds texture allocation in the texture atlas that matches the specified cache ID.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetAllocatedAtlasFormats()

std::vector< TEXTURE_FORMAT > Diligent::GLTF::ResourceManager::GetAllocatedAtlasFormats ( ) const

Returns the formats of the allocated texture atlases.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetAllocationAlignment()

Uint32 Diligent::GLTF::ResourceManager::GetAllocationAlignment ( TEXTURE_FORMAT Fmt,
Uint32 Width,
Uint32 Height )

Returns the texture atlas allocation alignment for the given format.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetAtlasDesc()

TextureDesc Diligent::GLTF::ResourceManager::GetAtlasDesc ( TEXTURE_FORMAT Fmt)

Returns the texture atlas description for the given format.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetAtlasUsageStats()

DynamicTextureAtlasUsageStats Diligent::GLTF::ResourceManager::GetAtlasUsageStats ( TEXTURE_FORMAT Fmt = TEX_FORMAT_UNKNOWN)

Returns the texture atlas usage stats.

If fmt is not Diligent::TEX_FORMAT_UNKNOWN, returns the stats for the atlas matching the specified format. Otherwise, returns the net usage stats for all atlases.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetIndexAllocatorIndex()

Uint32 Diligent::GLTF::ResourceManager::GetIndexAllocatorIndex ( IBufferSuballocator * pAllocator) const

Returns the index allocator index.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetIndexBuffer()

IBuffer * Diligent::GLTF::ResourceManager::GetIndexBuffer ( Uint32 Index = 0) const

Returns a pointer to the index buffer.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetIndexBufferCount()

size_t Diligent::GLTF::ResourceManager::GetIndexBufferCount ( ) const

Returns the number of index buffers.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetIndexBufferUsageStats()

BufferSuballocatorUsageStats Diligent::GLTF::ResourceManager::GetIndexBufferUsageStats ( )

Returns the index buffer usage stats.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetIndexBufferVersion()

Uint32 Diligent::GLTF::ResourceManager::GetIndexBufferVersion ( ) const

Returns the index buffer version.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetTexture()

ITexture * Diligent::GLTF::ResourceManager::GetTexture ( TEXTURE_FORMAT Fmt) const

Returns the atlas texture for the given format. If the atlas does not exist, null is returned.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetTextureVersion()

Uint32 Diligent::GLTF::ResourceManager::GetTextureVersion ( ) const

Returns the combined texture atlas version, i.e. the sum of the texture versions of all atlases.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetVertexPool()

IVertexPool * Diligent::GLTF::ResourceManager::GetVertexPool ( const VertexLayoutKey & Key,
Uint32 Index = 0 )

Returns a pointer to the vertex pool for the given key and index. If the pool does not exist, null is returned.

If multiple vertex pools with the same key may exist, an application can use the GetVertexPools() method to get all pools for the given key.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetVertexPoolCount()

size_t Diligent::GLTF::ResourceManager::GetVertexPoolCount ( const VertexLayoutKey & Key) const

Returns the number of vertex pools for the given key.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetVertexPoolIndex()

Uint32 Diligent::GLTF::ResourceManager::GetVertexPoolIndex ( const VertexLayoutKey & Key,
IVertexPool * pPool ) const

Returns index of the vertex pool with the give key. If the pool does not exist, InvalidIndex (0xFFFFFFFF) is returned.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetVertexPools()

std::vector< IVertexPool * > Diligent::GLTF::ResourceManager::GetVertexPools ( const VertexLayoutKey & Key) const

Returns all vertex pools for the given key.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetVertexPoolsVersion()

Uint32 Diligent::GLTF::ResourceManager::GetVertexPoolsVersion ( ) const

Returns the combined vertex pool version, i.e. the sum all vertex pool versions.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ GetVertexPoolUsageStats()

VertexPoolUsageStats Diligent::GLTF::ResourceManager::GetVertexPoolUsageStats ( const VertexLayoutKey & Key = VertexLayoutKey{})

Returns the vertex pool usage stats.

If the key is not equal the default key, returns the stats for the vertex pool matching the key. Otherwise, returns the net usage stats for all pools.

The function is thread-safe and can be called from multiple threads simultaneously and in parallel with other thread-safe class methods.

◆ TransitionResourceStates()

void Diligent::GLTF::ResourceManager::TransitionResourceStates ( IRenderDevice * pDevice,
IDeviceContext * pContext,
const TransitionResourceStatesInfo & Info )

Transitions resource states of all vertex buffers, index buffer and texture atlases.

Parameters
[in]pDevice- Pointer to the render device.
[in]pContext- Pointer to the device context.
[in]Info- Resource state transition info, see Diligent::ResourceManager::TransitionResourceStatesInfo.

This function is not thread-safe, but can be called in parallel with other thread-safe class methods.

◆ UpdateAllResources()

void Diligent::GLTF::ResourceManager::UpdateAllResources ( IRenderDevice * pDevice,
IDeviceContext * pContext )

Updates all vertex buffers, index buffer and atlas textures.

This method is equivalent to calling UpdateIndexBuffer(), UpdateVertexBuffers() and UpdateTextures().

The function is not thread-safe, but can be called in parallel with other thread-safe class methods.

◆ UpdateIndexBuffer()

IBuffer * Diligent::GLTF::ResourceManager::UpdateIndexBuffer ( IRenderDevice * pDevice,
IDeviceContext * pContext,
Uint32 Index = 0 )

Updates the index buffer, if necessary.

The function is not thread-safe, but can be called in parallel with other thread-safe class methods.

◆ UpdateIndexBuffers()

void Diligent::GLTF::ResourceManager::UpdateIndexBuffers ( IRenderDevice * pDevice,
IDeviceContext * pContext )

Updates all index buffers.

The function is not thread-safe, but can be called in parallel with other thread-safe class methods.

◆ UpdateTexture()

ITexture * Diligent::GLTF::ResourceManager::UpdateTexture ( TEXTURE_FORMAT Fmt,
IRenderDevice * pDevice,
IDeviceContext * pContext )

Updates the atlas texture for the given format. If the atlas does not exist, null is returned.

The function is not thread-safe, but can be called in parallel with other thread-safe class methods.

◆ UpdateTextures()

void Diligent::GLTF::ResourceManager::UpdateTextures ( IRenderDevice * pDevice,
IDeviceContext * pContext )

Updates all atlas textures.

The function is not thread-safe, but can be called in parallel with other thread-safe class methods.

◆ UpdateVertexBuffers()

void Diligent::GLTF::ResourceManager::UpdateVertexBuffers ( IRenderDevice * pDevice,
IDeviceContext * pContext )

Updates the vertex buffers, if necessary.

The function is not thread-safe, but can be called in parallel with other thread-safe class methods.