Add events for streamable resources residency changes tracking

This commit is contained in:
Wojciech Figat
2022-04-21 12:37:39 +02:00
parent 0a458d94c4
commit 5345d1f685
6 changed files with 27 additions and 7 deletions

View File

@@ -85,6 +85,7 @@ protected:
// Update residency level
model->_loadedLODs++;
model->ResidencyChanged();
return false;
}
@@ -676,11 +677,8 @@ bool SkinnedModel::Init(const Span<int32>& meshesCountPerLod)
// Setup LODs
for (int32 lodIndex = 0; lodIndex < LODs.Count(); lodIndex++)
{
LODs[lodIndex].Dispose();
}
LODs.Resize(meshesCountPerLod.Length());
_loadedLODs = meshesCountPerLod.Length();
// Setup meshes
for (int32 lodIndex = 0; lodIndex < meshesCountPerLod.Length(); lodIndex++)
@@ -699,6 +697,10 @@ bool SkinnedModel::Init(const Span<int32>& meshesCountPerLod)
}
}
// Update resource residency
_loadedLODs = meshesCountPerLod.Length();
ResidencyChanged();
return false;
}
@@ -827,6 +829,7 @@ Task* SkinnedModel::CreateStreamingTask(int32 residency)
for (int32 i = HighestResidentLODIndex(); i < LODs.Count() - residency; i++)
LODs[i].Unload();
_loadedLODs = residency;
ResidencyChanged();
}
return result;