Dynamically resizable texture 2D array. More...
#include <DynamicTextureArray.hpp>
Public Member Functions | |
DynamicTextureArray (IRenderDevice *pDevice, const DynamicTextureArrayCreateInfo &CreateInfo) | |
Initializes the dynamic texture array. | |
ITexture * | Resize (IRenderDevice *pDevice, IDeviceContext *pContext, Uint32 NewArraySize, bool DiscardContent=false) |
Resizes the texture array to the specified number of slices. | |
ITexture * | Update (IRenderDevice *pDevice, IDeviceContext *pContext) |
Updates the internal texture object. | |
ITexture * | GetTexture () const |
Returns a pointer to the texture object. | |
bool | PendingUpdate () const |
const TextureDesc & | GetDesc () const |
Returns the texture description. | |
Uint32 | GetVersion () const |
Returns dynamic texture version. | |
Uint64 | GetMemoryUsage () const |
Returns the amount of memory currently used by the dynamic array, in bytes. | |
Dynamically resizable texture 2D array.
Diligent::DynamicTextureArray::DynamicTextureArray | ( | IRenderDevice * | pDevice, |
const DynamicTextureArrayCreateInfo & | CreateInfo ) |
Initializes the dynamic texture array.
[in] | pDevice | - Render device that will be used to create the texture array. This parameter may be null (see remarks). |
[in] | CreateInfo | - Texture array create information, see Diligent::DynamicTextureArrayCreateInfo. |
If pDevice
is null, internal texture creation will be postponed until Update() or Resize() is called.
|
inline |
Returns a pointer to the texture object.
If the texture has not be initialized, the method returns null.
If the texture may need to be updated (initialized or resized), use the Update() method.
|
inline |
Returns dynamic texture version.
The version is incremented every time a new internal texture is created.
|
inline |
Returns true if the texture must be updated before use (e.g. it has been resized, but internal texture has not been initialized or updated). When update is not pending, Update() may be called with null device and context.
ITexture * Diligent::DynamicTextureArray::Resize | ( | IRenderDevice * | pDevice, |
IDeviceContext * | pContext, | ||
Uint32 | NewArraySize, | ||
bool | DiscardContent = false ) |
Resizes the texture array to the specified number of slices.
[in] | pDevice | - Render device that will be used create new internal texture. This parameter may be null (see remarks). |
[in] | pContext | - Device context that will be used to copy existing contents to the new texture (when using non-sparse texture), or commit new memory tiles (when using sparse texture). This parameter may be null (see remarks). |
[in] | NewArraySize | - The new number of slices in the texture array. |
[in] | DiscardContent | - Whether to discard previous texture content (for non-sparse textures). |
The method operation depends on which of pDevice
and pContext
parameters are not null:
pDevice
and pContext are
not null: internal texture is created (if necessary) and existing contents is copied (for non-sparse textures). Update() may be called with both pDevice and pContext being null.pDevice
is not null, pContext
is null: internal texture or additional memory pages are created, but existing contents is not copied and memory tiles are not bound. An application must provide non-null device context when calling Update().pDevice
and pContext
are null: internal texture or memory pages are not created. An application must provide non-null device and device context when calling Update().Typically pContext
is null when the method is called from a worker thread.
If NewArraySize
is zero, internal buffer will be released.
ITexture * Diligent::DynamicTextureArray::Update | ( | IRenderDevice * | pDevice, |
IDeviceContext * | pContext ) |
Updates the internal texture object.
[in] | pDevice | - Render device that will be used to create a new texture, if necessary (see remarks). |
[in] | pContext | - Device context that will be used to copy existing texture contents (when using non-sparse texture), or bind memory tiles (when using sparse textures), if necessary (see remarks). |
If the texture has been resized, but internal texture object has not been initialized, pDevice
and pContext
must not be null.
If the texture does not need to be updated (PendingUpdate() returns false), both pDevice and pContext may be null.