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
<li>The allocation (resource creation) function call can fail with <code>HRESULT</code> value other than <code>S_OK</code>.</li>
100
100
<li>The allocation may succeed, but take long time (even a significant fraction of a second).</li>
101
-
<li>Some resources are automatically evicted from video memory to system memory, degrading the app performance.</li>
101
+
<li>Some resources are automatically demoted from video memory to system memory, degrading the app performance.</li>
102
102
<li>Even a crash of the entire graphics driver can happen, resulting in the D3D12 "device removal", which is usually catastrophic for the application.</li>
103
103
</ul>
104
104
<p>Unfortunately, there is no way to be 100% protected against memory overcommitment. The best approach is to avoid allocating too much memory.</p>
<p>When sub-allocating a buffer, you need to remember to explicitly request proper alignment required for each region. For example, data used as a constant buffer must be aligned to <code>D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT</code> = 256 B.</p>
<p>When too much video memory is allocated, one of the things that can happen is the system evicting some heaps to the system memory. Moving data between memory pools or reaching out directly to the system memory through PCI Express bus can have large performance overhead, which can slow down the application, or even make the game unplayable any more. Unfortunately, it is not possible to fully control or prevent this eviction. Best thing to do is avoiding memory over-commitment. For more information, see section "Avoiding running out of memory" above.</p>
142
+
<p>When too much video memory is allocated, one of the things that can happen is the system demoting some heaps to the system memory. Moving data between memory pools or reaching out directly to the system memory through PCI Express bus can have large performance overhead, which can slow down the application, or even make the game unplayable any more. Unfortunately, it is not possible to fully control or prevent this demotion. Best thing to do is avoiding memory over-commitment. For more information, see section "Avoiding running out of memory" above.</p>
143
143
<p>Recent versions of DirectX 12 SDK offer function <code>ID3D12Device1::SetResidencyPriority</code> that sets a hint about the priority of a resource - how important it is to stay resident in the video memory. Setting the priority happens at the level of an entire memory heap. D3D12MA offers an interface to set this priority in form of <aclass="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#a2e6074af8c8ff7b957fe8d4b5036a5e6" title="Residency priority to be set for all allocations made in this pool. Optional.">D3D12MA::POOL_DESC::ResidencyPriority</a> parameter. It affects all allocations made out of the custom pool created with it, both placed inside large heaps and created as committed.</p>
144
-
<p>It is recommended to create a custom pool for the purpose of using high residency priority of all resources that are critical for the performance, especially those that are written by the GPU, like render-target, depth-stencil textures, UAV textures and buffers. It is also worth creating them as committed, so that each one will have its own implicit heap. This can minimize the chance that an entire large heap is evicted to system memory, degrading performance of all the resources placed in it.</p>
144
+
<p>It is recommended to create a custom pool for the purpose of using high residency priority of all resources that are critical for the performance, especially those that are written by the GPU, like render-target, depth-stencil textures, UAV textures and buffers. It is also worth creating them as committed, so that each one will have its own implicit heap. This can minimize the chance that an entire large heap is demoted to system memory, degrading performance of all the resources placed in it.</p>
<divclass="ttc" id="astruct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c_html_a06e06813bcb5206e9f7a8b0564bf1d6a"><divclass="ttname"><ahref="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#a06e06813bcb5206e9f7a8b0564bf1d6a">D3D12MA::POOL_DESC::HeapProperties</a></div><divclass="ttdeci">D3D12_HEAP_PROPERTIES HeapProperties</div><divclass="ttdoc">The parameters of memory heap where allocations of this pool should be placed.</div><divclass="ttdef"><b>Definition</b> D3D12MemAlloc.h:866</div></div>
183
183
<divclass="ttc" id="astruct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c_html_a2e6074af8c8ff7b957fe8d4b5036a5e6"><divclass="ttname"><ahref="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#a2e6074af8c8ff7b957fe8d4b5036a5e6">D3D12MA::POOL_DESC::ResidencyPriority</a></div><divclass="ttdeci">D3D12_RESIDENCY_PRIORITY ResidencyPriority</div><divclass="ttdoc">Residency priority to be set for all allocations made in this pool. Optional.</div><divclass="ttdef"><b>Definition</b> D3D12MemAlloc.h:931</div></div>
184
184
<divclass="ttc" id="astruct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c_html_a3795956e4fbfe7c3a23546e02e5d28dc"><divclass="ttname"><ahref="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#a3795956e4fbfe7c3a23546e02e5d28dc">D3D12MA::POOL_DESC::HeapFlags</a></div><divclass="ttdeci">D3D12_HEAP_FLAGS HeapFlags</div><divclass="ttdoc">Heap flags to be used when allocating heaps of this pool.</div><divclass="ttdef"><b>Definition</b> D3D12MemAlloc.h:877</div></div>
185
-
</div><!-- fragment --><p>Note this is not the same as explicit eviction controlled using <code>ID3D12Device::Evict</code> and <code>MakeResident</code> functions. Resources evicted explicitly are illegal to access until they are made resident again, while the eviction described here happens automatically and only slows down the execution.</p>
185
+
</div><!-- fragment --><p>Note this is not the same as explicit eviction controlled using <code>ID3D12Device::Evict</code> and <code>MakeResident</code> functions. Resources evicted explicitly are illegal to access until they are made resident again, while the demotion described here happens automatically and only slows down the execution.</p>
0 commit comments