Skip to content

Commit 62b73ef

Browse files
Improvement in documentation "Residency priority"
1 parent 1f7e3c6 commit 62b73ef

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

docs/html/optimal_allocation.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ <h1><a class="anchor" id="optimal_allocation_residency_priority"></a>
169169
<div class="ttc" id="astruct_d3_d12_m_a_1_1_c_a_l_l_o_c_a_t_i_o_n___d_e_s_c_html"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_c_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">D3D12MA::CALLOCATION_DESC</a></div><div class="ttdoc">Helper structure that helps with complete and conscise initialization of the D3D12MA::ALLOCATION_DESC...</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:1649</div></div>
170170
<div class="ttc" id="astruct_d3_d12_m_a_1_1_c_p_o_o_l___d_e_s_c_html"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_c_p_o_o_l___d_e_s_c.html">D3D12MA::CPOOL_DESC</a></div><div class="ttdoc">Helper structure that helps with complete and conscise initialization of the D3D12MA::POOL_DESC struc...</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:1685</div></div>
171171
<div class="ttc" id="astruct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c_html_a2e6074af8c8ff7b957fe8d4b5036a5e6"><div class="ttname"><a href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html#a2e6074af8c8ff7b957fe8d4b5036a5e6">D3D12MA::POOL_DESC::ResidencyPriority</a></div><div class="ttdeci">D3D12_RESIDENCY_PRIORITY ResidencyPriority</div><div class="ttdoc">Residency priority to be set for all allocations made in this pool. Optional.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:972</div></div>
172+
</div><!-- fragment --><p>When you have a committed allocation created, you can also set the residency priority of its resource using the D3D12 function:</p>
173+
<div class="fragment"><div class="line"><a class="code hl_class" href="class_d3_d12_m_a_1_1_allocation.html">D3D12MA::Allocation</a>* committedAlloc = ...</div>
174+
<div class="line">ID3D12Pageable* res = committedAlloc-&gt;<a class="code hl_function" href="class_d3_d12_m_a_1_1_allocation.html#ad00308118252f82d8f803c623c67bf18">GetResource</a>();</div>
175+
<div class="line">D3D12_RESIDENCY_PRIORITY priority = D3D12_RESIDENCY_PRIORITY_HIGH;</div>
176+
<div class="line">device1-&gt;SetResidencyPriority(1, &amp;res, &amp;priority);</div>
177+
<div class="ttc" id="aclass_d3_d12_m_a_1_1_allocation_html_ad00308118252f82d8f803c623c67bf18"><div class="ttname"><a href="class_d3_d12_m_a_1_1_allocation.html#ad00308118252f82d8f803c623c67bf18">D3D12MA::Allocation::GetResource</a></div><div class="ttdeci">ID3D12Resource * GetResource() const</div><div class="ttdoc">Returns D3D12 resource associated with this object.</div><div class="ttdef"><b>Definition</b> D3D12MemAlloc.h:550</div></div>
172178
</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>
173179
<h1><a class="anchor" id="optimal_allocation_gpu_upload_heap"></a>
174180
GPU upload heap</h1>

include/D3D12MemAlloc.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,6 +2380,16 @@ hr = allocator->CreateResource(&allocDesc, &resDesc, D3D12_RESOURCE_STATE_COMMON
23802380
// Check hr...
23812381
\endcode
23822382
2383+
When you have a committed allocation created, you can also set the residency priority of its resource
2384+
using the D3D12 function:
2385+
2386+
\code
2387+
D3D12MA::Allocation* committedAlloc = ...
2388+
ID3D12Pageable* res = committedAlloc->GetResource();
2389+
D3D12_RESIDENCY_PRIORITY priority = D3D12_RESIDENCY_PRIORITY_HIGH;
2390+
device1->SetResidencyPriority(1, &res, &priority);
2391+
\endcode
2392+
23832393
Note this is not the same as explicit eviction controlled using `ID3D12Device::Evict` and `MakeResident` functions.
23842394
Resources evicted explicitly are illegal to access until they are made resident again,
23852395
while the demotion described here happens automatically and only slows down the execution.

0 commit comments

Comments
 (0)