Track ShaderVisibleDescriptorHeap Upon Allocation
Fixes bug where a newly allocated ShaderVisibleDescriptorHeap would be untracked in the residency LRU upon allocation, causing Dawn's residency manager to become out of sync with D3D12's internal residency refcount by calling MakeResident once more than needed. Bug: dawn:193 Change-Id: I47804471b41df476db989634e50bded6006e05aa Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23125 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
82027bd8ac
commit
9435068a36
|
@ -333,7 +333,10 @@ namespace dawn_native { namespace d3d12 {
|
|||
}
|
||||
|
||||
// Inserts a heap at the bottom of the LRU. The passed heap must be resident or scheduled to
|
||||
// become resident within the current serial.
|
||||
// become resident within the current serial. Failing to call this function when an allocation
|
||||
// is implicitly made resident will cause the residency manager to view the allocation as
|
||||
// non-resident and call MakeResident - which will make D3D12's internal residency refcount on
|
||||
// the allocation out of sync with Dawn.
|
||||
void ResidencyManager::TrackResidentAllocation(Pageable* pageable) {
|
||||
if (!mResidencyManagementEnabled) {
|
||||
return;
|
||||
|
|
|
@ -152,6 +152,9 @@ namespace dawn_native { namespace d3d12 {
|
|||
"ID3D12Device::CreateDescriptorHeap"));
|
||||
descriptorHeap = std::make_unique<ShaderVisibleDescriptorHeap>(
|
||||
std::move(d3d12DescriptorHeap), kSize);
|
||||
// We must track the allocation in the LRU when it is created, otherwise the residency
|
||||
// manager will see the allocation as non-resident in the later call to LockAllocation.
|
||||
mDevice->GetResidencyManager()->TrackResidentAllocation(descriptorHeap.get());
|
||||
}
|
||||
|
||||
DAWN_TRY(mDevice->GetResidencyManager()->LockAllocation(descriptorHeap.get()));
|
||||
|
|
Loading…
Reference in New Issue