Commit Graph

98 Commits

Author SHA1 Message Date
Steve Robb
f4d1564ffe New BitCast<>() function which works like C++20's std::bit_cast<>().
Deprecation of FPlatformMath::IsNegative*() functions.
New FPlatformMath::IsNegativeOrNegativeZero().
Fix up of existing usage to either use < 0 or IsNegativeOrNegativeZero where appropriate.
Fixes for aliasing problems in various FMath functions, including IsNegative*().

Resubmission of CL# 19833778 with fixes for problematic Mac and Android toolchains, causing spurious errors while building PCHs.

#rb devin.doucette, charles.bloom, will.damon, chris.babcock
#jira UE-148435
#preflight 6260764d91376845adf9893f

[CL 19840896 by Steve Robb in ue5-main branch]
2022-04-20 19:05:47 -04:00
Steve Robb
5c1f45e9a8 Undo //UE5/Main/Engine/... changelist 19833778 due to Mac and Android compilation failure.
#rb none
#jira none
#preflight none
#fyi will.damon

[CL 19835840 by Steve Robb in ue5-main branch]
2022-04-20 15:09:51 -04:00
Steve Robb
a9e89c3ed6 New BitCast<>() function which works like C++20's std::bit_cast<>().
Deprecation of FPlatformMath::IsNegative*() functions.
New FPlatformMath::IsNegativeOrNegativeZero().
Fix up of existing usage to either use < 0 or IsNegativeOrNegativeZero where appropriate.
Fixes for aliasing problems in various FMath functions, including IsNegative*().

#rb devin.doucette, charles.bloom
#jira UE-148435
#preflight 625ece48f16e0d2accab15d9

[CL 19833778 by Steve Robb in ue5-main branch]
2022-04-20 13:38:10 -04:00
fred kimberley
7fbfaf57c8 Require explicit constructors/casts when converting between FVector, FVector3d, and FVector3f.
#jira UE-122078
#rb Andrew.Davidson, Colin.McGinley
#preflight standard build

#ROBOMERGE-AUTHOR: fred.kimberley
#ROBOMERGE-SOURCE: CL 18817999 in //UE5/Release-5.0/... via CL 18818012 via CL 18822871
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18824721 by fred kimberley in ue5-main branch]
2022-02-02 07:59:31 -05:00
paul chipchase
05d81ee7f3 EditorBulkData and the virtualization system now use FIoHash directly and FPayloadId is removed
#rb Per.Larsson, Devin.Doucette
#jira UE-133497
#rnx
#preflight 61f835491c5ac5523462810a

- A lot of files have been touched but most of this is changing FPayload::IsValid to !FIoHash::IsZero, the main changes are in EditorBulkData/EditorBulkDataTests
- The only difference between FPayloadId and FIoHash is that the former considered the hash of an invalid or empty buffer to be 'invalid' too where as FIoHash would return a valid hash
-- To keep behaviour the same, we only hash payloads in EditorBulkData using a utility method ::HashBuffer which will not hash empty or invalid payloads and return a default FIoHash instead.
-- Unit tests have been extended to prove that the behaviour has not changed.

#ROBOMERGE-AUTHOR: paul.chipchase
#ROBOMERGE-SOURCE: CL 18806362 in //UE5/Release-5.0/... via CL 18808527 via CL 18821790
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18822154 by paul chipchase in ue5-main branch]
2022-02-02 02:21:24 -05:00
david lesage
462fe9f965 #jira UETOOL-4913, UE-135956
Fix MeshOrientation
A triangle is defined by its 3 vertices: v0 v1 v2 and 3 edges: e0(v0v1), e1 (v1v2), e2(v2v0)
Swapping triangle orientation is done be swapping:
- 2 vertex v0 and v1 => new triangle is  (v1 v0 v2)
- 2 edge but thy are e1 and e2 that need to be swapped and not e0 and e1, so  (e0(v0v1), e2(v2v0), e1 (v1v2)
[FYI] jeanluc.corenthin
#preflight 61f890b8f657e25a590729f2

#ROBOMERGE-AUTHOR: david.lesage
#ROBOMERGE-SOURCE: CL 18803755 in //UE5/Release-5.0/... via CL 18803773 via CL 18821682
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18822070 by david lesage in ue5-main branch]
2022-02-02 02:15:52 -05:00
matt peters
25f4f8d508 MeshDescription: Fix Guid being changed during UpdateMeshDescriptionFormat. UpdateMeshDescriptionFormat was created to avoid changing the guid, but a copy-paste error left in the change of the guid.
#rb Zousar.Shaker
#rnx
#preflight None, Trivial

#ROBOMERGE-AUTHOR: matt.peters
#ROBOMERGE-SOURCE: CL 18740582 in //UE5/Release-5.0/... via CL 18740835 via CL 18742817
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18743189 by matt peters in ue5-main branch]
2022-01-26 15:35:29 -05:00
paul chipchase
77c12cf814 Virtualized bulkdata is now know as EditorBulkData
#rb PJ.Kack
#rnx
#jira UE-139708
#preflight 61eaaedfc92021e535b6d1e0

- The goal is to show a clear separation between the bulkdata object and the virtualization system.
- NOTE that all of these classes were added during 5.0 development so we are just renaming and moving them, no deprecation paths.
- Renamed FVirtualizedUntypedBulkData to FEditorBulkData
-- Also removed the derived templated types, they were never actually used
- Renamed FVirtualizedBulkDataReader to FEditorBulkDataReader
- Renamed FVirtualizedBulkDataWriter to FEditorBulkDataWriter
- Moved the renamed classes to the UE::Serialization namespace from UE::Virtualization
- Renamed the files of the renamed classes where required.
- Replaced use of LogVirtualization with LogSerialization.
- Renamed defines prefixed with VBD_* to UE_ and make sure they are undefed by the end of the cpp
- Edited unit tests to show up under "System.CoreUObject.Serialization.EditorBulkData.*"

#ROBOMERGE-AUTHOR: paul.chipchase
#ROBOMERGE-SOURCE: CL 18688778 in //UE5/Release-5.0/... via CL 18688787 via CL 18688810
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18688823 by paul chipchase in ue5-main branch]
2022-01-21 09:18:53 -05:00
matt peters
7567645aec MeshDescription support for EditorDomain: Do not resave the bulkdata if the MeshDescription bytes have not changed. Keeping the bulkdata unmodified allows EditorDomain to refer to it by reference.
#preflight 61d367e0430de36baa2a4136

#ROBOMERGE-AUTHOR: matt.peters
#ROBOMERGE-SOURCE: CL 18504181 in //UE5/Release-5.0/... via CL 18504202
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18504228 by matt peters in ue5-release-engine-test branch]
2022-01-03 17:40:52 -05:00
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