You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/html/_d3_d12_mem_alloc_8h.html
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -226,10 +226,14 @@
226
226
}</td></tr>
227
227
<trclass="memdesc:a82bb787a69699a877b4166789a30e602"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Operation performed on single defragmentation move. <ahref="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602">More...</a><br/></td></tr>
<trclass="memdesc:a919d8545365d6b7209a964f2b99936d1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Bit flags to be used with POOL_DESC::Flags. <ahref="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1">More...</a><br/></td></tr>
<divclass="ttc" id="aclass_d3_d12_m_a_1_1_allocator_html"><divclass="ttname"><ahref="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></div><divclass="ttdoc">Represents main object of this library initialized for particular ID3D12Device.</div><divclass="ttdef"><b>Definition</b> D3D12MemAlloc.h:1107</div></div>
126
+
<divclass="ttc" id="aclass_d3_d12_m_a_1_1_allocator_html"><divclass="ttname"><ahref="class_d3_d12_m_a_1_1_allocator.html">D3D12MA::Allocator</a></div><divclass="ttdoc">Represents main object of this library initialized for particular ID3D12Device.</div><divclass="ttdef"><b>Definition</b> D3D12MemAlloc.h:1118</div></div>
127
127
<divclass="ttc" id="anamespace_d3_d12_m_a_html_ab7a1cd1683986d75ce1488b0920f4cb0"><divclass="ttname"><ahref="namespace_d3_d12_m_a.html#ab7a1cd1683986d75ce1488b0920f4cb0">D3D12MA::CreateAllocator</a></div><divclass="ttdeci">D3D12MA_API HRESULT CreateAllocator(const ALLOCATOR_DESC *pDesc, Allocator **ppAllocator)</div><divclass="ttdoc">Creates new main D3D12MA::Allocator object and returns it through ppAllocator.</div></div>
128
128
<divclass="ttc" id="astruct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s_html"><divclass="ttname"><ahref="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___c_a_l_l_b_a_c_k_s.html">D3D12MA::ALLOCATION_CALLBACKS</a></div><divclass="ttdoc">Custom callbacks to CPU memory allocation functions.</div><divclass="ttdef"><b>Definition</b> D3D12MemAlloc.h:217</div></div>
<divclass="ttc" id="astruct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c_html"><divclass="ttname"><ahref="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html">D3D12MA::ALLOCATOR_DESC</a></div><divclass="ttdoc">Parameters of created Allocator object. To be used with CreateAllocator().</div><divclass="ttdef"><b>Definition</b> D3D12MemAlloc.h:1068</div></div>
<divclass="ttc" id="astruct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c_html"><divclass="ttname"><ahref="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html">D3D12MA::ALLOCATOR_DESC</a></div><divclass="ttdoc">Parameters of created Allocator object. To be used with CreateAllocator().</div><divclass="ttdef"><b>Definition</b> D3D12MemAlloc.h:1079</div></div>
</div><!-- fragment --><h1><aclass="anchor" id="debug_margins"></a>
136
136
Debug margins</h1>
137
137
<p>By default, allocations are laid out in memory blocks next to each other if possible (considering required alignment returned by <code>ID3D12Device::GetResourceAllocationInfo</code>).</p>
</div><!-- fragment --><p>To allocate resources out of a custom pool, only set member <aclass="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html#ab06b85f3cf3254f855b29264477e3934" title="Custom pool to place the new resource in. Optional.">D3D12MA::ALLOCATION_DESC::CustomPool</a>. Example:</p>
Copy file name to clipboardExpand all lines: docs/html/defragmentation.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -207,7 +207,7 @@
207
207
<p><b>Thread safety:</b> It is safe to perform the defragmentation asynchronously to render frames and other Direct3D 12 and D3D12MA usage, possibly from multiple threads, with the exception that allocations returned in <aclass="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___p_a_s_s___m_o_v_e___i_n_f_o.html#a719fbdaae54251759605c41baeb24dc4" title="Array of moves to be performed by the user in the current defragmentation pass.">D3D12MA::DEFRAGMENTATION_PASS_MOVE_INFO::pMoves</a> shouldn't be released until the defragmentation pass is ended. During the call to <aclass="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html#a1606c015d02edc094bb246986159d592" title="Starts single defragmentation pass.">D3D12MA::DefragmentationContext::BeginPass()</a>, any operations on the memory pool affected by the defragmentation are blocked by a mutex.</p>
208
208
<p>What it means in practice is that you shouldn't free any allocations from the defragmented pool since the moment a call to <code>BeginPass</code> begins. Otherwise, a thread performing the <code>allocation->Release()</code> would block for the time <code>BeginPass</code> executes and then free the allocation when it finishes, while the allocation could have ended up on the list of allocations to move. A solution to freeing allocations during defragmentation is to find such allocation on the list <code>pass.pMoves[i]</code> and set its operation to <aclass="el" href="namespace_d3_d12_m_a.html#a82bb787a69699a877b4166789a30e602aa2143507d723de458c2ed94e143ac242" title="Set this value if you decide to abandon the allocation and you destroyed the resource....">D3D12MA::DEFRAGMENTATION_MOVE_OPERATION_DESTROY</a> instead of calling <code>allocation->Release()</code>, or simply deferring the release to the time after defragmentation finished.</p>
209
209
<p><b>Mapping</b> is out of scope of this library and so it is not preserved after an allocation is moved during defragmentation. You need to map the new resource yourself if needed.</p>
210
-
<dlclass="section note"><dt>Note</dt><dd>Defragmentation is not supported in custom pools created with <aclass="el" href="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1aa37a0103f511954ea42a1d0bba286b6a"title="Enables alternative, linear allocation algorithm in this pool.">D3D12MA::POOL_FLAG_ALGORITHM_LINEAR</a>. </dd></dl>
210
+
<dlclass="section note"><dt>Note</dt><dd>Defragmentation is not supported in custom pools created with <aclass="el" href="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1aa37a0103f511954ea42a1d0bba286b6a">D3D12MA::POOL_FLAG_ALGORITHM_LINEAR</a>. </dd></dl>
Copy file name to clipboardExpand all lines: docs/html/linear_algorithm.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -93,7 +93,7 @@
93
93
<divclass="contents">
94
94
<divclass="textblock"><p>Each D3D12 memory block managed by this library has accompanying metadata that keeps track of used and unused regions. By default, the metadata structure and algorithm tries to find best place for new allocations among free regions to optimize memory usage. This way you can allocate and free objects in any order.</p>
<p>Sometimes there is a need to use simpler, linear allocation algorithm. You can create custom pool that uses such algorithm by adding flag <aclass="el" href="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1aa37a0103f511954ea42a1d0bba286b6a"title="Enables alternative, linear allocation algorithm in this pool.">D3D12MA::POOL_FLAG_ALGORITHM_LINEAR</a> to <aclass="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#ac4ed93b0191344d68c0b4ac1a4822ff4" title="Flags.">D3D12MA::POOL_DESC::Flags</a> while creating <aclass="el" href="class_d3_d12_m_a_1_1_pool.html" title="Custom memory pool.">D3D12MA::Pool</a> object. Then an alternative metadata management is used. It always creates new allocations after last one and doesn't reuse free regions after allocations freed in the middle. It results in better allocation performance and less memory consumed by metadata.</p>
96
+
<p>Sometimes there is a need to use simpler, linear allocation algorithm. You can create custom pool that uses such algorithm by adding flag <aclass="el" href="namespace_d3_d12_m_a.html#a919d8545365d6b7209a964f2b99936d1aa37a0103f511954ea42a1d0bba286b6a">D3D12MA::POOL_FLAG_ALGORITHM_LINEAR</a> to <aclass="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#ac4ed93b0191344d68c0b4ac1a4822ff4" title="Flags.">D3D12MA::POOL_DESC::Flags</a> while creating <aclass="el" href="class_d3_d12_m_a_1_1_pool.html" title="Custom memory pool.">D3D12MA::Pool</a> object. Then an alternative metadata management is used. It always creates new allocations after last one and doesn't reuse free regions after allocations freed in the middle. It results in better allocation performance and less memory consumed by metadata.</p>
<p>With this one flag, you can create a custom pool that can be used in many ways: free-at-once, stack, double stack, and ring buffer. See below for details. You don't need to specify explicitly which of these options you are going to use - it is detected automatically.</p>
0 commit comments