Add manual chunks loading before Binary Asset load in case content streaming flushed them out

This commit is contained in:
Wojtek Figat
2024-03-14 17:30:28 +01:00
parent 2b82da9511
commit 7545e49284

View File

@@ -584,6 +584,17 @@ Asset::LoadResult BinaryAsset::loadAsset()
ASSERT(Storage && _header.ID.IsValid() && _header.TypeName.HasChars());
auto lock = Storage->Lock();
auto chunksToPreload = getChunksToPreload();
if (chunksToPreload != 0)
{
// Ensure that any chunks that were requested before are loaded in memory (in case streaming flushed them out after timeout)
for (int32 i = 0; i < ASSET_FILE_DATA_CHUNKS; i++)
{
const auto chunk = _header.Chunks[i];
if (GET_CHUNK_FLAG(i) & chunksToPreload && chunk && chunk->IsMissing())
Storage->LoadAssetChunk(chunk);
}
}
const LoadResult result = load();
#if !BUILD_RELEASE
if (result == LoadResult::MissingDataChunk)