CL 10373564 by danny.couture
Optimize Material Baking (Phase 1)
- Introduce a mecanism to override the vertex/index buffer allocator used for dynamic meshes
- Avoid GDynamicMesh non-ticked pools build-up by using our own vertex/index buffer pool during baking
- Reduce reallocation and incurred soft page faults by reusing a single set of vertex/index buffers big enough for the biggest mesh
- Preemptively detect if smearing would result in monochrome texture to avoid useless work
- Shrink smeared monochrome textures during the baking process for huge memory savings
- Move UV smearing in worker threads to avoid blocking the game thread
- Required shaders are now built asynchronously
- Add progress bar for material baking
- 28m23 [at] 150 GB RAM -> 2m14s [at] 45 GB RAM for 6 channels [at] 512x512 when baking materials on ProxyLOD for DATASET-0008a with DDC empty
#rb Jurre.deBaare, Sebastien.Lussier
CL 10516258 by danny.couture
Optimize Material Baking (Phase 2)
- Implement pipelining with staging buffers to avoid GPU stalls when reading from render targets
- Reuse the same prepared FMeshBatch instead of rebuilding it for each draw pass
- Prepare the RenderItem in advance on other threads to reduce work on the game thread
- Move the staging surface copy out of the render thread
- Small vertex and index buffers are not reused to avoid dependency locks when mapping them
- Fix bug in Canvas Flush_RenderThread found while running HLOD rebuild commandlet on Fortnite
- Delete old and unused MaterialBakingModule.h from public files
- 4m44s -> 59s for baking 6 channel [at] 1024x1024 when baking materials on ProxyLOD for DATASET-0008a with shaders already compiled
- Time spent in Material Baking when rebuilding all HLOD on Apollo_POI_Large_HLOD (Phase 1 + 2 combined)
- 10m18s -> 2m36s for a first rebuild all in editor with no shaders in DDC (cold)
- 1m23s -> 20s for a second rebuild all in editor (warm)
#rb Jeremy.Moore, Sebastien.Lussier
CL 11135986 by sebastien.lussier
Optimized mesh merging
* Added DeletePolygons() & DeleteTriangles methods to FMeshDescription which rely on TSets<> instead of performing costly TArray::AddUnique() calls()
* Parallelized UV generation and avoided duplicate processing of the same mesh+lod pairs
* Optimized FMeshDescriptionOperations::GenerateUniqueUVsForStaticMesh()
* Goes from 100s to 10s in my test case
#rb danny.couture, jeanfrancois.dube, richard.talbotwatkin
#ROBOMERGE-OWNER: sebastien.lussier
#ROBOMERGE-AUTHOR: sebastien.lussier
#ROBOMERGE-SOURCE: CL 11206337 via CL 11206341 via CL 11206346
#ROBOMERGE-BOT: (v643-11205221)
[CL 11206493 by sebastien lussier in Main branch]
#rnx
#rb none
#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)
[CL 10870549 by ryan durand in Main branch]
- Clear MeshDescription once serialized in BulkData after UStaticMesh Build (56.17GB peak to 51.28GB)
- Clear SourceModels from DatasmithMesh as soon as possible (51.28GB peak to 48.8GB)
- Remove CommitMeshDescription from FillUStaticMesh since already in PreBuildStaticMesh phase (48.8GB peak to 45.75GB)
From dev-enterprise[at]6953449
#rb jeanmichel.dignard, johan.duparc
#jira UE-63369
#ROBOMERGE-SOURCE: CL 7248033 in //UE4/Release-4.23/...
#ROBOMERGE-BOT: RELEASE (Release-4.23 -> Main) (v367-6836689)
[CL 7248034 by danny couture in Main branch]
FMeshDescriptionBulkData is serialized directly to a package, but its bulk data contains a compressed FMeshDescription which is serialized at a later stage on demand. It is mandatory that the versioning for each of these stay in sync, otherwise MeshDescription will fail to load following a version bump.
This fix ensures that, when saving FMeshDescriptionBulkData, its bulk data is reserialized with the latest versioning. It is not always the case that the mesh description would be otherwise updated prior to saving the FMeshDescriptionBulkData.
This fix also ensures that the internal state of FMeshDescriptionBulkData is saved and restored around an undo/redo. Previously this could get lost when performing an undo in the static mesh editor.
#rb Ryan.Schmidt
#jira none
#ROBOMERGE-SOURCE: CL 4929630 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 4930026 by richard talbotwatkin in Main branch]
Merge conflict.
richard.talbotwatkin, please merge this change by hand.
More info at https://robomerge.epicgames.net#RELEASE
/src/ROBOMERGE_RELEASE_Main/Engine/Source/Runtime/MeshDescription/Private/MeshDescription.cpp - merging //UE4/Release-4.22/Engine/Source/Runtime/MeshDescription/Private/MeshDescription.cpp#2
--------------------------------------
Copied from //UE4/Main CL 4879714
Preserve FMeshDescriptionBulkData versioning information when loaded from package, so it can be retrospectively applied to the FBulkDataReader archive when deserializing FMeshDescription.
#jira UE-69412
#rb Ryan.Schmidt
#ROBOMERGE-SOURCE: CL 4883821 in //UE4/Release-4.22/...
#ROBOMERGE-BOT: RELEASE (Release-4.22 -> Main)
[CL 4930016 by richard talbotwatkin in Main branch]
#jira UE-69412
#rb Richard.TalbotWatkins
#ROBOMERGE-SOURCE: CL 4879713 in //UE4/Dev-Editor/...
#ROBOMERGE-BOT: ENGINE (Dev-Editor -> Main)
[CL 4879714 by ryan schmidt in Main branch]
- MeshDescription now held as compressed bulk data and unpacked on demand. This is managed by FMeshDescriptionBulkData.
- Made RawMesh accessors in StaticMesh responsible for performing legacy conversion from MeshDescription if necessary.
- Added FBulkDataReader/FBulkDataWriter for serializing bulk data to/from archives.
- Added FUntypedBulkData::UnloadBulkData() for releasing the bulk data allocation without invalidating it (so it can be reloaded when necessary). Editor only.
- Renamed StaticMesh MeshDescription methods (now GetMeshDescription(), CommitMeshDescription() etc).
- Removed unnecessary mesh description attributes from StaticMesh: those which are used only by Editable Mesh, and transient attributes which are automatically generated when needed for building vertex tangent space.
- Slight change to FAttributesSetBase::RegisterAttribute(): if the attribute specified already exists, it will be amended to adopt the type, passed flags and number of indices. If only the number of indices changes, any existing data will be preserved if possible.
- Added TMeshAttributesRef::Copy() to copy an entire attributes array from one name/index to another.
- Changed implementation of TMeshAttributesRef/TMeshAttributesView to provide a const ref/view if the template type parameter is const. Added TMeshAttributesConstRef/TMeshAttributesConstView as an alias for backwards compatibility.
- Added FMeshDescription::IsEmpty() for determining whether a mesh description has any content or not.
- Removed versioning GUID for mesh description: this should be handled by each mesh description client now.
#rb Alexis.Matte
[CL 4644791 by Richard TalbotWatkin in Dev-Editor branch]
Added log errors when loading UMeshDescription objects (now deprecated), in preparation to resave any which remain.
Once all serialized UMeshDescriptions are wiped out (they only exist internally), FMeshDescription will become a USTRUCT.
#fyi Tim.Gautier
#rb none
[CL 4266356 by Richard TalbotWatkin in Dev-Editor branch]