|
1 | 1 | /* |
2 | | - * Copyright 2019-2023 Diligent Graphics LLC |
| 2 | + * Copyright 2019-2024 Diligent Graphics LLC |
3 | 3 | * Copyright 2015-2019 Egor Yusov |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -384,6 +384,7 @@ class DynamicTextureAtlasImpl final : public ObjectBase<IDynamicTextureAtlas> |
384 | 384 | // clang-format off |
385 | 385 | m_MinAlignment {CreateInfo.MinAlignment}, |
386 | 386 | m_ExtraSliceCount {CreateInfo.ExtraSliceCount}, |
| 387 | + m_GrowthFactor {clamp(CreateInfo.GrowthFactor, 1.f, 2.f)}, |
387 | 388 | m_MaxSliceCount {CreateInfo.Desc.Type == RESOURCE_DIM_TEX_2D_ARRAY ? std::min(CreateInfo.MaxSliceCount, Uint32{2048}) : 1}, |
388 | 389 | m_Silent {CreateInfo.Silent}, |
389 | 390 | m_SuballocationsAllocator |
@@ -688,7 +689,7 @@ class DynamicTextureAtlasImpl final : public ObjectBase<IDynamicTextureAtlas> |
688 | 689 | { |
689 | 690 | const auto ExtraSliceCount = m_ExtraSliceCount != 0 ? |
690 | 691 | m_ExtraSliceCount : |
691 | | - std::max(m_TexArraySize.load(), 1u); |
| 692 | + std::max(static_cast<Uint32>(static_cast<float>(m_TexArraySize.load()) * m_GrowthFactor), 1u); |
692 | 693 |
|
693 | 694 | m_TexArraySize.store(std::min(m_TexArraySize + ExtraSliceCount, m_MaxSliceCount)); |
694 | 695 | } |
@@ -721,6 +722,7 @@ class DynamicTextureAtlasImpl final : public ObjectBase<IDynamicTextureAtlas> |
721 | 722 |
|
722 | 723 | const Uint32 m_MinAlignment; |
723 | 724 | const Uint32 m_ExtraSliceCount; |
| 725 | + const float m_GrowthFactor; |
724 | 726 | const Uint32 m_MaxSliceCount; |
725 | 727 | const bool m_Silent; |
726 | 728 |
|
|
0 commit comments