d3d12: Use GetResourceAllocationInfo instead of GetCopyableFootprints for residency sizes

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29967>
This commit is contained in:
Jesse Natalie 2024-06-28 09:06:22 -07:00 committed by Marge Bot
parent 1ef3b38ff8
commit e8ab5e4320
2 changed files with 13 additions and 1 deletions

View file

@ -101,7 +101,7 @@ d3d12_bo_wrap_res(struct d3d12_screen *screen, ID3D12Resource *res, enum d3d12_r
bo->residency_status = residency;
bo->last_used_timestamp = 0;
desc.Flags &= ~D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
screen->dev->GetCopyableFootprints(&desc, 0, total_subresources, 0, nullptr, nullptr, nullptr, &bo->estimated_size);
bo->estimated_size = GetResourceAllocationInfo(screen->dev, 0, 1, &desc).SizeInBytes;
if (residency == d3d12_resident) {
mtx_lock(&screen->submit_mutex);
list_add(&bo->residency_list_entry, &screen->residency_list);

View file

@ -88,6 +88,11 @@ GetOutputStreamDesc(ID3D12VideoProcessor *proc)
{
return proc->GetOutputStreamDesc();
}
inline D3D12_RESOURCE_ALLOCATION_INFO
GetResourceAllocationInfo(ID3D12Device *dev, UINT visibleMask, UINT numResourceDescs, const D3D12_RESOURCE_DESC *pResourceDescs)
{
return dev->GetResourceAllocationInfo(visibleMask, numResourceDescs, pResourceDescs);
}
#else
inline D3D12_CPU_DESCRIPTOR_HANDLE
GetCPUDescriptorHandleForHeapStart(ID3D12DescriptorHeap *heap)
@ -138,6 +143,13 @@ GetOutputStreamDesc(ID3D12VideoProcessor *proc)
proc->GetOutputStreamDesc(&ret);
return ret;
}
inline D3D12_RESOURCE_ALLOCATION_INFO
GetResourceAllocationInfo(ID3D12Device *dev, UINT visibleMask, UINT numResourceDescs, const D3D12_RESOURCE_DESC *pResourceDescs)
{
D3D12_RESOURCE_ALLOCATION_INFO ret;
dev->GetResourceAllocationInfo(&ret, visibleMask, numResourceDescs, pResourceDescs);
return ret;
}
#endif
#endif