Commit Graph

89 Commits

Author SHA1 Message Date
richard talbotwatkin
af7ffbb34c Ensure certain legacy meshes contain a UV element container.
#jira UE-121660
#rb

#ROBOMERGE-AUTHOR: richard.talbotwatkin
#ROBOMERGE-SOURCE: CL 18309099 in //UE5/Release-5.0/... via CL 18309215
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18309261 by richard talbotwatkin in ue5-release-engine-test branch]
2021-11-29 09:40:14 -05:00
Marc Audy
0c3be2b6ad Merge Release-Engine-Staging to Test @ CL# 18240298
[CL 18241953 by Marc Audy in ue5-release-engine-test branch]
2021-11-18 14:37:34 -05:00
aurel cordonnier
a6e741e007 Merge from Release-Engine-Staging @ 17915896 to Release-Engine-Test
This represents UE4/Main @17911760, Release-5.0 @17915875 and Dev-PerfTest @17914035

[CL 17918595 by aurel cordonnier in ue5-release-engine-test branch]
2021-10-25 20:05:28 -04:00
matt peters
41e5ae6f6d BulkDataRegistry:
Change texture and meshdescription BulkData guids to be unique.
#rb Paul.Chipchase
#rnx

#ROBOMERGE-SOURCE: CL 16903425 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v836-16769935)

[CL 16903431 by matt peters in ue5-release-engine-test branch]
2021-07-20 18:18:51 -04:00
matt peters
0724105f6c 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

#ROBOMERGE-SOURCE: CL 16768772 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)

[CL 16768778 by matt peters in ue5-release-engine-test branch]
2021-06-24 00:51:58 -04:00
paul chipchase
6a38eff134 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.

#ROBOMERGE-SOURCE: CL 16727381 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)

[CL 16727410 by paul chipchase in ue5-release-engine-test branch]
2021-06-21 08:56:40 -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
Andrew Davidson
3ddc3a4da3 Merge up from //UE5/Dev-LargeWorldCoordinates
#rb none

[CL 16211417 by Andrew Davidson in ue5-main branch]
2021-05-05 15:07:25 -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
danny couture
84f5594941 Add a couple of meaningful Insight traces
#rb Francis.Hurteau

[CL 16060641 by danny couture in ue5-main branch]
2021-04-20 09:46:29 -04:00
danny couture
95600e2d31 Avoid renderdata of HLOD being recomputed during cook package save because of non-deterministic guid
- Preserve guid during save if static mesh bulkdata content hasn't changed to avoid triggering unnecessary rebuilds
  - Make sure the next HLOD generation is going to use the HashAsGuid feature to avoid recompiling staticmesh that are generated if they are exactly the same as before

  - 31m10s to 14m15s to cook P_Construct_WP with a warmed-up DDC

#fyi Richard.TalbotWatkin
#rb Matt.Peters, Sebastien.Lussier, Yuriy.ODonnell

[CL 15755322 by danny couture in ue5-main branch]
2021-03-20 20:01:33 -04:00
Matt Peters
6895cee3ee EditorDomainSave - Strip bulk data from EditorDomain copies of packages. BulkData types in the EditorDomain have flags set to load the data from workspace domain version of the file.
#rb Paul.Chipchase
#rnx

[CL 15643329 by Matt Peters in ue5-main branch]
2021-03-08 14:13:00 -04:00
richard talbotwatkin
25a64ff0bb Re-fixed undo/redo of static mesh geometry (FMeshDescriptionBulkData serialization). This must be allowed to happen for non-persistent archives, such as the transaction buffer.
#rb Sebastien.Lussier

#ROBOMERGE-SOURCE: CL 15529772 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15529777 by richard talbotwatkin in ue5-main branch]
2021-02-25 12:43:28 -04:00
sebastien lussier
1b177e5038 MeshDescription fixes
* Added missing write lock in FMeshDescriptionBulkData::SaveMeshDescription( FMeshDescription& MeshDescription )
* Skip serialization of bulk data when archive is a ref collector
#rb danny.couture, richard.talbotwatkin

#ROBOMERGE-SOURCE: CL 15502374 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15503758 by sebastien lussier in ue5-main branch]
2021-02-23 15:17:22 -04:00
Richard TalbotWatkin
bf10d3336a Refactor of source model representation for static meshes.
- Moved source models related classes and implementation into separate files.
- Created a new UObject wrapper for holding mesh description bulk data; this is created as a transactable object inside a UStaticMesh.
- The cached mesh description is now an inner object of the bulk data wrapper; this allows transactions on the bulk data to affect the cached mesh.
- The static mesh SourceModels array can no longer be accessed directly: FStaticMeshSourceModel requires extra initialization before it should be used, so new LODs should be added through the static mesh API.
- Undo/redo is now fixed within the geometry tools
- Fixed regression where mesh description was being unpacked unnecessarily during transactions
- MeshDescription bulk data and its cached MeshDescriptions are now emptied prior to removing the UObject reference, in order to immediately free memory instead of needing to wait for garbage collection
- No more deadlocks when clearing or committing mesh descriptions during garbage collection
- Bulk data UObjects are constructed, where possible, at startup, in order to prevent it from happening during critical moments, e.g. during garbage collection or package saving.
#rb Danny.Couture, Alexis.Matte, Ryan.Schmidt

[CL 15420827 by Richard TalbotWatkin in ue5-main branch]
2021-02-16 15:14:02 -04:00
Richard TalbotWatkin
b0b120e57c Changes to handling of source model data for StaticMeshes.
- The MeshDescription for each source model LOD is now wrapped in a UStaticMeshDescription, meaning that it can be transacted separately to the parent static mesh. This improves memory and time performance in static mesh transactions, e.g. when assigning materials.
- FStaticMeshSourceModel now has its own API for managing the mesh description and its bulk data.
- A new optional Hi-res SourceModel member has been added to StaticMesh; this allows the original source data to be stored here, while a reduced LOD0 can be stored as SourceModel LOD0, to allow geometry modelling tools to work efficiently.
- MeshDescription is now serialized using a proxy archive object which ensures that FNames can always be archived as strings.
- UStaticMeshDescription is now serialized.
- UStaticMeshDescription has been reverted to only holding its own mesh description, instead of being able to reference any external mesh description. This previous change was never released.
- RawMesh is now immediately converted to MeshDescription in PostLoad, so that the MeshDescription[BulkData] pointers are always valid, and can be tag serialised automatically during transactions. RawMesh should now not be used in the editor at all, and will soon be deprecated.

This change results in far quicker and memory-efficient transactions in StaticMeshes. e.g. assign material to a static mesh section for a 20000 vertex mesh now takes less than a second (discounting time to rebuild the render proxy) instead of 7+ seconds.

#rb Alexis.Matte, Danny.Couture

[CL 15248935 by Richard TalbotWatkin in ue5-main branch]
2021-01-28 16:27:47 -04:00
Richard TalbotWatkin
48534ff000 Added unbounded arrays as a new attribute type for mesh attributes. They are registered with RegisterAttribute<T[]>, and accessed with GetAttributesRef<TAttributeArray<T>>.
Removed attribute views.
Refactored MeshAttributeArray implementation.
Added a new GetArrayView() method for all types of TMeshAttributeRefs which can be used generically.
#rb Alexis.Matte

[CL 14651594 by Richard TalbotWatkin in ue5-main branch]
2020-11-04 08:40:25 -04:00
danny couture
0bc26cdebe Reduce memory usage by allowing meshdescription and rawmesh bulkdata to be cleaned up if possible
Also add protection so meshdescription can be read from multiple threads in editor

 - Loading Reverb's P_World with empty DDC
    - 319GB to 242GB peak private byte
    - 166GB to 80GB permanent memory usage after map load

#rb Richard.Talbot-Watkins, Matt.Peters, Paul.Chipchase

[CL 14544739 by danny couture in ue5-main branch]
2020-10-22 10:35:43 -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
Richard TalbotWatkin
16f809e21d Added correct custom version for MeshDescriptionBulkData.
#rb

[CL 14428213 by Richard TalbotWatkin in ue5-main branch]
2020-10-06 06:29:40 -04:00
Richard TalbotWatkin
6a54e1dced Created new object version in UE5MainStreamObjectVersion for MeshDescription format changes.
This is the correct versioning for new MeshDescription objects.
The original versioning (in ReleaseObjectVersion) clashes with changes being brought over from 4.26.  MeshDescription objects already saved in UE5 will only be valid for precisely FReleaseObjectVersion::MeshDescriptionNewFormat; subsequent version numbers belong to assets from 4.26 (and derived streams) which have been resaved and merged into UE5, and do *not* have the new MeshDescription format.
Going forward, UE5MainStreamObjectVersion holds the latest version for MeshDescription objects.
#rb Steve.Robb, Marc.Audy

[CL 14377658 by Richard TalbotWatkin in ue5-main branch]
2020-09-23 12:12:34 -04:00
Richard TalbotWatkin
458797a366 Fixed issue when serializing legacy assets.
#jira UE-98121
#rb none

[CL 14278334 by Richard TalbotWatkin in ue5-main branch]
2020-09-09 08:58:09 -04:00
Richard TalbotWatkin
51d4cb3f66 Fully deprecated old MeshDescription APIs.
Prepared direct attribute access for deprecation, preferring use of APIs to access static mesh attributes.
Fixed recently merged Enterprise code to comply with new APIs.
Changed all tools to use triangle-centric iteration where possible.
Added new MeshAttributeArray APIs for querying attribute flags, and added a new Mandatory flag.
Various bug fixes.
#rb Alexis.Matte

[CL 13873755 by Richard TalbotWatkin in ue5-main branch]
2020-07-16 08:23:15 -04:00
Richard TalbotWatkin
e5eb3cc879 Unbroke static mesh serialization.
#fyi Matt.Kuhlenschmidt

[CL 13571455 by Richard TalbotWatkin in ue5-main branch]
2020-05-28 14:09:49 -04:00
Richard TalbotWatkin
f1a4694ef6 Fixed build warnings.
#rb

[CL 13569044 by Richard TalbotWatkin in ue5-main branch]
2020-05-28 11:32:37 -04:00