Skip to content

Commit 1d86c11

Browse files
authored
Merge pull request #94 from sawickiap/master
Version 3.2.0
2 parents 146c0ab + 8540c60 commit 1d86c11

6 files changed

Lines changed: 47 additions & 46 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 3.2.0 (2026-??-??)
1+
# 3.2.0 (2026-06-05)
22

33
- Added `POOL_FLAG_DONT_USE_TIGHT_ALIGNMENT` (#91).
44
- Further improvements in the algorithm deciding when to use small alignment or tight alignment, including added support for `D3D12_FEATURE_DATA_D3D12_OPTIONS4::MSAA64KBAlignedTextureSupported`.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.25)
22

3-
project(D3D12MemoryAllocator VERSION 3.1.0)
3+
project(D3D12MemoryAllocator VERSION 3.2.0)
44

55
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
66

bin/D3D12Sample.exe

12 KB
Binary file not shown.

docs/html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
<div class="headertitle"><div class="title">D3D12 Memory Allocator </div></div>
102102
</div><!--header-->
103103
<div class="contents">
104-
<div class="textblock"><p><b>Version 3.1.0</b> (2026-02-23)</p>
104+
<div class="textblock"><p><b>Version 3.2.0</b> (2026-06-05)</p>
105105
<p>Copyright (c) 2019-2026 Advanced Micro Devices, Inc. All rights reserved. <br />
106106
License: MIT</p>
107107
<p>Documentation of all members: <a class="el" href="_d3_d12_mem_alloc_8h.html">D3D12MemAlloc.h</a></p>

include/D3D12MemAlloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
/** \mainpage D3D12 Memory Allocator
2626
27-
<b>Version 3.1.0</b> (2026-02-23)
27+
<b>Version 3.2.0</b> (2026-06-05)
2828
2929
Copyright (c) 2019-2026 Advanced Micro Devices, Inc. All rights reserved. \n
3030
License: MIT

src/Tests.cpp

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,33 +1886,33 @@ static void TestSmallTextureAlignment(const TestContext& ctx)
18861886
UINT HeightAboveThreshold;
18871887
};
18881888

1889-
static const TextureCase NON_MSAA_CASES[] =
1890-
{
1891-
{ DXGI_FORMAT_R8_UNORM, 128, 128, 320, 320 },
1892-
{ DXGI_FORMAT_R8G8B8A8_UNORM, 64, 64, 160, 160 },
1893-
{ DXGI_FORMAT_BC1_UNORM, 128, 128, 640, 256 },
1894-
};
1895-
static const TextureCase MSAA_CASES[] =
1896-
{
1897-
{ DXGI_FORMAT_R8G8B8A8_UNORM, 256, 256, 1152, 512 },
1898-
{ DXGI_FORMAT_R16G16B16A16_FLOAT, 256, 128, 576, 512 },
1899-
{ DXGI_FORMAT_R32G32B32A32_FLOAT, 256, 128, 576, 256 },
1900-
};
1889+
static const TextureCase NON_MSAA_CASES[] =
1890+
{
1891+
{ DXGI_FORMAT_R8_UNORM, 128, 128, 320, 320 },
1892+
{ DXGI_FORMAT_R8G8B8A8_UNORM, 64, 64, 160, 160 },
1893+
{ DXGI_FORMAT_BC1_UNORM, 128, 128, 640, 256 },
1894+
};
1895+
static const TextureCase MSAA_CASES[] =
1896+
{
1897+
{ DXGI_FORMAT_R8G8B8A8_UNORM, 256, 256, 1152, 512 },
1898+
{ DXGI_FORMAT_R16G16B16A16_FLOAT, 256, 128, 576, 512 },
1899+
{ DXGI_FORMAT_R32G32B32A32_FLOAT, 256, 128, 576, 256 },
1900+
};
19011901

19021902
for (UINT msaaIndex = 0; msaaIndex < 2; ++msaaIndex)
19031903
{
19041904
const bool isMsaa = msaaIndex != 0;
19051905
const UINT64 largeAlignment = isMsaa ?
19061906
D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT :
19071907
D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
1908-
const UINT64 smallAlignment = isMsaa ?
1909-
D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT :
1910-
D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT;
1911-
const TextureCase* textureCases = isMsaa ? MSAA_CASES : NON_MSAA_CASES;
1912-
const size_t textureCaseCount = isMsaa ? _countof(MSAA_CASES) : _countof(NON_MSAA_CASES);
1913-
const D3D12_HEAP_FLAGS heapFlags = isMsaa ?
1914-
D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES :
1915-
D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES;
1908+
const UINT64 smallAlignment = isMsaa ?
1909+
D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT :
1910+
D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT;
1911+
const TextureCase* textureCases = isMsaa ? MSAA_CASES : NON_MSAA_CASES;
1912+
const size_t textureCaseCount = isMsaa ? _countof(MSAA_CASES) : _countof(NON_MSAA_CASES);
1913+
const D3D12_HEAP_FLAGS heapFlags = isMsaa ?
1914+
D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES :
1915+
D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES;
19161916
const D3D12_RESOURCE_FLAGS resourceFlags = isMsaa ?
19171917
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET :
19181918
D3D12_RESOURCE_FLAG_NONE;
@@ -1932,11 +1932,11 @@ static void TestSmallTextureAlignment(const TestContext& ctx)
19321932

19331933
D3D12MA::CALLOCATION_DESC allocDesc = D3D12MA::CALLOCATION_DESC{ pool.Get() };
19341934

1935-
for (size_t textureCaseIndex = 0; textureCaseIndex < textureCaseCount; ++textureCaseIndex)
1936-
{
1937-
const TextureCase& textureCase = textureCases[textureCaseIndex];
1938-
for (UINT thresholdIndex = 0; thresholdIndex < 2; ++thresholdIndex)
1939-
{
1935+
for (size_t textureCaseIndex = 0; textureCaseIndex < textureCaseCount; ++textureCaseIndex)
1936+
{
1937+
const TextureCase& textureCase = textureCases[textureCaseIndex];
1938+
for (UINT thresholdIndex = 0; thresholdIndex < 2; ++thresholdIndex)
1939+
{
19401940
const bool belowThreshold = thresholdIndex == 0;
19411941
D3D12_RESOURCE_DESC resDesc = {};
19421942
resDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
@@ -1962,23 +1962,23 @@ static void TestSmallTextureAlignment(const TestContext& ctx)
19621962
CHECK_BOOL(alloc0->GetHeap() == alloc1->GetHeap());
19631963

19641964
// Note these asserts may fail if you use D3D12MA_USE_SMALL_RESOURCE_PLACEMENT_ALIGNMENT=2.
1965-
const UINT64 expectedAlignment = belowThreshold ? smallAlignment : largeAlignment;
1966-
CHECK_BOOL((alloc0->GetOffset() % expectedAlignment) == 0);
1967-
CHECK_BOOL((alloc1->GetOffset() % expectedAlignment) == 0);
1968-
if (belowThreshold)
1969-
{
1970-
const UINT64 nonZeroOffset = alloc0->GetOffset() > 0 ? alloc0->GetOffset() : alloc1->GetOffset();
1971-
wprintf(L" Small alignment case: format=%u msaa=%u size=%llux%u offset=%llu -> small alignment %s\n",
1972-
(UINT)textureCase.Format,
1973-
isMsaa ? 1u : 0u,
1974-
resDesc.Width,
1975-
resDesc.Height,
1976-
nonZeroOffset,
1977-
nonZeroOffset < largeAlignment ? L"YES" : L"NO");
1978-
}
1979-
1980-
alloc1.Reset();
1981-
alloc0.Reset();
1965+
const UINT64 expectedAlignment = belowThreshold ? smallAlignment : largeAlignment;
1966+
CHECK_BOOL((alloc0->GetOffset() % expectedAlignment) == 0);
1967+
CHECK_BOOL((alloc1->GetOffset() % expectedAlignment) == 0);
1968+
if (belowThreshold)
1969+
{
1970+
const UINT64 nonZeroOffset = alloc0->GetOffset() > 0 ? alloc0->GetOffset() : alloc1->GetOffset();
1971+
wprintf(L" Small alignment case: format=%u msaa=%u size=%llux%u offset=%llu -> small alignment %s\n",
1972+
(UINT)textureCase.Format,
1973+
isMsaa ? 1u : 0u,
1974+
resDesc.Width,
1975+
resDesc.Height,
1976+
nonZeroOffset,
1977+
nonZeroOffset < largeAlignment ? L"YES" : L"NO");
1978+
}
1979+
1980+
alloc1.Reset();
1981+
alloc0.Reset();
19821982
}
19831983
}
19841984

@@ -3574,6 +3574,7 @@ static void TestTightAlignment(const TestContext& ctx)
35743574

35753575
// Use a custom pool to make sure our small buffers are not created as committed.
35763576
POOL_DESC poolDesc = {};
3577+
poolDesc.HeapFlags = D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS;
35773578
poolDesc.BlockSize = MEGABYTE;
35783579
poolDesc.MinBlockCount = poolDesc.MaxBlockCount = 1;
35793580

0 commit comments

Comments
 (0)