Re-add heap usage tracking for textures in a pass
Heap usage tracking for textures in a pass was mistakenly removed when
texture subresource transitions was implemented. This must be re-added
for residency management to work (and not crash the application).
Bug: dawn:193
Change-Id: Ie5e9622f88a70d153232d5d72bb11846f4164e87
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26461
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
diff --git a/src/dawn_native/d3d12/TextureD3D12.cpp b/src/dawn_native/d3d12/TextureD3D12.cpp
index 62fe6e9..7767aa8 100644
--- a/src/dawn_native/d3d12/TextureD3D12.cpp
+++ b/src/dawn_native/d3d12/TextureD3D12.cpp
@@ -722,6 +722,12 @@
CommandRecordingContext* commandContext,
std::vector<D3D12_RESOURCE_BARRIER>* barriers,
const PassTextureUsage& textureUsages) {
+ if (mResourceAllocation.GetInfo().mMethod != AllocationMethod::kExternal) {
+ // Track the underlying heap to ensure residency.
+ Heap* heap = ToBackend(mResourceAllocation.GetResourceHeap());
+ commandContext->TrackHeapUsage(heap, GetDevice()->GetPendingCommandSerial());
+ }
+
HandleTransitionSpecialCases(commandContext);
const Serial pendingCommandSerial = ToBackend(GetDevice())->GetPendingCommandSerial();