Commit Graph

17 Commits

Author SHA1 Message Date
Matt Peters
07a0af0f5b BulkDataRegistry
Updating FVirtualizedUntypedBulkData and textures to use the BulkDataRegistry.
BulkDataRegistry: Add get/put accessors for the cached BulkDataList of packages.
EditorDomain: Move ClassDigests into a global variable that can be shared with BulkDataRegistry.
EditorDomain: Improve performance of GetFileSize by fetching metadata only.
Tickable Cook Objects, for systems used by the cooker that need to be ticked.
Implementation of the the BulkDataRegistry that uses the DDC cache for persistent storage of the BulkDataList.

#rb Devin.Doucette, Paul.Chipchase, Zousar.Shaker

[CL 16768772 by Matt Peters in ue5-main branch]
2021-06-24 00:50:53 -04:00
Matt Peters
c70c4d00f1 VirtualizedBulkData: fix incorrect serialized PayloadIds for editordomain versions of non-virtual payloads that virtualize on save; the incorrect paylodIds were noticeable by the "Failed to pull virtual data with guid" error when loading the saved package.
#rb Paul.Chipchase
#rnx

[CL 16754551 by Matt Peters in ue5-main branch]
2021-06-23 04:07:31 -04:00
paul chipchase
1178d572e0 Remove UE_USE_VIRTUALBULKDATA and the associated code path, there is now no easy way to revert back to old bulkdata format for StaticMesh/Textures.
#rb Danny.Couture
#rnx
#preflight 60d0386978c3b00001d06c06

* Macro removal
- UE_USE_VIRTUALBULKDATA: Asssumed to be 1.
- UE_VBD_TO_OLD_BULKDATA_PATH: Assumed to be 0 and code paths entirely deleted.
- UE_VBD_CONST: Assumed to be'const'
- Now that these macros are no longer in use some includes of VirtualizationManager.h can be removed (or moved to the cpp).

*VirtualizedBulkData
- No longer need need to include VirtualizationManager.h in the bulkdata header file so that is moved to the cpp.
- Removed ::GetBulkDataSize which was only added to keep compatibility to older code paths. This method has not yet been released publicly(it's not in EA) so we don't need to worry that anyone is actually using it.
- Add a new method ::HasPayloadData that allows the caller to poll if the payload exists and if it has a valid data length rather than calling ::GetPayloadSize (I'd like to move away from the need for calling code to know how large the payload is until the payload is actually pulled as it will make eventual thread safety code easier to do in the future).
- Added a method ::SetCompressionFormat that allows the compression format to be changed. Normally this should only be done when ::UpdatePayload is called but we need a way to fix old textures that were saved with the wrong compression flags for a time and to do that we need to be able to 'reset' the compression format in some cases. The method is documented to try and make it clear that this is not really intended for general use. At some point in the future if the engine mandates that packages be resaved to a specific version we can look into deprecating this call.

*StaticMeshSourceData
- MESHDATAKEY_STATICMESH_DERIVEDDATA_VER is currently 1 character shorter than it should be, but that doesn't seem worth changing the key to fix.

*Texture
- When accessing data from IImageWrapper we can take the data pointer directly from the TArray and give it's ownership to the FSharedBuffer being returned rather than cloning it.
- Deprecated FTextureSource::LoadBulkDataWithFileReader as with VBD it will always return true.
- FMipAllocation cannot yet be deleted as it is still required for Lock/Unlock but we can remove the support for old style FByteBulkData for now. There is further clean up work to be done here but we would have to make bigger changes to the FTextureSource api.
- FMipData can now store the data in FSharedBuffer format. In the future we can allow people to access mips via views rather than always taking copies to reduce unnecessary data transfer. This also eliminates the need to pass in a lock.
- FTextureSource::InitLayered still supports the parameter 'NewData' potentially being nullptr (in which case we set the texture data to uninitialized memory) this is another candidate for a future code clean up.
- Added a ::HasPayloadData to use instead of ::GetSizeOnDisk as in many cases the calling code is only interested if there is data at all and not what the exact size is.

* Testing
- Ran benchmarks before/after for cold cooks of an internal project showing overall cook times going from 1:54:28 down to 1:49:36 on average.

[CL 16727381 by paul chipchase in ue5-main branch]
2021-06-21 08:53:20 -04:00
paul chipchase
af7d850d37 Prevent -inf values from showing up for the MBps entries in Mirage stats logging code.
- If the time for the selection is 0.0 then just use 0.0 as the result, don't divide.

#rb trivial
#preflight 60cb73229f123700012ec005

[CL 16706893 by paul chipchase in ue5-main branch]
2021-06-17 13:41:27 -04:00
Matt Peters
7c9ccbd78d VirtualizedBulkData: Support serializing out references to legacy bulk data when saving to the editor domain, to avoid the disk space and cpu costs of upgrading it and saving a copy.
#rb Paul.Chipchase
#rnx

[CL 16657428 by Matt Peters in ue5-main branch]
2021-06-14 08:40:14 -04:00
paul chipchase
6958a4faa7 Add some basic profile data to Mirage to make it easier for people to see when payloads are being pushed to or pulled from the various backends.
#rb Per.Larsson
#rnx

* VirtualizationManager
- Add method ::IsEnabled which allows the caller to poll if content virtualization is enabled or not.
- Add method ::GetPayloadActivityInfo to return profiling data
- Added a new Profiling namespace containing all of the profiling code.
-- The idea is to try and keep all profiling data contained in the virtualization manager and not require the backends to be aware of it.
- The actual pull/push operations have been moved to new private methods ::TryPushDataToBackend and ::PullDataFromBackend, by limiting the scolpe of where the actual operation occur makes it easier to add the profiling code.
- We use the cooking stats system for recording our profiling data. Currently this adds no real value and we could've implemented our own but longer term this code might get hooked into FCookStatsManager:: CookStatsCallbacks to add it to our telemetry systems and this will be easier to do if it is already in the cooking stats formats.

* SVirtualizationStaticIndicator
- The widget is based on SDDCStatusIndicator for the DDC and is placed just before it in the UI.
- The widget will only be shown if the content virtualization system is enabled, so functions as an easy way to check that (maybe in the future it can be on all the time in which case we'd need the widget to reflect when the systems are disabled)
- Currently shows a green down arrow when a payload has been pulled and a green up arrow when a payload has been pushed.
- The tool tip shown on mouse over will show the total data sizes pulled and pushed from the backends.
#preflight 60b87c34ae46a100017d5334

[CL 16544645 by paul chipchase in ue5-main branch]
2021-06-03 04:35:17 -04:00
paul chipchase
74fdf40612 Clean up FVirtualizedUntypedBulkData::SerializeData to use the recently added serialization operator for FCompressedBuffer.
#rb Per.Larsson
#rnx
#preflight 60a65460f94e3c0001f492c4

[CL 16401426 by paul chipchase in ue5-main branch]
2021-05-20 09:08:49 -04:00
paul chipchase
04229b992f IVirtualizationBackend::PushData now returns an enum describing what happened to the operation rather than a straight true/false.
#rb Per.Larsson
#rnx
#preflight 60a4f14665d94d00015be8d8

[CL 16383162 by paul chipchase in ue5-main branch]
2021-05-19 07:46:07 -04:00
Matt Peters
b90ea68f18 VirtualBulkData and EditorDomain: Do not update the PackagePath for VirtualBulkData if SavePackage is saving to a copy rather than updating the Package's PackagePath.
#rb Paul.ChipChase
#rnx

[CL 16328647 by Matt Peters in ue5-main branch]
2021-05-14 08:35:53 -04:00
paul chipchase
aef4aad935 Enabling the use of Virtualized BulkData api for both static meshes and textures. NOTE: This will not start virtualizing content data
This will cause the old bulkdata objects to be upgraded when loaded in the editor and saved out in the new format when the package is next saved.

#rb PJ.Kack
#rnx
#preflight 609a4df10ba7b600015e0da2

* UE5CookerObjectVersion
- Note that this work was done in CL 16266112 (it was easier to update this on the DevCooker branch)
- Moved UE_USE_VIRTUALBULKDATA to VirtualizationManager.
- Moved the virtualization versions to UE5MainStreamObjectVersion.
- Note that no package would have been saved with UE_USE_VIRTUALBULKDATA so it is safe to just move the versions.

* UE5MainStreamObjectVersion
- Added the virtialization versions here
- Fixed up some white space issues

* VirtualizationManager
- UE_USE_VIRTUALBULKDATA is now controlled from here.
- When disabled (set to 0) a new code path UE_VBD_TO_OLD_BULKDATA_PATH will be enabled that will attempt to allow packages saved with VBD to be reverted safely.
-- This requires that a new version be added to FUE5MainStreamObjectVersion, there is a static assert to warn people about this.

* VirtualizedBulkData
- Added a new method ::ConvertToOldBulkData which will load the VBD payload from disk and then pass it to the old bulkdata object provided. This is not as efficient as the OldBulkData->VBD path but is only provided as an emergancy way for us to back out if needed, we do not expect this code to actually be used.
- Fixed a bug where converting an empty bulkdata object to VBD would give a warning about invalid guids. If the provided bulkdata object is empty then it is likely that we will not have generated a unique guid for it anyway. A VBD object with no payload would expect to have an unset FPayloadId AND an invalid bulkdata identifier anyway so we can just do that and only warn in the case that a valid payload has no valid guid provided. This has a bonus of making the code easier to read as well.

* StaticMeshSourceData
- Updated MESHDATAKEY_STATICMESH_DERIVEDDATA_VER when UE_USE_VIRTUALBULKDATA is enabled again.
-- This probably isn't required but in theory some of our tests could've written mesh description data to the DDC with the old key, so we should update it to play it safe.

* Texture
- Converted to use FUE5MainStreamObjectVersion for it's version number
- Added a code path that will allow us to convert back to using old style bulkdata if UE_USE_VIRTUALBULKDATA is disabled and UE_VBD_TO_OLD_BULKDATA_PATH is enabled.

*MeshDescription
- Converted to use FUE5MainStreamObjectVersion for it's version number
-- Note that we don't have to tell the archive that we are using this because this was already happening.
- Added a code path that will allow us to convert back to using old style bulkdata if UE_USE_VIRTUALBULKDATA is disabled and UE_VBD_TO_OLD_BULKDATA_PATH is enabled.

[CL 16266408 by paul chipchase in ue5-main branch]
2021-05-11 06:28:45 -04:00
paul chipchase
71b969d9c4 Cherrypicking Mirage code base (disabled) from Dev-Cooker
- The mirage specific code is disabled behind the define UE_USE_VIRTUALBULKDATA, this means that some code paths in Texture/Mesh are much more complex than they need to be as we support both old and new paths. Once the system has been turned on and confirmed to cause no issues then this will be stripped out.
- SavePackageUtilities.cpp, SavePackage.cpp and SavePackage2.cpp are editgrates rather than integrations as those files have changes in DevCooker that we don't want to bring over immediately.
- Also includes a prototype system for storing bulkdata in a sidecar file in the workspace domain rather than in the .uasset/.umap file which although has been discontinued as part of mirage, will have applications for future work for non-virtualized projects and/or text based assets.

#rb Patrick.Finegan (all changes have been reviewed when submitted to Dev-Cooker)
#tests Cooking and running ShooterGame/Frosty and other sample programs using megascan assets
#rnx
#preflight  608be50d870cf400013ff99d

[CL 16167285 by paul chipchase in ue5-main branch]
2021-04-30 08:14:54 -04:00
Devin Doucette
fa8250517d SharedBuffer: Added MoveToShared() and MoveToUnique() to convert between buffer types
#rb Matt.Peters
#rnx

[CL 15917930 by Devin Doucette in ue5-main branch]
2021-04-05 12:38:27 -04:00
Devin Doucette
e0d3d85042 SharedBuffer: MakeOwned now returns a buffer instead of operating in-place
#rb Zousar.Shaker
#rnx

[CL 15713705 by Devin Doucette in ue5-main branch]
2021-03-16 14:30:00 -04:00
Devin Doucette
71dceab9c4 SharedBuffer: Rewrote SharedBuffer to make it easier to use, and support lazy materialization of the underlying buffer
- FUniqueBuffer has been added as a single-ownership mutable buffer.
- FSharedBuffer remains a shared-ownership buffer and is now always immutable. In addition to the factory functions that were available previously, it can be also be created by moving FUniqueBuffer.
- FSharedBuffer is now used directly rather than requiring several pointer and reference types.
- FWeakSharedBuffer has been added as a weak reference to a shared buffer, in place of the previous weak pointer types.
- FBufferOwner has been promoted out of FSharedBuffer and can be used for advanced buffer management, including lazy buffer materialization where allocating and/or populating the buffer may be deferred until the buffer is accessed.

#jira none
#rb Zousar.Shaker
#fyi Paul.Chipchase
#rnx

[CL 14939736 by Devin Doucette in ue5-main branch]
2020-12-16 12:20:24 -04:00
Matt Peters
aae0fe62eb PackageResourceManager and PackagePaths
Create a new interface IPackageResourceManager that handles all attempts to load packages from storage. The default implementation passes through to loading from IFileManager. Future implementations will load from other services such as the EditorDomain and TargetDomain.
Add FPackagePath class that holds a LocalFilePath or LongPackageName, or a relative path to a package under a mounted content root (which can be converted into either the LocalFilePath or LongPackageName).
Modify LinkerLoad, BulkData, and AsyncLoader to use FPackagePath and IResourceManager.
Modify UPackage and FLinkerLoad to have a FPackagePath instead of a Filename.
#rb Paul.Chipchase, CarlMagnus.Nordin, Francis.Hurteau, Devin.Doucette
#rn Major Core

[CL 14814912 by Matt Peters in ue5-main branch]
2020-11-25 22:11:10 -04:00
devin doucette
e1f56b47b2 SharedBuffer: Rewrote SharedBuffer to make it easier to use and support immutable buffers
#jira none
#rb Zousar.Shaker, Paul.Chipchase
#rnx

[CL 14581997 by devin doucette in ue5-main branch]
2020-10-26 17:32:41 -04:00
Zousar Shaker
77d13185b7 Copying //UE5/Dev-Cooker@14539516 to Main (//UE5/Main)
[CL 14539954 by Zousar Shaker in ue5-main branch]
2020-10-21 17:56:05 -04:00