File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1051,6 +1051,11 @@ enum ALLOCATOR_FLAGS
10511051 which may take longer than creating placed resources in existing heaps.
10521052 Passing this flag will disable this committed preference globally for the allocator.
10531053 It can also be disabled for a single allocation by using #ALLOCATION_FLAG_STRATEGY_MIN_TIME.
1054+
1055+ If the tight resource alignment feature is used by the library (which happens automatically whenever supported,
1056+ unless you use flag #ALLOCATOR_FLAG_DONT_USE_TIGHT_ALIGNMENT), then small buffers are not preferred as committed.
1057+ Long story short, you don't need to specify any of these flags.
1058+ The library chooses the most optimal method automatically.
10541059 */
10551060 ALLOCATOR_FLAG_DONT_PREFER_SMALL_BUFFERS_COMMITTED = 0x10 ,
10561061 /* * TODO document... */
Original file line number Diff line number Diff line change @@ -5999,7 +5999,7 @@ class AllocatorPimpl
59995999 const bool m_UseMutex;
60006000 const bool m_AlwaysCommitted;
60016001 const bool m_MsaaAlwaysCommitted;
6002- const bool m_PreferSmallBuffersCommitted;
6002+ bool m_PreferSmallBuffersCommitted;
60036003 const bool m_UseTightAlignment;
60046004 bool m_DefaultPoolsNotZeroed = false ;
60056005 ID3D12Device* m_Device; // AddRef
@@ -6192,6 +6192,14 @@ HRESULT AllocatorPimpl::Init(const ALLOCATOR_DESC& desc)
61926192 if (SUCCEEDED (hr))
61936193 {
61946194 m_TightAlignmentSupported = tightAlignment.SupportTier >= D3D12_TIGHT_ALIGNMENT_TIER_1;
6195+
6196+ // If tight alignment is supported (checked by the code above) and wasn't disabled by the developer
6197+ // (with ALLOCATOR_FLAG_DONT_USE_TIGHT_ALIGNMENT), disable the preference for creating small buffers as committed,
6198+ // as if ALLOCATOR_FLAG_DONT_PREFER_SMALL_BUFFERS_COMMITTED was specified.
6199+ if (IsTightAlignmentEnabled ())
6200+ {
6201+ m_PreferSmallBuffersCommitted = false ;
6202+ }
61956203 }
61966204 }
61976205#endif
You can’t perform that action at this time.
0 commit comments