Diligent Engine
Loading...
Searching...
No Matches
Diligent::IDynamicTextureAtlas Struct Referenceabstract

Dynamic texture atlas. More...

#include <DynamicTextureAtlas.h>

Inheritance diagram for Diligent::IDynamicTextureAtlas:
Diligent.IObject

Public Member Functions

virtual ITextureUpdate (IRenderDevice *pDevice, IDeviceContext *pContext)=0
 Updates the internal texture object.
virtual ITextureGetTexture () const =0
 Returns a pointer to the internal texture object.
virtual ITextureViewGetTextureSRV (TEXTURE_FORMAT ViewFormat) const =0
 Returns a shader resource view of the internal texture in the specified format.
virtual void Allocate (Uint32 Width, Uint32 Height, ITextureAtlasSuballocation **ppSuballocation)=0
 Performs suballocation from the atlas.
virtual TextureDesc GetAtlasDesc () const =0
 Returns a snapshot of the texture atlas description.
virtual uint2 GetAtlasSize () const =0
 Returns the constant atlas dimensions.
virtual Uint32 GetVersion () const =0
virtual void GetUsageStats (DynamicTextureAtlasUsageStats &Stats) const =0
virtual Uint32 GetAllocationAlignment (Uint32 Width, Uint32 Height) const =0
 Computes the allocation alignment for the region of a given size.
Public Member Functions inherited from Diligent.IObject
virtual void DILIGENT_CALL_TYPE QueryInterface (const INTERFACE_ID &IID, IObject **ppInterface)=0
 Queries the specific interface.
template<typename DerivedType, typename = typename std::enable_if<std::is_base_of<IObject, DerivedType>::value>::type>
void QueryInterface (const INTERFACE_ID &IID, DerivedType **ppInterface)
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE AddRef ()=0
 Increments the number of strong references by 1.
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE Release ()=0
virtual IReferenceCounters *DILIGENT_CALL_TYPE GetReferenceCounters () const =0

Detailed Description

Dynamic texture atlas.

Member Function Documentation

◆ Allocate()

virtual void Diligent::IDynamicTextureAtlas::Allocate ( Uint32 Width,
Uint32 Height,
ITextureAtlasSuballocation ** ppSuballocation )
pure virtual

Performs suballocation from the atlas.

Parameters
[in]Width- Suballocation width.
[in]Height- Suballocation height.
[out]ppSuballocation- Memory location where pointer to the new suballocation will be stored.

The method is thread-safe and can be called from multiple threads simultaneously.

Internal texture array may need to be extended after the allocation happened. An application may call the Update() to ensure that the texture is resized and old contents is copied. Allocate() may race with Update(), but the allocation is not guaranteed to be reflected in the texture returned by a concurrent Update() call; it will be committed by a subsequent Update().

◆ GetAllocationAlignment()

virtual Uint32 Diligent::IDynamicTextureAtlas::GetAllocationAlignment ( Uint32 Width,
Uint32 Height ) const
pure virtual

Computes the allocation alignment for the region of a given size.

Parameters
[in]Width- Region width.
[in]Height- Region height.
Returns
- Allocation alignment.

◆ GetTexture()

virtual ITexture * Diligent::IDynamicTextureAtlas::GetTexture ( ) const
pure virtual

Returns a pointer to the internal texture object.

If the texture has not been created yet, the method returns null. If the texture may need to be updated (initialized or resized), use the Update() method.

The method must not race with Update().

◆ GetTextureSRV()

virtual ITextureView * Diligent::IDynamicTextureAtlas::GetTextureSRV ( TEXTURE_FORMAT ViewFormat) const
pure virtual

Returns a shader resource view of the internal texture in the specified format.

The atlas returns the default SRV and, when typed texture views are supported, an additional sRGB SRV for compatible typeless formats. If the requested view is not available, the method returns null.

The method does not create a view and must not race with Update().

◆ GetUsageStats()

virtual void Diligent::IDynamicTextureAtlas::GetUsageStats ( DynamicTextureAtlasUsageStats & Stats) const
pure virtual

Returns the usage stats, see Diligent::DynamicTextureAtlasUsageStats.

The method must not race with Update().

◆ GetVersion()

virtual Uint32 Diligent::IDynamicTextureAtlas::GetVersion ( ) const
pure virtual

Returns the internal texture version. The version is incremented whenever a new backing texture object is created. Sparse residency changes that keep the same texture object do not change the version.

◆ Update()

virtual ITexture * Diligent::IDynamicTextureAtlas::Update ( IRenderDevice * pDevice,
IDeviceContext * pContext )
pure virtual

Updates the internal texture object.

Parameters
[in]pDevice- A pointer to the render device that will be used to create a new internal texture array, if necessary.
[in]pContext- A pointer to the device context that will be used to copy existing contents to the new texture array, if necessary.

If the internal texture needs to be resized, pDevice and pContext will be used to create a new texture and copy existing contents to it.

The method may race with Allocate(). If an allocation happens concurrently, the returned texture is not guaranteed to include storage for that allocation; it will be committed by a subsequent Update() call.

Concurrent calls to Update() must be externally synchronized.