Merge pull request #94 from sawickiap/master

Version 3.2.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d5912f5..4c4546b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-# 3.2.0 (2026-??-??)

+# 3.2.0 (2026-06-05)

 

 - Added `POOL_FLAG_DONT_USE_TIGHT_ALIGNMENT` (#91).

 - Further improvements in the algorithm deciding when to use small alignment or tight alignment, including added support for `D3D12_FEATURE_DATA_D3D12_OPTIONS4::MSAA64KBAlignedTextureSupported`.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d61b21..5cf7273 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 3.25)
 
-project(D3D12MemoryAllocator VERSION 3.1.0)
+project(D3D12MemoryAllocator VERSION 3.2.0)
 
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
diff --git a/bin/D3D12Sample.exe b/bin/D3D12Sample.exe
index 8b4bb3d..1eef953 100644
--- a/bin/D3D12Sample.exe
+++ b/bin/D3D12Sample.exe
Binary files differ
diff --git a/docs/html/index.html b/docs/html/index.html
index 85d770a..8b7875d 100644
--- a/docs/html/index.html
+++ b/docs/html/index.html
@@ -101,7 +101,7 @@
   <div class="headertitle"><div class="title">D3D12 Memory Allocator </div></div>
 </div><!--header-->
 <div class="contents">
-<div class="textblock"><p><b>Version 3.1.0</b> (2026-02-23)</p>
+<div class="textblock"><p><b>Version 3.2.0</b> (2026-06-05)</p>
 <p>Copyright (c) 2019-2026 Advanced Micro Devices, Inc. All rights reserved. <br  />
 License: MIT</p>
 <p>Documentation of all members: <a class="el" href="_d3_d12_mem_alloc_8h.html">D3D12MemAlloc.h</a></p>
diff --git a/include/D3D12MemAlloc.h b/include/D3D12MemAlloc.h
index 735fb3b..36ec787 100644
--- a/include/D3D12MemAlloc.h
+++ b/include/D3D12MemAlloc.h
@@ -24,7 +24,7 @@
 

 /** \mainpage D3D12 Memory Allocator

 

-<b>Version 3.1.0</b> (2026-02-23)

+<b>Version 3.2.0</b> (2026-06-05)

 

 Copyright (c) 2019-2026 Advanced Micro Devices, Inc. All rights reserved. \n

 License: MIT

diff --git a/src/Tests.cpp b/src/Tests.cpp
index b38840f..b24a2ee 100644
--- a/src/Tests.cpp
+++ b/src/Tests.cpp
@@ -1886,18 +1886,18 @@
         UINT HeightAboveThreshold;

     };

 

-    static const TextureCase NON_MSAA_CASES[] =
-    {
-        { DXGI_FORMAT_R8_UNORM,           128, 128, 320, 320 },
-        { DXGI_FORMAT_R8G8B8A8_UNORM,      64,  64, 160, 160 },
-        { DXGI_FORMAT_BC1_UNORM,          128, 128, 640, 256 },
-    };
-    static const TextureCase MSAA_CASES[] =
-    {
-        { DXGI_FORMAT_R8G8B8A8_UNORM,     256, 256, 1152, 512 },
-        { DXGI_FORMAT_R16G16B16A16_FLOAT, 256, 128, 576,  512 },
-        { DXGI_FORMAT_R32G32B32A32_FLOAT, 256, 128, 576,  256 },
-    };
+    static const TextureCase NON_MSAA_CASES[] =

+    {

+        { DXGI_FORMAT_R8_UNORM,           128, 128, 320, 320 },

+        { DXGI_FORMAT_R8G8B8A8_UNORM,      64,  64, 160, 160 },

+        { DXGI_FORMAT_BC1_UNORM,          128, 128, 640, 256 },

+    };

+    static const TextureCase MSAA_CASES[] =

+    {

+        { DXGI_FORMAT_R8G8B8A8_UNORM,     256, 256, 1152, 512 },

+        { DXGI_FORMAT_R16G16B16A16_FLOAT, 256, 128, 576,  512 },

+        { DXGI_FORMAT_R32G32B32A32_FLOAT, 256, 128, 576,  256 },

+    };

 

     for (UINT msaaIndex = 0; msaaIndex < 2; ++msaaIndex)

     {

@@ -1905,14 +1905,14 @@
         const UINT64 largeAlignment = isMsaa ?

             D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT :

             D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;

-        const UINT64 smallAlignment = isMsaa ?
-            D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT :
-            D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT;
-        const TextureCase* textureCases = isMsaa ? MSAA_CASES : NON_MSAA_CASES;
-        const size_t textureCaseCount = isMsaa ? _countof(MSAA_CASES) : _countof(NON_MSAA_CASES);
-        const D3D12_HEAP_FLAGS heapFlags = isMsaa ?
-            D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES :
-            D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES;
+        const UINT64 smallAlignment = isMsaa ?

+            D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT :

+            D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT;

+        const TextureCase* textureCases = isMsaa ? MSAA_CASES : NON_MSAA_CASES;

+        const size_t textureCaseCount = isMsaa ? _countof(MSAA_CASES) : _countof(NON_MSAA_CASES);

+        const D3D12_HEAP_FLAGS heapFlags = isMsaa ?

+            D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES :

+            D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES;

         const D3D12_RESOURCE_FLAGS resourceFlags = isMsaa ?

             D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET :

             D3D12_RESOURCE_FLAG_NONE;

@@ -1932,11 +1932,11 @@
 

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

 

-        for (size_t textureCaseIndex = 0; textureCaseIndex < textureCaseCount; ++textureCaseIndex)
-        {
-            const TextureCase& textureCase = textureCases[textureCaseIndex];
-            for (UINT thresholdIndex = 0; thresholdIndex < 2; ++thresholdIndex)
-            {
+        for (size_t textureCaseIndex = 0; textureCaseIndex < textureCaseCount; ++textureCaseIndex)

+        {

+            const TextureCase& textureCase = textureCases[textureCaseIndex];

+            for (UINT thresholdIndex = 0; thresholdIndex < 2; ++thresholdIndex)

+            {

                 const bool belowThreshold = thresholdIndex == 0;

                 D3D12_RESOURCE_DESC resDesc = {};

                 resDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;

@@ -1962,23 +1962,23 @@
                 CHECK_BOOL(alloc0->GetHeap() == alloc1->GetHeap());

 

                 // Note these asserts may fail if you use D3D12MA_USE_SMALL_RESOURCE_PLACEMENT_ALIGNMENT=2.

-                const UINT64 expectedAlignment = belowThreshold ? smallAlignment : largeAlignment;
-                CHECK_BOOL((alloc0->GetOffset() % expectedAlignment) == 0);
-                CHECK_BOOL((alloc1->GetOffset() % expectedAlignment) == 0);
-                if (belowThreshold)
-                {
-                    const UINT64 nonZeroOffset = alloc0->GetOffset() > 0 ? alloc0->GetOffset() : alloc1->GetOffset();
-                    wprintf(L"    Small alignment case: format=%u msaa=%u size=%llux%u offset=%llu -> small alignment %s\n",
-                        (UINT)textureCase.Format,
-                        isMsaa ? 1u : 0u,
-                        resDesc.Width,
-                        resDesc.Height,
-                        nonZeroOffset,
-                        nonZeroOffset < largeAlignment ? L"YES" : L"NO");
-                }
-
-                alloc1.Reset();
-                alloc0.Reset();
+                const UINT64 expectedAlignment = belowThreshold ? smallAlignment : largeAlignment;

+                CHECK_BOOL((alloc0->GetOffset() % expectedAlignment) == 0);

+                CHECK_BOOL((alloc1->GetOffset() % expectedAlignment) == 0);

+                if (belowThreshold)

+                {

+                    const UINT64 nonZeroOffset = alloc0->GetOffset() > 0 ? alloc0->GetOffset() : alloc1->GetOffset();

+                    wprintf(L"    Small alignment case: format=%u msaa=%u size=%llux%u offset=%llu -> small alignment %s\n",

+                        (UINT)textureCase.Format,

+                        isMsaa ? 1u : 0u,

+                        resDesc.Width,

+                        resDesc.Height,

+                        nonZeroOffset,

+                        nonZeroOffset < largeAlignment ? L"YES" : L"NO");

+                }

+

+                alloc1.Reset();

+                alloc0.Reset();

             }

         }

 

@@ -3574,6 +3574,7 @@
 

     // Use a custom pool to make sure our small buffers are not created as committed.

     POOL_DESC poolDesc = {};

+    poolDesc.HeapFlags = D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS;

     poolDesc.BlockSize = MEGABYTE;

     poolDesc.MinBlockCount = poolDesc.MaxBlockCount = 1;