Change D3D12 Descriptor Allocator To Invalidate Submitted Descriptors

Changes D3D12 descriptor allocator to invalidate existing descriptors
after the descriptor heap was submitted for use. This fixes a
synchonization issue where stale descriptors were seen as valid because
command list execution ran long.

Bug: dawn:1701
Change-Id: Ibfd450b3be6cf91d66e8dce4ffd19ecf1a37f7f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129920
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
This commit is contained in:
Brandon Jones 2023-04-28 22:31:33 +00:00 committed by Dawn LUCI CQ
parent 948ef4292f
commit df6cb23649
1 changed files with 5 additions and 3 deletions

View File

@ -237,9 +237,11 @@ bool ShaderVisibleDescriptorAllocator::IsLastShaderVisibleHeapInLRUForTesting()
bool ShaderVisibleDescriptorAllocator::IsAllocationStillValid(
const GPUDescriptorHeapAllocation& allocation) const {
// Consider valid if allocated for the pending submit and the shader visible heaps
// have not switched over.
return (allocation.GetLastUsageSerial() > mDevice->GetCompletedCommandSerial() &&
// Descriptor allocations are only valid for the serial they were created for and are
// re-allocated every submit. For this reason, we view any descriptors allocated prior to the
// pending submit as invalid. We must also verify the descriptor heap has not switched (because
// a larger descriptor heap was needed).
return (allocation.GetLastUsageSerial() == mDevice->GetPendingCommandSerial() &&
allocation.GetHeapSerial() == mHeapSerial);
}