Commit Graph

866 Commits

Author SHA1 Message Date
Matt Peters
3c2010d281 AppendToClassSchemaContext: Hide the use of FBlake3 behind an interface so we can easily change it.
#rb Steve.Robb
#rnx
#preflight 62975270a660a44a23b4ac94

[CL 20451128 by Matt Peters in ue5-main branch]
2022-06-01 08:05:42 -04:00
robert manuszewski
d1443992e1 Deprecating ANY_PACKAGE.
This change consists of multiple changes:

Core:
- Deprecation of ANY_PACKAGE macro. Added ANY_PACKAGE_DEPRECATED macro which can still be used for backwards compatibility purposes (only used in CoreUObject)
- Deprecation of StaticFindObjectFast* functions that take bAnyPackage parameter
- Added UStruct::GetStructPathName function that returns FTopLevelAssetPath representing the path name (package + object FName, super quick compared to UObject::GetPathName) + wrapper UClass::GetClassPathName to make it look better when used with UClasses
- Added (Static)FindFirstObject* functions that find a first object given its Name (no Outer). These functions are used in places I consider valid to do global UObject (UClass) lookups like parsing command line parameters / checking for unique object names
- Added static UClass::TryFindType function which serves a similar purpose as FindFirstObject however it's going to throw a warning (with a callstack / maybe ensure in the future?) if short class name is provided. This function is used  in places that used to use short class names but now should have been converted to use path names to catch any potential regressions and or edge cases I missed.
- Added static UClass::TryConvertShortNameToPathName utility function
- Added static UClass::TryFixShortClassNameExportPath utility function
- Object text export paths will now also include class path (Texture2D'/Game/Textures/Grass.Grass' -> /Script/Engine.Texture2D'/Game/Textures/Grass.Grass')
- All places that manually generated object export paths for objects will now use FObjectPropertyBase::GetExportPath
- Added a new startup test that checks for short type names in UClass/FProperty MetaData values

AssetRegistry:
- Deprecated any member variables (FAssetData / FARFilter) or functions that use FNames to represent class names and replaced them with FTopLevelAssetPath
- Added new member variables and new function overloads that use FTopLevelAssetPath to represent class names
- This also applies to a few other modules' APIs to match AssetRegistry changes

Everything else:
- Updated code that used ANY_PACKAGE (depending on the use case) to use FindObject(nullptr, PathToObject), UClass::TryFindType (used when path name is expected, warns if it's a short name) or FindFirstObject (usually for finding types based on user input but there's been a few legitimate use cases not related to user input)
- Updated code that used AssetRegistry API to use FTopLevelAssetPaths and USomeClass::StaticClass()->GetClassPathName() instead of GetFName()
- Updated meta data and hardcoded FindObject(ANY_PACKAGE, "EEnumNameOrClassName") calls to use path names

#jira UE-99463
#rb many.people
[FYI] Marcus.Wassmer
#preflight 629248ec2256738f75de9b32

#codereviewnumbers 20320742, 20320791, 20320799, 20320756, 20320809, 20320830, 20320840, 20320846, 20320851, 20320863, 20320780, 20320765, 20320876, 20320786

#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 20430220 via CL 20433854 via CL 20435474 via CL 20435484
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v949-20362246)

[CL 20448496 by robert manuszewski in ue5-main branch]
2022-06-01 03:46:59 -04:00
CarlMagnus Nordin
3d5a2052dc AsyncLoading2: Add support for having multiple PackageStore backends
#preflight 6296fc872a1851b4ccae7e39
#rb pj.kack

[CL 20447121 by CarlMagnus Nordin in ue5-main branch]
2022-06-01 02:12:33 -04:00
Devin Doucette
87340081ea DerivedData: Added a new API in place of the use of IoDispatcher
#preflight 62961234e62c873b96c939d5
#rb Zousar.Shaker

[CL 20445536 by Devin Doucette in ue5-main branch]
2022-05-31 22:01:40 -04:00
Per Larsson
b1fcb5183a BulkData - enable serialize bulk data size as 64bit integer by setting BULKDATA_Size64Bit
#rb Paull.Chipchase
#jira none
#preflight 62964d390126cadbd3cccf89

[CL 20440503 by Per Larsson in ue5-main branch]
2022-05-31 15:18:37 -04:00
Per Larsson
88f2de0b83 Removed disable optimization pragma and unused header
#rb none
#jira none
#preflight 629094a9f6668c14a3c758a1

[CL 20391200 by Per Larsson in ue5-main branch]
2022-05-27 05:24:20 -04:00
Per Larsson
c30e677d1b Merge BulkData 1&2
#rb Paul.Chipchase, PJ.Kack, CarlMagnus.Nordin
#jira none
#preflight 629085d14f63120d8e170977

###
This change attempts to merge the editor and the runtime version of bulk data, i.e. bulk data one and two.
The major difference between the two is the fact that the editor version supported element vice
serialization via inheritance. This has been complelety removed in the runtime version. In order
to mitigate this divergance a non-virtual base class has been extracted that forms the base
for the untyped and typed versions of bulk data.
The untyped version is only used in editor and will be deprecated. However this is a breaking change,
previously it was possible to inherit from FByteBulkData in editor builds.
Other differences between the two includes:
* IsBulkDataLoaded - returns true for bulk data 1 if an allocation has been made even if the size is zero
* StartStreaming - was removed in bulk data 2 and has been removed
* FlushAsyncLoading - bulk data 2 was busy waiting, now an event is used

All I/O related functionality has been extracted into BulkDataStreaming.cpp and is using
a  FBulkDataChunkId that is either a package path or a package ID.This could potentially
be extended to contain a cache key in development builds to support loading from DDC, i.e derived
data references.

[CL 20391050 by Per Larsson in ue5-main branch]
2022-05-27 04:31:58 -04:00
devin doucette
b2a07ea03e DDC: Merge from UE5/Main
#preflight 6288ff678828ea88c8af7034
#preflight 628ab5d93246d5019db76ed2
#rb none
#rnx

#ROBOMERGE-OWNER: devin.doucette
#ROBOMERGE-AUTHOR: Devin.Doucette
#ROBOMERGE-SOURCE: CL 20353148 via CL 20353832 via CL 20353839
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v948-20297126)

[CL 20355348 by devin doucette in ue5-main branch]
2022-05-24 16:40:25 -04:00
Matt Peters
0baa95d653 EditorBulkDatas need to create new guids to avoid duplication when they are loading from an instanced load, since instanced loads duplicate data from a source package into a new package of a different name.
#jira UE-152829
#rb Paul.Chipchase
#rnx
#preflight 628cd21cf057b981ca5edf3f

[CL 20347479 by Matt Peters in ue5-main branch]
2022-05-24 09:36:42 -04:00
CarlMagnus Nordin
a694071dbe AsyncLoading2: Keep the full package path for loaded packages instead of just the package name
#rb pj.kack
#preflight 628c99cff057b981ca4cdbc3

[CL 20345705 by CarlMagnus Nordin in ue5-main branch]
2022-05-24 05:33:01 -04:00
PJ Kack
c64e25117a AsyncLoading2: Fix nullptr crash inside check format statement.
#jira UE-153083
#rb trivial
#rnx
#preflight 62873f779016c6dd89bfedca

[CL 20291931 by PJ Kack in ue5-main branch]
2022-05-20 03:26:53 -04:00
Matt Peters
02ba0b5b70 ZenStoreWriter: Fix assertion "Trying to add package that is already pending" if the cooker commits a package a second time while the first commit of the package is queued for asynchronous completion aand has not yet reached CommitPackageInternal.
This is necessary because as of CL 20151503, the cooker can commit the same package multiple times if the first save failed due to a timeout.

#fyi CarlMagnus.Nordin
#rnx
#rb Per.Larsson
#preflight 62853ba90f0d5076dee74ced

[CL 20265738 by Matt Peters in ue5-main branch]
2022-05-18 14:49:11 -04:00
Matt Peters
820edc49b5 EditorDomain: Add UObject::AppendToClassSchema so that textures can declare EnableLegacyAlphaCoverageThresholdScaling and use different EditorDomain packages when that variable is changed. This will also add to the new hybrid iterative cook system to allow detection of when iteratively-cooked packages need to be invalidated due to changes in Serialize and PostLoad.
#rb Zousar.Shaker
#rnx
#preflight 6284e723614041edb7763cef

[CL 20259777 by Matt Peters in ue5-main branch]
2022-05-18 09:02:27 -04:00
paul chipchase
4466749eba Fix a bug where saving a static mesh multiple times would cause it to emit serialization warnings about invalid flags when loaded.
#rb Per.Larsson
#rnx
#jira UE-152823
#preflight 6284afb4f239239af66dd215

### Problem
- When saving an editor bulkdata with an invalid (empty) payload, it was being incorrectly identified has sharing a payload with another bulkdata instance that had already been virtualized and so was applying the virtualization flag to itself on post save.
- When saved a second time this incorrect flag would be saved to the bulkdata object itself.
- When loading we would detect that the bulkdata believed itself to be virtualized even though virtualizing an empty payload makes no sense and would emit the log warning.

### Fix
- When fixing up an editor bulkdata after saving we should not check to see if the payload is a virtualized duplicate if the payload is invalid.
- Additionally we should not record the package path if the payload is invalid as there would be nothing to load from.

[CL 20258991 by paul chipchase in ue5-main branch]
2022-05-18 07:04:56 -04:00
paul chipchase
f85fad88ff It is now possible to disable virtualization for all payloads owned by a specific asset type by adding the name of the asset to [Core.ContentVirtualization]DisabledAsset string array in the engine ini file.
#rb Per.Larsson
#rnx
#jira UE-151377
#preflight 628364050039ea57a52d6989

### Virtualization
- [Core.ContentVirtualization] in the engine ini file now supports an array called 'DisabledAsset' which can be used to name asset types that should not virtualize their payloads.
-- By default (in BaseEngine.ini) we have disabled the StaticMesh asset as we know it will crash if a payload is missing and the SoundWave asset as it still is pending testing.
- This new way to disable virtualization is data driven. The older hard coded method has not been removed but will likely be reworked in a future submit.
- Now when an editor bulkdata is adding it's payload to the package trailer builder during package save it will poll the virtualization system with a call to the new method ::IsDisabledForObject by passing in it's owner.
-- If the owner is valid and was present in the 'DisabledAsset' array then the method will return true and the EPayloadFlags::DisableVirtualization flag will be applied.

### Package Trailer
- The pre-existing functionality of enum EPayloadFilter has been moved to a new enum EPayloadStorageType as will only filter payloads based on their storage type.
- EPayloadFilter has been modified to filter payloads based on functionality although at the moment the only thing it can filter for is to return payloads that can be virtualized, it is left for future expansion.
- EPayloadFlags has been reduced to a uint16 with the remaining 2bytes being turned into a new member EPayloadFilterReason.
- This new member allows us to record the exact reason why a payload is excluded from virtualization. If it is zero then the payload can virtualize, otherwise it will contain one or more reasons as to why it is being excluded. For this reason the enum is a bitfield.
- Added overloads of ::GetPayloads and ::GetNumPayloads that take EPayloadFilter rather than a EPayloadStorageType
- Added wrappers around all AccessMode types for FLookupTableEntry.
- FPackageTrailerBuilder has been extended to take a EPayloadFilterReason so that the caller can already provide a reason why the payload cannot be virtualized.
-- As a future peace of work this will probably be changed and we will ask the caller to pass in the owner UObject pointer instead and then we will process the filtering when building the package trailer to a) keep all of the filtering code in one place b) keep the filtering consistent

### PackageSubmissionChecks
- The virtualization process in  will now request the payloads that can be virtualized from the package trailer, which respects the new payload flag, rather than requesting all locally stored payloads.

### UObjects
- There is no need for the SoundWave or MeshDescription classes to opt out of virtualization on construction. This will be done when the package is saved and is now data driven rather than being hardcoded.

### DumpPackagePayloadInfo
- The command has been updated to also display the filter reasons applied to each payload

[CL 20240971 by paul chipchase in ue5-main branch]
2022-05-17 07:54:28 -04:00
Marc Audy
d9c630dcd8 Add IsInheritedInstance to exports
#rb Phillip.Kavan
Add missing generate public hash entries to ArchiveStackTrace
#fyi Francis.Hurteau
#preflight 626c692cb046e6ecc338080e
#lockdown JeanFrancois.Dube

[CL 19988606 by Marc Audy in ue5-main branch]
2022-04-29 20:15:15 -04:00
Marc Audy
a8fa02a366 Shrink FObjectExport (144 -> 120): Remove deprecated PackageGUID and Dynamic Type, and properly pack members
#rb Robert.Millar
#lockdown JeanFrancois.Dube
#preflight 626c50940b45792efb69a48c

[CL 19986766 by Marc Audy in ue5-main branch]
2022-04-29 17:38:17 -04:00
tom noonan
109c87dac2 Make sure one time init code in IsEventDrivenLoaderEnabled() is run in async loading thread construction
[REVIEW] [at]robert.manuszewski
#preflight 626bfda453253f874bd08bb8

#ROBOMERGE-AUTHOR: tom.noonan
#ROBOMERGE-SOURCE: CL 19980945 via CL 19980998 via CL 19981041 via CL 19981068
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 19985862 by tom noonan in ue5-main branch]
2022-04-29 17:05:33 -04:00
Matt Peters
cac1474ec5 BulkDataRegistry: Add comment about silencing the duplicate guid warning.
#rb None, trivial
#rnx
#preflight None, trivial

[CL 19984468 by Matt Peters in ue5-main branch]
2022-04-29 16:03:04 -04:00
paul chipchase
22d32b8eca Remove part of the fix from CL 19963043 as it had unintended consequences and needs rethinking
#rb trivial
#rnx
#preflight 626b9cbb53253f874b90efd3

- Although we don't really want to write out the virtualization flag, by removing it during ::BuildFlagsForSerialization we later check UpdatedFlags to see if the payload is virtualized and if we should write it out to disk or not.
- Removing the flag means we re-hydrate virtualized payloads when saved to disk, or in the case of an editordomain, try to store it as a local payload in the editor domain trailer which is not supported (if we did have a newly generated payload in an editor domain save it should go to the legacy path for now)
- The fix for this is probably quite simple, but the testing it would require means it's better to pull out the line of code and allow packages to serialize out the virtualization flag for now until a better fix is ready.

[CL 19976045 by paul chipchase in ue5-main branch]
2022-04-29 04:15:29 -04:00
paul chipchase
5fb1389ae8 Fix a number of bugs found when saving more complex package types with virtualization enabled.
#rb PJ.Kack
#rnx
#preflight 626a7ef2485a2fed3a2e04d7

- Note that these problems were not causing crashes, but they did cause errors to be logged about invalid formats and request the packages to be re-saved.
- Most of the problem comes from the code paths being too complicated, hopefully now things are locked down we should be able to start pruning this soon and make it easier to maintain in the future.

### Problem
- The problem comes from certain package setups that allow for the existence of duplicate payload entries where one entry is local or referenced and another version is virtualized. If a trailer is created from this data then the virtualized entry will be discarded (as the look up table is a map) and we revert to using the non virtualized payload instead. Ideally we'd want to discard the local/referenced payloads in favour of the virtualized one to save space.
-- By itself this bug would waste disk space but not cause other problems, however we were also writing out the virtualized flag so that when the bulkdata is next loaded it has the virtualized flag but then checks with the trailer and is told that it is not virtualized which triggers some asserts I added to find badly formed data.
- How the package gets duplicate entries like this is somewhat complicated involing duplicating objects from other (already virtualized) packages during load, then saving them (found in packages with Niagra assets at least)

### Fix
- When creating a trailer from a trailer build, we first find any local and/or referenced entries and check if there are duplicate entries in the virtualized payload entries. If so we remove the local/referenced version in favor of using the virtualized version.
-- Ideally we'd do this during the serialization of exports as it might let us skip the loading of some payloads for save entirely, however we don't know all the entries until after export serialization is completed so this is the only point we can search for duplicates safely.
- Added a way to get the full name of the owning asset, including package name + asset, when asking the user to re-save. This makes debugging the problems easier.
- Add a new check when loading to find payloads saved with the virtualization flag and to a trailer. If we do find one we warn the user that they should re-save the package and remove the flag so that no further problems occur.
- Demoted the old check for bad formats to a warning as we don't need to fail builds because of it.
-- Additionally we now only give the warning if we detect that we are loading from a package, as being virtualized and not in a package trailer would be valid when loading from other sources.
- Added comments to consider removing both checks asking the user to re-save the package after 5.2, as in theory we should only ever see these problems internally at Epic as it is unlikely that externals will have enabled the system.
- When saving a virtualized payload to the trailer, make sure to remove the virtualized flag, that should be picked up on load by polling the trailer for the payload status and should not be baked into the export data.
-- Hypothetically this will allow for us to re-hydrate the package without re-saving it through manipulating the trailer.

[CL 19963043 by paul chipchase in ue5-main branch]
2022-04-28 11:45:40 -04:00
paul chipchase
e692df4b3e Fix a bug where virtualized payloads were writing incorrect flags to the editor domain version of the package.
#rb Matt.Peters
#rnx
#preflight 626a9f386461dd769fea25df

- If a payload was virtualized it was incorrectly being marked as requiring the legacy serialization path.
- This would technically work but was triggering a log warning about the bulkdata being stored in the wrong format (since it was in the legacy format) as we do not expect bulkdata with virtualized payloads to use the legacy path.
- We need to change the editor domain version to clear out any bad entries

[CL 19961539 by paul chipchase in ue5-main branch]
2022-04-28 10:29:48 -04:00
Matt Peters
e6687c56ac BulkDataRegistry: Fix EditorBuildInputResolver to set Status to Error in the cases where a registered BulkData is found but it cannot find its payload.
Remove bValid from FMetaData and FData return structs; it is redundant with the RawHash/Buffer data already present in those structs.
#preflight 62680b42430b9997ebe0a46d
#rb Devin.Doucette
#rnx

[CL 19923039 by Matt Peters in ue5-main branch]
2022-04-26 12:47:22 -04:00
Matt Peters
6da6eb0ffc BulkDataRegistry: Add an ini setting for projects to suppress the warning about duplicate ids.
#rb Zousar.Shaker
#rnx
#preflight 62668f947e06ec75059dd40e

[CL 19900672 by Matt Peters in ue5-main branch]
2022-04-25 08:24:25 -04:00
CarlMagnus Nordin
63b8cbc9dd AsyncLoading2: Implemented loading of optional package segments
#rnx
#preflight 62627548ac29fcf6a213fe33
#rb francis.hurteau

[CL 19900368 by CarlMagnus Nordin in ue5-main branch]
2022-04-25 07:37:07 -04:00