Commit Graph

143 Commits

Author SHA1 Message Date
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
halfdan ingvarsson
0ca6df2ce0 Added a TAttributesSet::ForEachByType utility function to iterate over attributes of a specific type (e.g. all floats). Allows better specialization of the called function for a given type.
#jira none
#rb Richard.TalbotWatkin

[CL 15658268 by halfdan ingvarsson in ue5-main branch]
2021-03-09 15:46:55 -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
9b287d8b0b Better way to ensure that the inner UMeshDescriptionBase is instanced when duplicating the bulkdata wrapper.
#jira UE-109601

#ROBOMERGE-SOURCE: CL 15633007 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v777-15581079)

[CL 15633009 by richard talbotwatkin in ue5-main branch]
2021-03-06 09:04:46 -04:00
richard talbotwatkin
c6c524c9dd Correctly construct an instanced UMeshDescriptionBase as an inner object of UMeshDescriptionBaseBulkData when duplicating a static mesh.
#jira UE-109601

#ROBOMERGE-SOURCE: CL 15626098 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v777-15581079)

[CL 15626196 by richard talbotwatkin in ue5-main branch]
2021-03-05 13:04:39 -04:00
richard talbotwatkin
e62b002625 Changes for allocating StaticMesh subobjects in a more thread-safe way.
Always construct a UMeshDescriptionBase as a default subobject of the MeshDescriptionBulkData object, which can be recycled each time a UMeshDescriptionBase is required for that LOD.
Put GC scope guards around NewObject<> allocations to avoid clashes with GC when allocated on a thread.
Also identified other static mesh subobjects which can be potentially created in cooking commandlets when GC is taking place.
#jira UE-109204
#jira UE-109439
[FYI] Danny.Couture

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

[CL 15535009 by richard talbotwatkin in ue5-main branch]
2021-02-25 18:14:04 -04:00
richard talbotwatkin
8647dbaed2 The MeshDescription object within the bulkdata is no longer marked as Transactable. All transactable changes must occur on the bulkdata itself, and these changes will be propagated to the cached MeshDescription, if one exists, during an undo/redo. Corrected BulkData serialize by only caching the MeshDescription from the BulkData if the archive is loading.
#jira UE-109248
#jira UE-109821

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

[CL 15530441 by richard talbotwatkin in ue5-main branch]
2021-02-25 13:25:49 -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
8e65eef33e Fixed issues with editor -game mode.
StaticMesh hi res source model bulk data is no longer a default subobject; instead it is instanced if it was not present in PostLoad, thus fixing issues with object name differences.
MeshDescriptionBaseBulkData is marked as NeedsLoadForEditorGame, as well as not needing load for client or server, so that it can be loaded correctly.
#jira UE-108938

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

[CL 15481116 by richard talbotwatkin in ue5-main branch]
2021-02-19 20:53:13 -04:00
richard talbotwatkin
0a06ce9d2b Declared UMeshDescriptionBaseBulkData an editor-only class by implementing NeedsLoadForClient/Server() returning false. This prevents it from being cooked.
Made the HiResSourceModel MeshDescriptionBulkData a regular default subobject, so that it is still valid in Editor -game builds.
#jira UE-108938
#rb Robert.Manuszewski

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

[CL 15471367 by richard talbotwatkin in ue5-main branch]
2021-02-19 09:24:38 -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
halfdan ingvarsson
5667fa808f MeshDescription: Add SortByPredicate, StableSortByPredicate and SetNumUninitialized to TArrayAttribute
#rb Richard.TalbotWatkins
#jira none
#rnx

[CL 15158781 by halfdan ingvarsson in ue5-main branch]
2021-01-21 16:22:54 -04:00
Richard TalbotWatkin
c1a73f430e Changed behaviour of GetRawArray so that it returns an empty TArrayView when the container has zero elements. Previously it would attempt to dereference the underlying array allocation which may be nullptr for an empty array.
#rb Jimmy.Andrews

[CL 15089599 by Richard TalbotWatkin in ue5-main branch]
2021-01-14 14:31:57 -04:00
Richard TalbotWatkin
014ea87dce Changed TArrayAttribute to hold a pointer to the TAttributeArrayContainer instead of a reference. The end result is the same.
[CL 15071623 by Richard TalbotWatkin in ue5-main branch]
2021-01-13 16:34:06 -04:00
Alexis Matte
c5cf822a86 Fix memory allocation in the TArrayAttribute
#rb Richard.talbotwatkin
#jira none

[CL 14859529 by Alexis Matte in ue5-main branch]
2020-12-04 17:06:59 -04:00
Richard TalbotWatkin
71b016ccac MeshAttributeArray improvements:
- allowed TMeshAttributeRef<TArrayView<T>> to be initialized from *any* attribute type, thus providing a generic way of accessing any type of attribute, be it simple, compound or unbounded array.

ArrayAttribute improvements:
- sped up inserting by not requiring every element of a chunk to be valid if it has not yet been used
- added new API to provide Reserve / Add / AddUnique etc

Indexer improvements:
- fixed issue allowing an attribute with a compound index attribute (e.g. int[3]) to be indexed multiple times

#rb Halfdan.Ingvarsson

[CL 14814025 by Richard TalbotWatkin in ue5-main branch]
2020-11-25 17:21:42 -04:00
Richard TalbotWatkin
23f6634277 Choose the owned mesh description if the mesh description reference is invalid.
#rb trivial

[CL 14733413 by Richard TalbotWatkin in ue5-main branch]
2020-11-12 08:59:12 -04:00
Richard TalbotWatkin
065224a5b0 Support for the UMeshDescriptionBase / UStaticMeshDescription hierarchy to take a reference to an existing mesh description as well as hold one by value.
Added additional API for getting element counts.

[CL 14719778 by Richard TalbotWatkin in ue5-main branch]
2020-11-11 11:25:09 -04:00
Richard TalbotWatkin
553e0c3155 Temporarily removed some deprecation directives while analysing a difference in compiler behaviour in order to remove build warnings.
[CL 14652513 by Richard TalbotWatkin in ue5-main branch]
2020-11-04 11:07:40 -04:00
Richard TalbotWatkin
550fa7be1d Implemented TArrayAttribute constructor for implicit conversion from non-const to const attribute types.
[CL 14651778 by Richard TalbotWatkin in ue5-main branch]
2020-11-04 09:29:34 -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