Dynamic texture atlas create information. More...
#include <DynamicTextureAtlas.h>
Public Attributes | |
TextureDesc | Desc |
Texture description. | |
Uint32 | MinAlignment = 64 |
Minimum region placement alignment. | |
Uint32 | ExtraSliceCount = 0 |
The number of extra slices. | |
float | GrowthFactor = 2.0f |
Growth factor. | |
Uint32 | MaxSliceCount = 2048 |
Maximum number of slices in texture array. | |
bool | Silent = false |
Silence allocation errors. | |
Dynamic texture atlas create information.
TextureDesc Diligent::DynamicTextureAtlasCreateInfo::Desc |
Texture description.
Texture type must be 2D or 2D array. When the type is texture 2D, resizes will be disabled.
Uint32 Diligent::DynamicTextureAtlasCreateInfo::ExtraSliceCount = 0 |
The number of extra slices.
When non-zero, the array will be expanded by the specified number of slices every time there is insufficient space. If zero, the array size will be expanded by the growth factor.
float Diligent::DynamicTextureAtlasCreateInfo::GrowthFactor = 2.0f |
Growth factor.
If ExtraSliceCount is zero, defines the factor by which the array size will be expanded. The factor must be in the range (1, 2]. For example, if the factor is 2.0, the array size will be doubled every time there is insufficient space.
Uint32 Diligent::DynamicTextureAtlasCreateInfo::MinAlignment = 64 |
Minimum region placement alignment.
The minimum alignment must be zero or a power of two. When alignment is zero, the atlas may allocate the region in any suitable location.
When alignment is non-zero, the region placement is aligned as follows:
min(Width, Height) <= MinAlignment
, the region placement is aligned by MinAlignmentmin(Width, Height) > MinAlignment
, the alignment is doubled until it satisfies the requirement above.Examples (when MinAlignment equals 64):
Note that if minimum alignment is zero, the region placement will not be aligned at all, which may result in biasing issues in coarser mip levels. For example, if 128x128 region is placed at (4, 12) coordinates in the atlas (i.e. R = [4, 132] x [12, 140]), all mip levels of R starting with level 3 will not be aligned with the mip 0.
The atlas uses the minimum dimension of the region to align it. This is done to reduce the space waste. A 256 x 1024 region will be aligned by 256, so all mip levels up to 8 will be properly aligned with mip 0. The last two mip levels however, may not be properly aligned.
Compressed texture considerations. Every mip level of a compressed texture may only be updated at block granularity (typically, 4x4). Be aware that coarse mip levels may not be 4-aligned (even though their placement is properly aligned with mip 0). Consider a [256, 512] x [512, 768] region. Its mip levels 7, 8 will be [2, 4] x [4, 6] and [1, 2] x [2, 3]. These mip-levels are not block-aligned. Moreover, they are smaller than the block.