FlushAsyncLoading prior to disallowing any new requests as requests done during the scope of the flush are going to get flushed as well.

Directly use the loader to issue sync load from LoadPackage

#rb Danny.Couture, Robert.Millar

[CL 29605987 by francis hurteau in ue5-main branch]
This commit is contained in:
francis hurteau
2023-11-09 14:52:55 -05:00
parent 132523925f
commit bf6dacedd0
2 changed files with 12 additions and 6 deletions

View File

@@ -1661,9 +1661,15 @@ UPackage* LoadPackageInternal(UPackage* InOuter, const FPackagePath& PackagePath
PackageFlags |= PKG_PlayInEditor;
}
#endif
constexpr int32 PIEInstanceID = INDEX_NONE;
constexpr int32 Priority = INT32_MAX;
int32 RequestID = LoadPackageAsync(PackagePath, PackageName, FLoadPackageAsyncDelegate(), PackageFlags, PIEInstanceID, Priority, InstancingContext, LoadFlags);
FLoadPackageAsyncOptionalParams OptionalParams
{
.CustomPackageName = PackageName,
.PackageFlags = PackageFlags,
.PackagePriority = INT32_MAX,
.InstancingContext = InstancingContext,
.LoadFlags = LoadFlags
};
int32 RequestID = LoadPackageAsync(PackagePath, MoveTemp(OptionalParams));
if (RequestID != INDEX_NONE)
{

View File

@@ -5053,9 +5053,6 @@ void FEngineLoop::Exit()
// Make sure we're not in the middle of loading something.
{
// From now on it's not allowed to request new async loads
SetAsyncLoadingAllowed(false);
bool bFlushOnExit = true;
if (GConfig)
{
@@ -5070,6 +5067,9 @@ void FEngineLoop::Exit()
{
CancelAsyncLoading();
}
// From now on it's not allowed to request new async loads
// any new requests done during the scope of the flush should have been flushed as well, now prevent any new requests
SetAsyncLoadingAllowed(false);
}
// Block till all outstanding resource streaming requests are fulfilled.