Dynamic texture atlas.
More...
#include <DynamicTextureAtlas.h>
◆ Allocate()
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()
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()
◆ 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()
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.