2022-09-26 15:12:13 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
2022-10-01 02:04:57 -04:00
# include "MuCO/CustomizableObjectSystem.h"
2022-09-26 15:12:13 -04:00
2022-10-02 10:56:02 -04:00
# include "Animation/Skeleton.h"
# include "AssetRegistry/ARFilter.h"
# include "AssetRegistry/AssetRegistryModule.h"
# include "Engine/SkeletalMesh.h"
2023-01-12 01:48:34 -05:00
# include "Engine/SkinnedAsset.h"
2022-10-02 10:56:02 -04:00
# include "GameFramework/Pawn.h"
2023-01-12 01:48:34 -05:00
# include "Engine/SkinnedAssetCommon.h"
2022-10-02 10:56:02 -04:00
# include "GameFramework/PlayerController.h"
# include "Interfaces/ITargetPlatform.h"
# include "Kismet/GameplayStatics.h"
# include "MuCO/CustomizableInstanceLODManagement.h"
2022-10-01 02:04:57 -04:00
# include "MuCO/CustomizableInstancePrivateData.h"
2022-10-02 10:56:02 -04:00
# include "MuCO/CustomizableObjectPrivate.h"
2022-11-04 09:18:44 -04:00
# include "MuCO/DefaultImageProvider.h"
2022-10-02 10:56:02 -04:00
# include "MuCO/CustomizableSkeletalComponent.h"
# include "MuCO/ICustomizableObjectModule.h"
# include "MuCO/LogBenchmarkUtil.h"
# include "MuCO/LogInformationUtil.h"
# include "MuCO/UnrealBakeHelpers.h"
2022-10-01 02:06:09 -04:00
# include "MuCO/UnrealMutableImageProvider.h"
2022-10-01 02:04:57 -04:00
# include "MuCO/UnrealMutableModelDiskStreamer.h"
2023-01-12 01:48:34 -05:00
# include "MuR/Model.h"
2022-10-02 10:56:02 -04:00
# include "MuR/Settings.h"
# include "TextureResource.h"
# include "UObject/UObjectIterator.h"
# include "Widgets/Notifications/SNotificationList.h"
2022-09-26 15:12:13 -04:00
# if WITH_EDITOR
# include "Editor.h"
2022-10-02 10:56:02 -04:00
# include "Logging/MessageLog.h"
2022-09-26 15:12:13 -04:00
# include "Misc/ConfigCacheIni.h"
# include "Misc/MessageDialog.h"
2023-01-12 02:59:45 -05:00
# else
# include "Engine/Engine.h"
2022-09-26 15:12:13 -04:00
# endif
2022-10-02 10:56:02 -04:00
# include UE_INLINE_GENERATED_CPP_BY_NAME(CustomizableObjectSystem)
class AActor ;
class UAnimInstance ;
class UMaterialInterface ;
2022-09-26 15:12:13 -04:00
2022-10-10 07:09:51 -04:00
namespace impl
{
void Task_Game_Callbacks_Work ( UCustomizableObjectInstance * CustomizableObjectInstance ) ;
}
2022-09-26 15:12:13 -04:00
DEFINE_STAT ( STAT_MutableNumSkeletalMeshes ) ;
DEFINE_STAT ( STAT_MutableNumCachedSkeletalMeshes ) ;
DEFINE_STAT ( STAT_MutableNumAllocatedSkeletalMeshes ) ;
DEFINE_STAT ( STAT_MutableNumInstancesLOD0 ) ;
DEFINE_STAT ( STAT_MutableNumInstancesLOD1 ) ;
DEFINE_STAT ( STAT_MutableNumInstancesLOD2 ) ;
DEFINE_STAT ( STAT_MutableSkeletalMeshResourceMemory ) ;
DEFINE_STAT ( STAT_MutableNumTextures ) ;
DEFINE_STAT ( STAT_MutableNumCachedTextures ) ;
DEFINE_STAT ( STAT_MutableNumAllocatedTextures ) ;
DEFINE_STAT ( STAT_MutableTextureResourceMemory ) ;
DEFINE_STAT ( STAT_MutableTextureGeneratedMemory ) ;
DEFINE_STAT ( STAT_MutableTextureCacheMemory ) ;
DEFINE_STAT ( STAT_MutableTextureParameterDecorationMemory ) ;
DEFINE_STAT ( STAT_MutablePendingInstanceUpdates ) ;
DEFINE_STAT ( STAT_MutableAbandonedInstanceUpdates ) ;
DEFINE_STAT ( STAT_MutableInstanceBuildTime ) ;
DEFINE_STAT ( STAT_MutableInstanceBuildTimeAvrg ) ;
DEFINE_STAT ( STAT_MutableStreamingOps ) ;
DEFINE_STAT ( STAT_MutableStreamingCache ) ;
// These stats are provided by the mutable runtime
DEFINE_STAT ( STAT_MutableProfile_LiveInstanceCount ) ;
DEFINE_STAT ( STAT_MutableProfile_StreamingCacheBytes ) ;
DEFINE_STAT ( STAT_MutableProfile_InstanceUpdateCount ) ;
DECLARE_CYCLE_STAT ( TEXT ( " MutablePendingRelease Time " ) , STAT_MutablePendingRelease , STATGROUP_Game ) ;
DECLARE_CYCLE_STAT ( TEXT ( " MutableTask " ) , STAT_MutableTask , STATGROUP_Game ) ;
UCustomizableObjectSystem * FCustomizableObjectSystemPrivate : : SSystem = nullptr ;
static TAutoConsoleVariable < int32 > CVarStreamingMemory (
TEXT ( " b.MutableStreamingMemory " ) ,
- 1 ,
TEXT ( " If different than 0, limit the amount of memory (in KB) to use to cache streaming data when building characters. 0 means no limit, -1 means use default (40Mb in PC and 20Mb in consoles). " ) ,
ECVF_Scalability ) ;
bool FMutableQueue : : IsEmpty ( ) const
{
return Array . Num ( ) = = 0 ;
}
int FMutableQueue : : Num ( ) const
{
return Array . Num ( ) ;
}
void FMutableQueue : : Enqueue ( const FMutableQueueElem & TaskToEnqueue )
{
for ( FMutableQueueElem & QueueElem : Array )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( QueueElem . Operation ) ;
check ( TaskToEnqueue . Operation ) ;
2023-01-25 11:08:55 -05:00
if ( ( QueueElem . Operation - > Type = = FMutableOperation : : EOperationType : : Update | | QueueElem . Operation - > Type = = FMutableOperation : : EOperationType : : Discard ) & &
QueueElem . Operation - > CustomizableObjectInstance = = TaskToEnqueue . Operation - > CustomizableObjectInstance )
2022-09-26 15:12:13 -04:00
{
QueueElem . Operation = TaskToEnqueue . Operation ;
QueueElem . PriorityType = FMath : : Min ( QueueElem . PriorityType , TaskToEnqueue . PriorityType ) ;
QueueElem . Priority = FMath : : Min ( QueueElem . Priority , TaskToEnqueue . Priority ) ;
return ;
}
}
Array . HeapPush ( TaskToEnqueue ) ;
}
void FMutableQueue : : Dequeue ( FMutableQueueElem * DequeuedTask )
{
Array . HeapPop ( * DequeuedTask ) ;
}
void FMutableQueue : : ChangePriorities ( )
{
for ( FMutableQueueElem & Elem : Array )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Elem . Operation ) ;
if ( Elem . Operation - > CustomizableObjectInstance . IsValid ( ) )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( UCustomizableInstancePrivateData * CustomizableObjectInstancePrivateData = Elem . Operation - > CustomizableObjectInstance - > GetPrivate ( ) )
{
Elem . Priority = CustomizableObjectInstancePrivateData - > MinSquareDistFromComponentToPlayer ;
}
2022-09-26 15:12:13 -04:00
}
}
}
void FMutableQueue : : UpdatePriority ( const UCustomizableObjectInstance * Instance )
{
for ( FMutableQueueElem & Elem : Array )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Elem . Operation ) ;
2022-09-26 15:12:13 -04:00
if ( Elem . Operation - > CustomizableObjectInstance = = Instance )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Instance - > GetPrivate ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
Elem . Priority = Instance - > GetPrivate ( ) - > MinSquareDistFromComponentToPlayer ;
break ;
}
}
}
const FMutableQueueElem * FMutableQueue : : Get ( const UCustomizableObjectInstance * Instance ) const
{
for ( const FMutableQueueElem & Elem : Array )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Elem . Operation ) ;
2022-09-26 15:12:13 -04:00
if ( Elem . Operation - > CustomizableObjectInstance = = Instance )
{
return & Elem ;
}
}
return nullptr ;
}
void FMutableQueue : : Sort ( )
{
Array . Heapify ( ) ;
}
UCustomizableObjectSystem * UCustomizableObjectSystem : : GetInstance ( )
{
if ( ! FCustomizableObjectSystemPrivate : : SSystem )
{
UE_LOG ( LogMutable , Log , TEXT ( " Creating system. " ) ) ;
check ( IsInGameThread ( ) ) ;
FCustomizableObjectSystemPrivate : : SSystem = NewObject < UCustomizableObjectSystem > ( UCustomizableObjectSystem : : StaticClass ( ) ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( FCustomizableObjectSystemPrivate : : SSystem ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
checkf ( ! GUObjectArray . IsDisregardForGC ( FCustomizableObjectSystemPrivate : : SSystem ) , TEXT ( " Mutable was initialized too early in the UE4 init process, for instance, in the constructor of a default UObject. " ) ) ;
FCustomizableObjectSystemPrivate : : SSystem - > AddToRoot ( ) ;
checkf ( ! GUObjectArray . IsDisregardForGC ( FCustomizableObjectSystemPrivate : : SSystem ) , TEXT ( " Mutable was initialized too early in the UE4 init process, for instance, in the constructor of a default UObject. " ) ) ;
FCustomizableObjectSystemPrivate : : SSystem - > InitSystem ( ) ;
//FCoreUObjectDelegates::PurgePendingReleaseSkeletalMesh.AddUObject(FCustomizableObjectSystemPrivate::SSystem, &UCustomizableObjectSystem::PurgePendingReleaseSkeletalMesh);
}
return FCustomizableObjectSystemPrivate : : SSystem ;
}
FString UCustomizableObjectSystem : : GetPluginVersion ( ) const
{
// Bridge the call from the module. This implementation is available from blueprint.
return ICustomizableObjectModule : : Get ( ) . GetPluginVersion ( ) ;
}
void UCustomizableObjectSystem : : LogShowData ( bool bFullInfo , bool ShowMaterialInfo ) const
{
LogInformationUtil : : ResetCounters ( ) ;
AActor * ParentActor ;
TArray < UCustomizableObjectInstance * > ArrayData ;
for ( TObjectIterator < UCustomizableSkeletalComponent > It ; It ; + + It )
{
UCustomizableSkeletalComponent * CustomizableSkeletalComponent = * It ;
if ( ( CustomizableSkeletalComponent ! = nullptr ) & & ( CustomizableSkeletalComponent - > CustomizableObjectInstance ! = nullptr ) )
{
ParentActor = CustomizableSkeletalComponent - > GetAttachmentRootActor ( ) ;
if ( ParentActor ! = nullptr )
{
ArrayData . AddUnique ( CustomizableSkeletalComponent - > CustomizableObjectInstance ) ;
}
}
}
ArrayData . Sort ( [ ] ( UCustomizableObjectInstance & A , UCustomizableObjectInstance & B )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( A . GetPrivate ( ) ! = nullptr ) ;
check ( B . GetPrivate ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
return ( A . GetPrivate ( ) - > LastMinSquareDistFromComponentToPlayer < B . GetPrivate ( ) - > LastMinSquareDistFromComponentToPlayer ) ;
} ) ;
int i ;
const int Max = ArrayData . Num ( ) ;
if ( bFullInfo )
{
for ( i = 0 ; i < Max ; + + i )
{
LogInformationUtil : : LogShowInstanceDataFull ( ArrayData [ i ] , ShowMaterialInfo ) ;
}
}
else
{
FString LogData = " \n \n " ;
for ( i = 0 ; i < Max ; + + i )
{
LogInformationUtil : : LogShowInstanceData ( ArrayData [ i ] , LogData ) ;
}
UE_LOG ( LogMutable , Warning , TEXT ( " %s " ) , * LogData ) ;
UWorld * World = GWorld ;
if ( World )
{
APlayerController * PlayerController = World - > GetFirstPlayerController ( ) ;
if ( PlayerController )
{
PlayerController - > ClientMessage ( LogData ) ;
}
}
}
}
bool UCustomizableObjectSystem : : IsCreated ( )
{
return FCustomizableObjectSystemPrivate : : SSystem ! = 0 ;
}
void UCustomizableObjectSystem : : InitSystem ( )
{
// Everything initialized in Init() instead of constructor to prevent the default UCustomizableObjectSystem from registering a tick function
Private = MakeShareable ( new FCustomizableObjectSystemPrivate ( ) ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
Private - > NewCompilerFunc = nullptr ;
Private - > bReplaceDiscardedWithReferenceMesh = false ;
const IConsoleVariable * CVarSupport16BitBoneIndex = IConsoleManager : : Get ( ) . FindConsoleVariable ( TEXT ( " r.GPUSkin.Support16BitBoneIndex " ) ) ;
Private - > bSupport16BitBoneIndex = CVarSupport16BitBoneIndex ? CVarSupport16BitBoneIndex - > GetBool ( ) : false ;
Private - > CurrentMutableOperation = nullptr ;
Private - > CurrentInstanceBeingUpdated = nullptr ;
# if !UE_SERVER
Private - > TickDelegate = FTickerDelegate : : CreateUObject ( this , & UCustomizableObjectSystem : : Tick ) ;
Private - > TickDelegateHandle = FTSTicker : : GetCoreTicker ( ) . AddTicker ( Private - > TickDelegate , 0.f ) ;
# endif // !UE_SERVER
Private - > TotalBuildMs = 0 ;
Private - > TotalBuiltInstances = 0 ;
Private - > NumInstances = 0 ;
Private - > TextureMemoryUsed = 0 ;
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
SET_DWORD_STAT ( STAT_MutableNumSkeletalMeshes , 0 ) ;
SET_DWORD_STAT ( STAT_MutableNumTextures , 0 ) ;
SET_DWORD_STAT ( STAT_MutableInstanceBuildTime , 0 ) ;
SET_DWORD_STAT ( STAT_MutableInstanceBuildTimeAvrg , 0 ) ;
# endif
mu : : SettingsPtr pSettings = new mu : : Settings ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( pSettings ) ;
2022-09-26 15:12:13 -04:00
pSettings - > SetProfile ( false ) ;
pSettings - > SetStreamingCache ( MUTABLE_STREAMING_CACHE ) ;
Private - > MutableSystem = new mu : : System ( pSettings ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private - > MutableSystem ) ;
2022-09-26 15:12:13 -04:00
Private - > LastStreamingMemorySize = MUTABLE_STREAMING_CACHE ;
Private - > Streamer = new FUnrealMutableModelBulkStreamer ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private - > Streamer ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
Private - > MutableSystem - > SetStreamingInterface ( Private - > Streamer ) ;
// Set up the external image provider, for image parameters.
FUnrealMutableImageProvider * Provider = new FUnrealMutableImageProvider ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Provider ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
Private - > ImageProvider = Provider ;
Private - > MutableSystem - > SetImageParameterGenerator ( Provider ) ;
# if WITH_EDITOR
if ( ! IsRunningGame ( ) )
{
FEditorDelegates : : PreBeginPIE . AddUObject ( this , & UCustomizableObjectSystem : : OnPreBeginPIE ) ;
}
# endif
if ( FParse : : Param ( FCommandLine : : Get ( ) , TEXT ( " MutablePortableSerialization " ) ) )
{
Private - > bCompactSerialization = false ;
}
DefaultInstanceLODManagement = NewObject < UCustomizableInstanceLODManagement > ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( DefaultInstanceLODManagement ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
CurrentInstanceLODManagement = DefaultInstanceLODManagement ;
}
void UCustomizableObjectSystem : : BeginDestroy ( )
{
# if WITH_EDITOR
if ( RecompileCustomizableObjectsCompiler )
{
RecompileCustomizableObjectsCompiler - > ForceFinishCompilation ( ) ;
delete RecompileCustomizableObjectsCompiler ;
}
if ( ! IsRunningGame ( ) )
{
FEditorDelegates : : PreBeginPIE . RemoveAll ( this ) ;
}
# endif
// It could be null, for the default object.
if ( Private . IsValid ( ) )
{
# if !UE_SERVER
FTSTicker : : GetCoreTicker ( ) . RemoveTicker ( Private - > TickDelegateHandle ) ;
# endif // !UE_SERVER
// Discard pending game thread tasks
Private - > PendingTasks . Empty ( ) ;
// Complete pending taskgraph tasks
Private - > WaitForMutableTasks ( ) ;
// Clear the ongoing operation
Private - > CurrentMutableOperation = nullptr ;
// Deallocate streaming
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private - > Streamer ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
Private - > Streamer - > EndStreaming ( ) ;
Private - > CurrentInstanceBeingUpdated = nullptr ;
while ( ! Private - > MutableOperationQueue . IsEmpty ( ) )
{
FMutableQueueElem AuxOperation ;
Private - > MutableOperationQueue . Dequeue ( & AuxOperation ) ;
}
FCustomizableObjectSystemPrivate : : SSystem = nullptr ;
Private = nullptr ;
}
Super : : BeginDestroy ( ) ;
}
FString UCustomizableObjectSystem : : GetDesc ( )
{
return TEXT ( " Customizable Object System Singleton " ) ;
}
FCustomizableObjectCompilerBase * ( * FCustomizableObjectSystemPrivate : : NewCompilerFunc ) ( ) = nullptr ;
FCustomizableObjectCompilerBase * UCustomizableObjectSystem : : GetNewCompiler ( )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
if ( Private - > NewCompilerFunc ! = nullptr )
2022-09-26 15:12:13 -04:00
{
return Private - > NewCompilerFunc ( ) ;
}
else
{
return nullptr ;
}
}
void UCustomizableObjectSystem : : SetNewCompilerFunc ( FCustomizableObjectCompilerBase * ( * InNewCompilerFunc ) ( ) )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
Private - > NewCompilerFunc = InNewCompilerFunc ;
}
void FCustomizableObjectSystemPrivate : : CreatedTexture ( UTexture2D * Texture )
{
// TODO: Do not keep this array unless we are gathering stats!
TextureTrackerArray . Add ( Texture ) ;
INC_DWORD_STAT ( STAT_MutableNumTextures ) ;
}
2022-11-22 04:57:22 -05:00
int32 FCustomizableObjectSystemPrivate : : EnableMutableAnimInfoDebugging = 0 ;
2022-09-26 15:12:13 -04:00
static FAutoConsoleVariableRef CVarEnableMutableAnimInfoDebugging (
2022-11-22 04:57:22 -05:00
TEXT ( " mutable.EnableMutableAnimInfoDebugging " ) , FCustomizableObjectSystemPrivate : : EnableMutableAnimInfoDebugging ,
TEXT ( " If set to 1 or greater print on screen the animation info of the pawn's Customizable Object Instance. Anim BPs, slots and tags will be displayed. "
" If the root Customizable Object is recompiled after this command is run, the used skeletal meshes will also be displayed. " ) ,
2022-09-26 15:12:13 -04:00
ECVF_Default ) ;
void FCustomizableObjectSystemPrivate : : UpdateStats ( )
{
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
bool bLogEnabled = true ;
# else
bool bLogEnabled = LogBenchmarkUtil : : isLoggingActive ( ) ;
# endif
if ( bLogEnabled )
{
CountAllocatedSkeletalMesh = 0 ;
int CountLOD0 = 0 ;
int CountLOD1 = 0 ;
int CountLOD2 = 0 ;
int CountTotal = 0 ;
int CountPending = 0 ;
for ( TObjectIterator < UCustomizableObjectInstance > CustomizableObjectInstance ; CustomizableObjectInstance ; + + CustomizableObjectInstance )
{
if ( IsValidChecked ( * CustomizableObjectInstance ) & & CustomizableObjectInstance - > GetPrivate ( ) )
{
+ + CountTotal ;
if ( CustomizableObjectInstance - > SkeletalMeshStatus = = ESkeletalMeshState : : AsyncUpdatePending )
{
+ + CountPending ;
}
for ( int32 ComponentIndex = 0 ; ComponentIndex < CustomizableObjectInstance - > SkeletalMeshes . Num ( ) ; + + ComponentIndex )
{
if ( CustomizableObjectInstance - > SkeletalMeshes [ ComponentIndex ] & & CustomizableObjectInstance - > SkeletalMeshes [ ComponentIndex ] - > GetResourceForRendering ( ) )
{
CountAllocatedSkeletalMesh + + ;
2022-11-28 07:21:35 -05:00
if ( CustomizableObjectInstance - > GetCurrentMinLOD ( ) < 1 )
2022-09-26 15:12:13 -04:00
{
+ + CountLOD0 ;
}
2022-11-28 07:21:35 -05:00
else if ( CustomizableObjectInstance - > GetCurrentMaxLOD ( ) < 2 )
2022-09-26 15:12:13 -04:00
{
+ + CountLOD1 ;
}
else
{
+ + CountLOD2 ;
}
}
}
}
}
NumInstances = CountLOD0 + CountLOD1 + CountLOD2 ;
TotalInstances = CountTotal ;
NumPendingInstances = CountPending ;
//SET_DWORD_STAT(STAT_MutableSkeletalMeshResourceMemory, Size / 1024.f);
SET_DWORD_STAT ( STAT_MutablePendingInstanceUpdates , MutableOperationQueue . Num ( ) ) ;
uint64 Size = 0 ;
uint32 CountAllocated = 0 ;
for ( TWeakObjectPtr < UTexture2D > & Tracker : TextureTrackerArray )
{
if ( Tracker . IsValid ( ) & & Tracker - > GetResource ( ) )
{
CountAllocated + + ;
if ( Tracker - > GetResource ( ) - > TextureRHI )
{
Size + = Tracker - > CalcTextureMemorySizeEnum ( TMC_AllMips ) ;
}
}
}
TextureMemoryUsed = int64_t ( Size / 1024 ) ;
uint64 SizeDecoration = 0 ;
uint64 SizeGenerated = 0 ;
for ( TObjectIterator < UCustomizableObjectInstance > CustomizableObjectInstance ; CustomizableObjectInstance ; + + CustomizableObjectInstance )
{
if ( IsValidChecked ( * CustomizableObjectInstance ) & & CustomizableObjectInstance - > GetPrivate ( ) & & CustomizableObjectInstance - > HasAnySkeletalMesh ( ) )
{
bool bHasResourceForRendering = false ;
for ( int32 MeshIndex = 0 ; ! bHasResourceForRendering & & MeshIndex < CustomizableObjectInstance - > SkeletalMeshes . Num ( ) ; + + MeshIndex )
{
bHasResourceForRendering = CustomizableObjectInstance - > GetSkeletalMesh ( MeshIndex ) & & CustomizableObjectInstance - > GetSkeletalMesh ( MeshIndex ) - > GetResourceForRendering ( ) ;
}
if ( bHasResourceForRendering )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
for ( const FParameterDecorations & ParameterDecoration : CustomizableObjectInstance - > GetPrivate ( ) - > ParameterDecorations )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
for ( const UTexture2D * ParameterDecorationImage : ParameterDecoration . Images )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( ParameterDecorationImage & & ParameterDecorationImage - > IsValidLowLevel ( ) )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
SizeDecoration + = ParameterDecorationImage - > CalcTextureMemorySizeEnum ( TMC_AllMips ) ;
2022-09-26 15:12:13 -04:00
}
}
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
for ( const FGeneratedTexture & GeneratedTextures : CustomizableObjectInstance - > GetPrivate ( ) - > GeneratedTextures )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( GeneratedTextures . Texture )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( GeneratedTextures . Texture ! = nullptr ) ;
SizeGenerated + = GeneratedTextures . Texture - > CalcTextureMemorySizeEnum ( TMC_AllMips ) ;
2022-09-26 15:12:13 -04:00
}
}
}
}
}
if ( LogBenchmarkUtil : : isLoggingActive ( ) )
{
LogBenchmarkUtil : : updateStat ( " customizable_objects " , ( int32 ) CountAllocatedSkeletalMesh ) ;
LogBenchmarkUtil : : updateStat ( " pending_instance_updates " , MutableOperationQueue . Num ( ) ) ;
LogBenchmarkUtil : : updateStat ( " allocated_textures " , ( int32 ) CountAllocated ) ;
LogBenchmarkUtil : : updateStat ( " texture_resource_memory " , ( long double ) Size / 1048576.0 L ) ;
LogBenchmarkUtil : : updateStat ( " texture_generated_memory " , ( long double ) SizeGenerated / 1048576.0 L ) ;
}
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
SET_DWORD_STAT ( STAT_MutableNumInstancesLOD0 , CountLOD0 ) ;
SET_DWORD_STAT ( STAT_MutableNumInstancesLOD1 , CountLOD1 ) ;
SET_DWORD_STAT ( STAT_MutableNumInstancesLOD2 , CountLOD2 ) ;
SET_DWORD_STAT ( STAT_MutableNumAllocatedSkeletalMeshes , CountAllocatedSkeletalMesh ) ;
SET_DWORD_STAT ( STAT_MutablePendingInstanceUpdates , MutableOperationQueue . Num ( ) ) ;
SET_DWORD_STAT ( STAT_MutableNumAllocatedTextures , CountAllocated ) ;
SET_DWORD_STAT ( STAT_MutableTextureResourceMemory , Size / 1024.f ) ;
SET_DWORD_STAT ( STAT_MutableTextureParameterDecorationMemory , SizeDecoration / 1024.f ) ;
SET_DWORD_STAT ( STAT_MutableTextureGeneratedMemory , SizeGenerated / 1024.f ) ;
# endif
2022-11-22 04:57:22 -05:00
# if WITH_EDITORONLY_DATA
if ( FCustomizableObjectSystemPrivate : : IsMutableAnimInfoDebuggingEnabled ( ) )
2022-09-26 15:12:13 -04:00
{
if ( GEngine )
{
bool bFoundPlayer = false ;
int32 MsgIndex = 15820 ; // Arbitrary big value to prevent collisions with other on-screen messages
for ( TObjectIterator < UCustomizableSkeletalComponent > CustomizableSkeletalComponent ; CustomizableSkeletalComponent ; + + CustomizableSkeletalComponent )
{
AActor * ParentActor = CustomizableSkeletalComponent - > GetAttachmentRootActor ( ) ;
UCustomizableObjectInstance * Instance = CustomizableSkeletalComponent - > CustomizableObjectInstance ;
APawn * PlayerPawn = UGameplayStatics : : GetPlayerPawn ( CustomizableSkeletalComponent - > GetWorld ( ) , 0 ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( ParentActor & & ( ParentActor = = PlayerPawn ) & & Instance )
2022-09-26 15:12:13 -04:00
{
bFoundPlayer = true ;
FString TagString ;
const FGameplayTagContainer & Tags = Instance - > GetAnimationGameplayTags ( ) ;
for ( const FGameplayTag & Tag : Tags )
{
TagString + = ! TagString . IsEmpty ( ) ? FString ( TEXT ( " , " ) ) : FString ( ) ;
TagString + = Tag . ToString ( ) ;
}
GEngine - > AddOnScreenDebugMessage ( MsgIndex + + , .0f , FColor : : Green , TEXT ( " Animation tags: " ) + TagString ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Instance - > GetPrivate ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
FCustomizableInstanceComponentData * ComponentData = Instance - > GetPrivate ( ) - > GetComponentData ( CustomizableSkeletalComponent - > ComponentIndex ) ;
if ( ComponentData )
{
for ( TPair < int32 , TSoftClassPtr < UAnimInstance > > & Entry : ComponentData - > AnimSlotToBP )
{
FString AnimBPSlot ;
AnimBPSlot + = FString : : Printf ( TEXT ( " %d " ) , Entry . Key ) + FString ( " - " ) + Entry . Value . GetAssetName ( ) ;
GEngine - > AddOnScreenDebugMessage ( MsgIndex + + , .0f , FColor : : Green , AnimBPSlot ) ;
}
}
GEngine - > AddOnScreenDebugMessage ( MsgIndex + + , .0f , FColor : : Green , TEXT ( " Slots-AnimBP: " ) ) ;
2022-11-22 04:57:22 -05:00
if ( ComponentData )
{
if ( ComponentData - > MeshPartPaths . IsEmpty ( ) )
{
GEngine - > AddOnScreenDebugMessage ( MsgIndex + + , .0f , FColor : : Magenta ,
TEXT ( " No meshes found. In order to see the meshes compile the pawn's root CustomizableObject after the 'mutable.EnableMutableAnimInfoDebugging 1' command has been run. " ) ) ;
}
for ( const FString & MeshPath : ComponentData - > MeshPartPaths )
{
GEngine - > AddOnScreenDebugMessage ( MsgIndex + + , .0f , FColor : : Magenta , MeshPath ) ;
}
}
GEngine - > AddOnScreenDebugMessage ( MsgIndex + + , .0f , FColor : : Magenta , TEXT ( " Meshes: " ) ) ;
GEngine - > AddOnScreenDebugMessage ( MsgIndex + + , .0f , FColor : : Cyan ,
TEXT ( " Player Pawn Mutable Mesh/Animation info for component " ) + FString : : Printf ( TEXT ( " %d " ) ,
CustomizableSkeletalComponent - > ComponentIndex ) ) ;
2022-09-26 15:12:13 -04:00
}
}
if ( ! bFoundPlayer )
{
GEngine - > AddOnScreenDebugMessage ( MsgIndex , .0f , FColor : : Yellow , TEXT ( " Mutable Animation info: N/A " ) ) ;
}
}
}
2022-11-22 04:57:22 -05:00
# endif
2022-09-26 15:12:13 -04:00
}
}
void FCustomizableObjectSystemPrivate : : AddReferencedObjects ( FReferenceCollector & Collector )
{
if ( CurrentInstanceBeingUpdated )
{
Collector . AddReferencedObject ( CurrentInstanceBeingUpdated ) ;
}
}
2022-11-11 14:11:45 -05:00
int32 FCustomizableObjectSystemPrivate : : EnableMutableProgressiveMipStreaming = 1 ;
2022-09-26 15:12:13 -04:00
// Warning! If this is enabled, do not get references to the textures generated by Mutable! They are owned by Mutable and could become invalid at any moment
static FAutoConsoleVariableRef CVarEnableMutableProgressiveMipStreaming (
TEXT ( " mutable.EnableMutableProgressiveMipStreaming " ) , FCustomizableObjectSystemPrivate : : EnableMutableProgressiveMipStreaming ,
TEXT ( " If set to 1 or greater use progressive Mutable Mip streaming for Mutable textures. If disabled, all mips will always be generated and spending memory. In that case, on Desktop platforms they will be stored in CPU memory, on other platforms textures will be non-streaming. " ) ,
ECVF_Default ) ;
2023-01-11 14:44:41 -05:00
int32 FCustomizableObjectSystemPrivate : : EnableMutableLiveUpdate = 1 ;
static FAutoConsoleVariableRef CVarEnableMutableLiveUpdate (
TEXT ( " mutable.EnableMutableLiveUpdate " ) , FCustomizableObjectSystemPrivate : : EnableMutableLiveUpdate ,
TEXT ( " If set to 1 or greater Mutable can use the live update mode if set in the current Mutable state. If disabled, it will never use live update mode even if set in the current Mutable state. " ) ,
ECVF_Default ) ;
2023-01-19 10:44:15 -05:00
int32 FCustomizableObjectSystemPrivate : : EnableReuseInstanceTextures = 0 ;
static FAutoConsoleVariableRef CVarEnableMutableReuseInstanceTextures (
TEXT ( " mutable.EnableReuseInstanceTextures " ) , FCustomizableObjectSystemPrivate : : EnableReuseInstanceTextures ,
TEXT ( " If set to 1 or greater and set in the corresponding setting in the current Mutable state, Mutable can reuse instance UTextures (only uncompressed and not streaming, so set the options in the state) and their resources between updates when they are modified. If geometry or state is changed they cannot be reused. " ) ,
ECVF_Default ) ;
2023-01-24 08:45:18 -05:00
bool FCustomizableObjectSystemPrivate : : bEnableMutableReusePreviousUpdateData = false ;
static FAutoConsoleVariableRef CVarEnableMutableReusePreviousUpdateData (
TEXT ( " mutable.EnableMutableReusePreviousUpdateData " ) , FCustomizableObjectSystemPrivate : : bEnableMutableReusePreviousUpdateData ,
TEXT ( " If true, Mutable will try to reuse render sections from previous SkeletalMeshes. If false, all SkeletalMeshes will be build from scratch. " ) ,
ECVF_Default ) ;
2023-01-27 14:45:45 -05:00
int32 FCustomizableObjectSystemPrivate : : EnableOnlyGenerateRequestedLODs = 1 ;
2023-01-24 08:45:18 -05:00
static FAutoConsoleVariableRef CVarEnableOnlyGenerateRequestedLODs (
2023-01-27 14:45:45 -05:00
TEXT ( " mutable.EnableOnlyGenerateRequestedLODs " ) , FCustomizableObjectSystemPrivate : : EnableOnlyGenerateRequestedLODs ,
TEXT ( " If 1 or greater, Only the RequestedLODLevels will be generated. If 0, all LODs will be build. " ) ,
2023-01-24 08:45:18 -05:00
ECVF_Default ) ;
2023-02-02 02:41:54 -05:00
int32 FCustomizableObjectSystemPrivate : : EnableSkipGenerateResidentMips = 1 ;
static FAutoConsoleVariableRef CVarSkipGenerateResidentMips (
TEXT ( " mutable.EnableSkipGenerateResidentMips " ) , FCustomizableObjectSystemPrivate : : EnableSkipGenerateResidentMips ,
TEXT ( " If 1 or greater, resident mip generation will be optional. If 0, resident mips will be always generated " ) ,
ECVF_Default ) ;
2023-01-24 08:45:18 -05:00
2022-10-10 07:09:51 -04:00
/** Update the given Instance Skeletal Meshes and call its callbacks. */
2023-01-24 08:45:18 -05:00
void UpdateSkeletalMesh ( UCustomizableObjectInstance * CustomizableObjectInstance , const FDescriptorRuntimeHash & UpdatedDescriptorRuntimeHash )
2022-10-10 07:09:51 -04:00
{
// This used to be CustomizableObjectInstance::UpdateSkeletalMesh_PostBeginUpdate3
{
MUTABLE_CPUPROFILER_SCOPE ( UpdateSkeletalMesh_PostBeginUpdate3 ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( CustomizableObjectInstance ! = nullptr ) ;
2022-10-10 07:09:51 -04:00
# if !WITH_EDITOR
for ( int32 ComponentIndex = 0 ; ComponentIndex < CustomizableObjectInstance - > SkeletalMeshes . Num ( ) ; + + ComponentIndex )
{
if ( CustomizableObjectInstance - > SkeletalMeshes [ ComponentIndex ] )
{
CustomizableObjectInstance - > SkeletalMeshes [ ComponentIndex ] - > RebuildSocketMap ( ) ;
}
}
# endif
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
UCustomizableInstancePrivateData * CustomizableObjectInstancePrivateData = CustomizableObjectInstance - > GetPrivate ( ) ;
check ( CustomizableObjectInstancePrivateData ! = nullptr ) ;
2022-10-10 07:09:51 -04:00
for ( TObjectIterator < UCustomizableSkeletalComponent > It ; It ; + + It )
{
UCustomizableSkeletalComponent * CustomizableSkeletalComponent = * It ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( CustomizableSkeletalComponent & &
( CustomizableSkeletalComponent - > CustomizableObjectInstance = = CustomizableObjectInstance ) & &
CustomizableObjectInstance - > SkeletalMeshes . IsValidIndex ( CustomizableSkeletalComponent - > ComponentIndex )
)
2022-10-10 07:09:51 -04:00
{
MUTABLE_CPUPROFILER_SCOPE ( UpdateSkeletalMesh_SetSkeletalMesh ) ;
2023-01-24 08:45:18 -05:00
const bool bIsCreatingSkeletalMesh = CustomizableObjectInstancePrivateData - > HasCOInstanceFlags ( CreatingSkeletalMesh ) ; //TODO MTBL-391: Review
2022-10-10 07:09:51 -04:00
CustomizableSkeletalComponent - > SetSkeletalMesh ( CustomizableObjectInstance - > SkeletalMeshes [ CustomizableSkeletalComponent - > ComponentIndex ] , false , bIsCreatingSkeletalMesh ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( CustomizableObjectInstancePrivateData - > HasCOInstanceFlags ( ReplacePhysicsAssets ) )
2022-10-10 07:09:51 -04:00
{
CustomizableSkeletalComponent - > SetPhysicsAsset (
CustomizableObjectInstance - > SkeletalMeshes [ CustomizableSkeletalComponent - > ComponentIndex ] ?
CustomizableObjectInstance - > SkeletalMeshes [ CustomizableSkeletalComponent - > ComponentIndex ] - > GetPhysicsAsset ( ) : nullptr ) ;
}
}
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
CustomizableObjectInstancePrivateData - > SetCOInstanceFlags ( Generated ) ;
CustomizableObjectInstancePrivateData - > ClearCOInstanceFlags ( CreatingSkeletalMesh ) ;
2022-10-10 07:09:51 -04:00
CustomizableObjectInstance - > bEditorPropertyChanged = false ;
{
MUTABLE_CPUPROFILER_SCOPE ( UpdateSkeletalMesh_UpdatedDelegate ) ;
2023-01-25 11:08:55 -05:00
EUpdateResult State = CustomizableObjectInstance - > SkeletalMeshStatus = = ESkeletalMeshState : : Correct ? EUpdateResult : : Success : EUpdateResult : : Error ;
CustomizableObjectInstance - > Updated ( State , UpdatedDescriptorRuntimeHash ) ;
2023-01-24 08:45:18 -05:00
2022-10-10 07:09:51 -04:00
# if WITH_EDITOR
CustomizableObjectInstance - > InstanceUpdated = true ;
// \TODO: Review if we can avoid all this editor code here.
for ( int32 MeshIndex = 0 ; MeshIndex < CustomizableObjectInstance - > SkeletalMeshes . Num ( ) ; + + MeshIndex )
{
if ( USkeletalMesh * SkeletalMesh = CustomizableObjectInstance - > GetSkeletalMesh ( MeshIndex ) )
{
FUnrealBakeHelpers : : BakeHelper_RegenerateImportedModel ( SkeletalMesh ) ;
}
}
# endif //WITH_EDITOR
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( UCustomizableObjectSystem : : GetInstance ( ) ! = nullptr ) ;
2022-10-10 07:09:51 -04:00
FCustomizableObjectSystemPrivate * CustomizableObjectSystem = UCustomizableObjectSystem : : GetInstance ( ) - > GetPrivate ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( CustomizableObjectSystem ! = nullptr ) ;
2022-10-10 07:09:51 -04:00
if ( CustomizableObjectSystem - > bReleaseTexturesImmediately )
{
FMutableResourceCache & Cache = CustomizableObjectSystem - > GetObjectCache ( CustomizableObjectInstance - > GetCustomizableObject ( ) ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
for ( TPair < uint32 , FGeneratedTexture > & Item : CustomizableObjectInstancePrivateData - > TexturesToRelease )
2022-10-10 07:09:51 -04:00
{
UCustomizableInstancePrivateData : : ReleaseMutableTexture ( Item . Value . Id , Item . Value . Texture , Cache ) ;
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
CustomizableObjectInstancePrivateData - > TexturesToRelease . Empty ( ) ;
2022-10-10 07:09:51 -04:00
}
}
}
2022-11-03 14:23:46 -04:00
void FCustomizableObjectSystemPrivate : : InitUpdateSkeletalMesh ( UCustomizableObjectInstance & Instance , FMutableQueueElem : : EQueuePriorityType Priority )
2022-09-26 15:12:13 -04:00
{
MUTABLE_CPUPROFILER_SCOPE ( FCustomizableObjectSystemPrivate : : InitUpdateSkeletalMesh ) ;
check ( IsInGameThread ( ) ) ;
2022-11-03 14:23:46 -04:00
const FString CurrentState = Instance . GetCurrentState ( ) ;
const FParameterUIData * State = Instance . GetCustomizableObject ( ) - > StateUIDataMap . Find ( CurrentState ) ;
const bool bNeverStream = State ? State - > bDontCompressRuntimeTextures : false ;
const bool bUseMipmapStreaming = ! bNeverStream ;
int32 MipsToSkip = 0 ; // 0 means all mips
2022-09-26 15:12:13 -04:00
2022-11-03 14:23:46 -04:00
if ( bUseMipmapStreaming & & EnableMutableProgressiveMipStreaming )
2022-09-26 15:12:13 -04:00
{
2022-11-03 14:23:46 -04:00
MipsToSkip = 255 ; // This means skip all possible mips until only UTexture::GetStaticMinTextureResidentMipCount() are left
2022-09-26 15:12:13 -04:00
}
2022-11-03 14:23:46 -04:00
const TSharedPtr < FMutableOperation > Operation = MakeShared < FMutableOperation > ( FMutableOperation : : CreateInstanceUpdate ( & Instance , bNeverStream , MipsToSkip ) ) ;
const FDescriptorRuntimeHash UpdateDescriptorHash = Instance . GetUpdateDescriptorRuntimeHash ( ) ;
if ( const FMutableQueueElem * QueueElem = MutableOperationQueue . Get ( & Instance ) )
2022-09-26 15:12:13 -04:00
{
2022-11-03 14:23:46 -04:00
if ( const TSharedPtr < FMutableOperation > & QueuedOperation = QueueElem - > Operation ;
QueuedOperation & &
QueuedOperation - > Type = = FMutableOperation : : EOperationType : : Update & &
UpdateDescriptorHash . IsSubset ( QueuedOperation - > InstanceDescriptorRuntimeHash ) )
2022-09-26 15:12:13 -04:00
{
2022-11-03 14:23:46 -04:00
return ; // The the requested update is equal to the last enqueued update.
2022-09-26 15:12:13 -04:00
}
2022-11-03 14:23:46 -04:00
}
2022-10-20 12:58:14 -04:00
2022-11-03 14:23:46 -04:00
if ( CurrentMutableOperation & &
CurrentMutableOperation - > Type = = FMutableOperation : : EOperationType : : Update & &
UpdateDescriptorHash . IsSubset ( CurrentMutableOperation - > InstanceDescriptorRuntimeHash ) )
{
2023-01-24 08:45:18 -05:00
return ; // The requested update is equal to the running update.
2022-11-03 14:23:46 -04:00
}
2022-11-04 09:18:44 -04:00
2022-11-03 14:23:46 -04:00
// These delegates must be called at the end of the begin update.
Instance . BeginUpdateDelegate . Broadcast ( & Instance ) ;
Instance . BeginUpdateNativeDelegate . Broadcast ( & Instance ) ;
2022-09-26 15:12:13 -04:00
2022-11-03 14:23:46 -04:00
if ( UpdateDescriptorHash . IsSubset ( Instance . GetDescriptorRuntimeHash ( ) ) )
{
Instance . SkeletalMeshStatus = ESkeletalMeshState : : Correct ; // TODO GMT MTBL-1033 should not be here. Move to UCustomizableObjectInstance::Updated
2023-01-24 08:45:18 -05:00
UpdateSkeletalMesh ( & Instance , Instance . GetDescriptorRuntimeHash ( ) ) ;
2022-09-26 15:12:13 -04:00
}
2022-10-10 07:09:51 -04:00
else
{
2023-01-24 08:45:18 -05:00
Instance . SkeletalMeshStatus = ESkeletalMeshState : : AsyncUpdatePending ;
2022-11-03 14:23:46 -04:00
MutableOperationQueue . Enqueue ( FMutableQueueElem : : Create ( Operation , Priority , Instance . GetPrivate ( ) - > MinSquareDistFromComponentToPlayer ) ) ;
2022-10-10 07:09:51 -04:00
}
2022-09-26 15:12:13 -04:00
}
void FCustomizableObjectSystemPrivate : : InitDiscardResourcesSkeletalMesh ( UCustomizableObjectInstance * InCustomizableObjectInstance )
{
check ( IsInGameThread ( ) ) ;
if ( InCustomizableObjectInstance & & InCustomizableObjectInstance - > IsValidLowLevel ( ) )
{
const TSharedRef < FMutableOperation > Operation = MakeShared < FMutableOperation > ( FMutableOperation : : CreateInstanceDiscard ( InCustomizableObjectInstance ) ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( InCustomizableObjectInstance - > GetPrivate ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
MutableOperationQueue . Enqueue ( FMutableQueueElem : : Create ( Operation , FMutableQueueElem : : EQueuePriorityType : : High , InCustomizableObjectInstance - > GetPrivate ( ) - > MinSquareDistFromComponentToPlayer ) ) ;
}
}
2023-01-10 15:48:59 -05:00
void FCustomizableObjectSystemPrivate : : InitInstanceIDRelease ( mu : : Instance : : ID IDToRelease )
{
check ( IsInGameThread ( ) ) ;
const TSharedRef < FMutableOperation > Operation = MakeShared < FMutableOperation > ( FMutableOperation : : CreateInstanceIDRelease ( IDToRelease ) ) ;
MutableOperationQueue . Enqueue ( FMutableQueueElem : : Create ( Operation , FMutableQueueElem : : EQueuePriorityType : : High , 0 ) ) ;
}
2022-09-26 15:12:13 -04:00
bool UCustomizableObjectSystem : : IsReplaceDiscardedWithReferenceMeshEnabled ( ) const
{
if ( Private . IsValid ( ) )
{
return Private - > IsReplaceDiscardedWithReferenceMeshEnabled ( ) ;
}
return false ;
}
void UCustomizableObjectSystem : : SetReplaceDiscardedWithReferenceMeshEnabled ( bool bIsEnabled )
{
if ( Private . IsValid ( ) )
{
Private - > SetReplaceDiscardedWithReferenceMeshEnabled ( bIsEnabled ) ;
}
}
void UCustomizableObjectSystem : : ClearResourceCacheProtected ( )
{
check ( IsInGameThread ( ) ) ;
ProtectedCachedTextures . Reset ( 0 ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( GetPrivate ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
GetPrivate ( ) - > ProtectedObjectCachedImages . Reset ( 0 ) ;
}
# if WITH_EDITOR
bool UCustomizableObjectSystem : : LockObject ( const class UCustomizableObject * InObject )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( InObject ! = nullptr ) ;
check ( InObject - > GetPrivate ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
check ( ! InObject - > GetPrivate ( ) - > bLocked ) ;
2022-11-24 10:07:28 -05:00
check ( IsInGameThread ( ) & & ! IsInParallelGameThread ( ) ) ;
2022-09-26 15:12:13 -04:00
// If the current instance is for this object, make the lock fail by returning false
if ( Private - > CurrentInstanceBeingUpdated & &
Private - > CurrentInstanceBeingUpdated - > GetCustomizableObject ( ) = = InObject )
{
UE_LOG ( LogMutable , Warning , TEXT ( " ---- failed to lock object %s " ) , * InObject - > GetName ( ) ) ;
2022-11-24 10:07:28 -05:00
return false ;
}
FString Message = FString : : Printf ( TEXT ( " Customizable Object %s has pending texture streaming operations. Please wait a few seconds and try again. " ) ,
* InObject - > GetName ( ) ) ;
// Pre-check pending operations before locking. This check is redundant and incomplete because it's checked again after locking
// and some operations may start between here and the actual lock. But in the CO Editor preview it will prevent some
// textures getting stuck at low resolution when they try to update mips and are cancelled when the user presses
// the compile button but the compilation quits anyway because there are pending operations
if ( CheckIfDiskOrMipUpdateOperationsPending ( * InObject ) )
{
UE_LOG ( LogMutable , Warning , TEXT ( " %s " ) , * Message ) ;
return false ;
}
// Lock the object, no new file or mip streaming operations should start from this point
InObject - > GetPrivate ( ) - > bLocked = true ;
// But some could have started between the first CheckIfDiskOrMipUpdateOperationsPending and the lock a few lines back, so check again
if ( CheckIfDiskOrMipUpdateOperationsPending ( * InObject ) )
{
UE_LOG ( LogMutable , Warning , TEXT ( " %s " ) , * Message ) ;
// Unlock and return because the pending operations cannot be easily stopped now, the compilation hasn't started and the CO
// hasn't changed state yet. It's simpler to quit the compilation, unlock and let the user try to compile again
InObject - > GetPrivate ( ) - > bLocked = false ;
2022-09-26 15:12:13 -04:00
return false ;
}
// Ensure that we don't try to handle any further streaming operations for this object
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( GetPrivate ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
if ( GetPrivate ( ) - > Streamer )
{
GetPrivate ( ) - > Streamer - > CancelStreamingForObject ( InObject ) ;
}
// Clear the cache for the instance, since we will remake it
FMutableResourceCache & Cache = GetPrivate ( ) - > GetObjectCache ( InObject ) ;
Cache . Clear ( ) ;
2022-11-24 10:07:28 -05:00
check ( InObject - > GetPrivate ( ) - > bLocked ) ;
2022-09-26 15:12:13 -04:00
return true ;
}
void UCustomizableObjectSystem : : UnlockObject ( const class UCustomizableObject * Obj )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Obj ! = nullptr ) ;
check ( Obj - > GetPrivate ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
check ( Obj - > GetPrivate ( ) - > bLocked ) ;
2022-11-24 10:07:28 -05:00
check ( IsInGameThread ( ) & & ! IsInParallelGameThread ( ) ) ;
2022-09-26 15:12:13 -04:00
Obj - > GetPrivate ( ) - > bLocked = false ;
}
2022-11-24 10:07:28 -05:00
bool UCustomizableObjectSystem : : CheckIfDiskOrMipUpdateOperationsPending ( const UCustomizableObject & Object ) const
{
for ( TObjectIterator < UCustomizableObjectInstance > CustomizableObjectInstance ; CustomizableObjectInstance ; + + CustomizableObjectInstance )
{
if ( CustomizableObjectInstance - > GetCustomizableObject ( ) = = & Object )
{
for ( const FGeneratedTexture & GeneratedTexture : CustomizableObjectInstance - > GetPrivate ( ) - > GeneratedTextures )
{
if ( GeneratedTexture . Texture - > HasPendingInitOrStreaming ( ) )
{
return true ;
}
}
}
}
// Ensure that we don't try to handle any further streaming operations for this object
check ( GetPrivate ( ) ) ;
if ( const FUnrealMutableModelBulkStreamer * Streamer = GetPrivate ( ) - > Streamer )
{
if ( Streamer - > AreTherePendingStreamingOperationsForObject ( & Object ) )
{
return true ;
}
}
return false ;
}
2022-09-26 15:12:13 -04:00
void UCustomizableObjectSystem : : EditorSettingsChanged ( const FEditorCompileSettings & InEditorSettings )
{
EditorSettings = InEditorSettings ;
}
bool UCustomizableObjectSystem : : IsCompilationDisabled ( ) const
{
return EditorSettings . bDisableCompilation ;
}
bool UCustomizableObjectSystem : : IsAutoCompileEnabled ( ) const
{
return EditorSettings . bEnableAutomaticCompilation ;
}
bool UCustomizableObjectSystem : : IsAutoCompilationSync ( ) const
{
return EditorSettings . bCompileObjectsSynchronously ;
}
# endif
void UCustomizableObjectSystem : : PurgePendingReleaseSkeletalMesh ( )
{
MUTABLE_CPUPROFILER_SCOPE ( UCustomizableObjectSystem : : PurgePendingReleaseSkeletalMesh ) ;
double CurTime = FPlatformTime : : Seconds ( ) ;
static double TimeToDelete = 1.0 ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
for ( int32 InfoIndex = PendingReleaseSkeletalMesh . Num ( ) - 1 ; InfoIndex > = 0 ; - - InfoIndex )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
FPendingReleaseSkeletalMeshInfo & Info = PendingReleaseSkeletalMesh [ InfoIndex ] ;
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( Info . SkeletalMesh ! = nullptr )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( ( CurTime - Info . TimeStamp ) > = TimeToDelete )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( Info . SkeletalMesh - > GetSkeleton ( ) )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
Info . SkeletalMesh - > GetSkeleton ( ) - > ClearCacheData ( ) ;
2022-09-26 15:12:13 -04:00
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
Info . SkeletalMesh - > GetRefSkeleton ( ) . Empty ( ) ;
Info . SkeletalMesh - > GetMaterials ( ) . Empty ( ) ;
Info . SkeletalMesh - > GetRefBasesInvMatrix ( ) . Empty ( ) ;
Info . SkeletalMesh - > ReleaseResources ( ) ;
Info . SkeletalMesh - > ReleaseResourcesFence . Wait ( ) ;
2022-09-26 15:12:13 -04:00
// TODO: This was done for version 4.18
//info.SkeletalMesh->GetImportedResource()->LODModels.Empty();
//info.SkeletalMesh->LODInfo.Empty();
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
PendingReleaseSkeletalMesh . RemoveAt ( InfoIndex ) ;
2022-09-26 15:12:13 -04:00
}
}
}
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
void UCustomizableObjectSystem : : AddPendingReleaseSkeletalMesh ( USkeletalMesh * SkeletalMesh )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( SkeletalMesh ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
FPendingReleaseSkeletalMeshInfo Info ;
Info . SkeletalMesh = SkeletalMesh ;
Info . TimeStamp = FPlatformTime : : Seconds ( ) ;
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
PendingReleaseSkeletalMesh . Add ( Info ) ;
2022-09-26 15:12:13 -04:00
}
void UCustomizableObjectSystem : : ClearCurrentMutableOperation ( )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
Private - > CurrentInstanceBeingUpdated = nullptr ;
Private - > CurrentMutableOperation = nullptr ;
ClearResourceCacheProtected ( ) ;
}
void FCustomizableObjectSystemPrivate : : UpdateStreamingLimit ( )
{
// This must run on game thread, and when the mutable thread is not running
check ( IsInGameThread ( ) ) ;
int32 VarValue = CVarStreamingMemory . GetValueOnGameThread ( ) ;
uint64_t MemoryBytes = VarValue < 0 ? MUTABLE_STREAMING_CACHE : uint64_t ( VarValue ) * 1024 ;
if ( MemoryBytes ! = LastStreamingMemorySize )
{
LastStreamingMemorySize = MemoryBytes ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( MutableSystem ) ;
2022-09-26 15:12:13 -04:00
MutableSystem - > SetStreamingCache ( MemoryBytes ) ;
}
}
// Asynchronous tasks performed during the creation or update of a mutable instance.
// Check the documentation before modifying and keep it up to date.
// https://docs.google.com/drawings/d/109NlsdKVxP59K5TuthJkleVG3AROkLJr6N03U4bNp4s
// When it says "mutable thread" it means any task pool thread, but with the guarantee that no other thread is using the mutable runtime.
// Naming: Task_<thread>_<description>
namespace impl
{
2022-12-09 03:57:57 -05:00
void Subtask_Mutable_UpdateParameterDecorations ( const TSharedPtr < FMutableOperationData > & OperationData , const TSharedPtr < mu : : Model , ESPMode : : ThreadSafe > & MutableModel , const mu : : Parameters * MutableParameters )
2022-09-26 15:12:13 -04:00
{
MUTABLE_CPUPROFILER_SCOPE ( UCustomizableInstancePrivateData : : UpdateParameterDecorations )
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( OperationData ) ;
2022-09-26 15:12:13 -04:00
OperationData - > ParametersUpdateData . Clear ( ) ;
OperationData - > RelevantParametersInProgress . Empty ( ) ;
check ( MutableParameters ) ;
// This must run in the mutable thread.
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( UCustomizableObjectSystem : : GetInstance ( ) ! = nullptr ) ;
check ( UCustomizableObjectSystem : : GetInstance ( ) - > GetPrivate ( ) ! = nullptr ) ;
mu : : SystemPtr MutableSystem = UCustomizableObjectSystem : : GetInstance ( ) - > GetPrivate ( ) - > MutableSystem ;
2022-09-26 15:12:13 -04:00
// Decorations
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
int32 NumParameters = MutableParameters - > GetCount ( ) ;
2022-09-26 15:12:13 -04:00
{
MUTABLE_CPUPROFILER_SCOPE ( ParameterDecorations )
// Generate all the images that decorate the parameters UI, only in the editor.
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
for ( int32 ParamIndex = 0 ; ParamIndex < NumParameters ; + + ParamIndex )
2022-09-26 15:12:13 -04:00
{
FParameterDecorationsUpdateData : : FParameterDesc ParamData ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
for ( int32 ImageIndex = 0 ; ImageIndex < MutableParameters - > GetAdditionalImageCount ( ParamIndex ) ; + + ImageIndex )
2022-09-26 15:12:13 -04:00
{
mu : : ImagePtrConst Image = MutableSystem - > BuildParameterAdditionalImage (
2022-12-09 03:57:57 -05:00
MutableModel ,
2022-09-26 15:12:13 -04:00
MutableParameters ,
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
ParamIndex , ImageIndex ) ;
2022-09-26 15:12:13 -04:00
ParamData . Images . Add ( Image ) ;
} ;
OperationData - > ParametersUpdateData . Parameters . Add ( ParamData ) ;
}
}
// Update the parameter relevancy.
{
MUTABLE_CPUPROFILER_SCOPE ( ParameterRelevancy )
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
TArray < bool > Relevant ;
Relevant . SetNumZeroed ( NumParameters ) ;
MutableSystem - > GetParameterRelevancy ( MutableModel , MutableParameters , Relevant . GetData ( ) ) ;
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
for ( int32 ParamIndex = 0 ; ParamIndex < NumParameters ; + + ParamIndex )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( Relevant [ ParamIndex ] )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
OperationData - > RelevantParametersInProgress . Add ( ParamIndex ) ;
2022-09-26 15:12:13 -04:00
}
}
}
}
2022-12-09 03:57:57 -05:00
void Subtask_Mutable_BeginUpdate_GetMesh ( const TSharedPtr < FMutableOperationData > & OperationData , TSharedPtr < mu : : Model , ESPMode : : ThreadSafe > Model , const mu : : Parameters * MutableParameters , int32 State )
2022-09-26 15:12:13 -04:00
{
MUTABLE_CPUPROFILER_SCOPE ( Subtask_Mutable_BeginUpdate ) ;
// This runs in the mutable thread.
check ( MutableParameters ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( OperationData ) ;
2022-09-26 15:12:13 -04:00
OperationData - > InstanceUpdateData . Clear ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( UCustomizableObjectSystem : : GetInstance ( ) ! = nullptr ) ;
check ( UCustomizableObjectSystem : : GetInstance ( ) - > GetPrivate ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
mu : : System * System = UCustomizableObjectSystem : : GetInstance ( ) - > GetPrivate ( ) - > MutableSystem . get ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( System ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
2023-01-10 15:48:59 -05:00
if ( OperationData - > bLiveUpdateMode )
{
if ( OperationData - > InstanceID = = 0 )
{
// It's the first update since the instance was put in LiveUpdate Mode, this ID will be reused from now on
OperationData - > InstanceID = System - > NewInstance ( Model ) ;
UE_LOG ( LogMutable , Verbose , TEXT ( " Creating Mutable instance with id [%d] for reuse " ) , OperationData - > InstanceID ) ;
}
else
{
// The instance was already in LiveUpdate Mode, the ID is reused
check ( OperationData - > InstanceID ) ;
UE_LOG ( LogMutable , Verbose , TEXT ( " Reusing Mutable instance with id [%d] " ) , OperationData - > InstanceID ) ;
}
}
else
{
// In non-LiveUpdate mode, we are forcing the recreation of mutable-side instances with every update.
check ( OperationData - > InstanceID = = 0 ) ;
OperationData - > InstanceID = System - > NewInstance ( Model ) ;
UE_LOG ( LogMutable , Verbose , TEXT ( " Creating Mutable instance with id [%d] " ) , OperationData - > InstanceID ) ;
}
check ( OperationData - > InstanceID ! = 0 ) ;
2022-09-26 15:12:13 -04:00
const mu : : Instance * Instance = nullptr ;
// Main instance generation step
{
// LOD mask, set to all ones to build all LODs
uint32 LODMask = 0xFFFFFFFF ;
Instance = System - > BeginUpdate ( OperationData - > InstanceID , MutableParameters , State , LODMask ) ;
if ( ! Instance )
{
const mu : : Error MutableError = mu : : GetError ( ) ;
if ( MutableError = = mu : : Error : : Unsupported )
{
UE_LOG ( LogMutable , Log , TEXT ( " The necessary functionality is not supported in this version of Mutable " ) ) ;
}
return ;
}
}
OperationData - > NumLODsAvailable = Instance - > GetLODCount ( ) ;
if ( OperationData - > CurrentMinLOD > = OperationData - > NumLODsAvailable )
{
OperationData - > CurrentMinLOD = OperationData - > NumLODsAvailable - 1 ;
OperationData - > CurrentMaxLOD = OperationData - > CurrentMinLOD ;
}
else if ( OperationData - > CurrentMaxLOD > = OperationData - > NumLODsAvailable )
{
OperationData - > CurrentMaxLOD = OperationData - > NumLODsAvailable - 1 ;
}
2023-01-24 08:45:18 -05:00
if ( ! OperationData - > RequestedLODs . IsEmpty ( ) )
{
// Initialize RequestedLODs to zero if not set
const int32 ComponentCount = Instance - > GetComponentCount ( OperationData - > CurrentMinLOD ) ;
OperationData - > RequestedLODs . SetNumZeroed ( ComponentCount ) ;
for ( int32 ComponentIndex = 0 ; ComponentIndex < ComponentCount ; + + ComponentIndex )
{
// Ensure we're generating at least one LOD
if ( OperationData - > RequestedLODs [ ComponentIndex ] = = 0 )
{
OperationData - > RequestedLODs [ ComponentIndex ] | = ( 1 < < OperationData - > CurrentMaxLOD ) ;
}
}
}
2022-09-26 15:12:13 -04:00
// Generate the mesh and gather all the required resource Ids
OperationData - > InstanceUpdateData . LODs . SetNum ( Instance - > GetLODCount ( ) ) ;
for ( int32 MutableLODIndex = 0 ; MutableLODIndex < Instance - > GetLODCount ( ) ; + + MutableLODIndex )
{
// Skip LODs outside the reange we want to generate
if ( MutableLODIndex < OperationData - > CurrentMinLOD | | MutableLODIndex > OperationData - > CurrentMaxLOD )
{
continue ;
}
FInstanceUpdateData : : FLOD & LOD = OperationData - > InstanceUpdateData . LODs [ MutableLODIndex ] ;
LOD . FirstComponent = OperationData - > InstanceUpdateData . Components . Num ( ) ;
LOD . ComponentCount = Instance - > GetComponentCount ( MutableLODIndex ) ;
2023-01-24 08:45:18 -05:00
const FInstanceGeneratedData : : FLOD & PrevUpdateLODData = OperationData - > LastUpdateData . LODs . IsValidIndex ( MutableLODIndex ) ?
OperationData - > LastUpdateData . LODs [ MutableLODIndex ] : FInstanceGeneratedData : : FLOD ( ) ;
2022-09-26 15:12:13 -04:00
for ( int32 ComponentIndex = 0 ; ComponentIndex < LOD . ComponentCount ; + + ComponentIndex )
{
OperationData - > InstanceUpdateData . Components . Push ( FInstanceUpdateData : : FComponent ( ) ) ;
FInstanceUpdateData : : FComponent & Component = OperationData - > InstanceUpdateData . Components . Last ( ) ;
Component . Id = Instance - > GetComponentId ( MutableLODIndex , ComponentIndex ) ;
Component . FirstSurface = OperationData - > InstanceUpdateData . Surfaces . Num ( ) ;
Component . SurfaceCount = 0 ;
2023-01-24 08:45:18 -05:00
const FInstanceGeneratedData : : FComponent & PrevUpdateComponent = OperationData - > LastUpdateData . Components . IsValidIndex ( PrevUpdateLODData . FirstComponent + ComponentIndex ) ?
OperationData - > LastUpdateData . Components [ PrevUpdateLODData . FirstComponent + ComponentIndex ] : FInstanceGeneratedData : : FComponent ( ) ;
const bool bGenerateLOD = OperationData - > RequestedLODs . IsValidIndex ( Component . Id ) ? ( OperationData - > RequestedLODs [ Component . Id ] & ( 1 < < MutableLODIndex ) ) ! = 0 : true ;
2022-09-26 15:12:13 -04:00
// Mesh
if ( Instance - > GetMeshCount ( MutableLODIndex , ComponentIndex ) > 0 )
{
MUTABLE_CPUPROFILER_SCOPE ( GetMesh ) ;
2023-01-24 08:45:18 -05:00
Component . MeshID = Instance - > GetMeshId ( MutableLODIndex , ComponentIndex , 0 ) ;
2022-09-26 15:12:13 -04:00
// Mesh cache is not enabled yet.
//auto CachedMesh = Cache.Meshes.Find(meshId);
//if (CachedMesh && CachedMesh->IsValid(false, true))
//{
// UE_LOG(LogMutable, Verbose, TEXT("Mesh resource with id [%d] can be cached."), meshId);
// INC_DWORD_STAT(STAT_MutableNumCachedSkeletalMeshes);
//}
2023-01-24 08:45:18 -05:00
// Check if we can use data from the currently generated SkeletalMesh
Component . bReuseMesh = OperationData - > bCanReuseGeneratedData & & PrevUpdateComponent . bGenerated ? PrevUpdateComponent . MeshID = = Component . MeshID : false ;
if ( bGenerateLOD & & ! Component . bReuseMesh )
{
Component . Mesh = System - > GetMesh ( OperationData - > InstanceID , Component . MeshID ) ;
}
2022-09-26 15:12:13 -04:00
}
2023-01-24 08:45:18 -05:00
if ( ! Component . Mesh & & ! Component . bReuseMesh )
2022-09-26 15:12:13 -04:00
{
continue ;
}
2023-01-24 08:45:18 -05:00
Component . bGenerated = true ;
const int32 SurfaceCount = Component . Mesh ? Component . Mesh - > GetSurfaceCount ( ) : PrevUpdateComponent . SurfaceCount ;
2022-09-26 15:12:13 -04:00
// Materials and images
2023-01-24 08:45:18 -05:00
for ( int32 MeshSurfaceIndex = 0 ; MeshSurfaceIndex < SurfaceCount ; + + MeshSurfaceIndex )
2022-09-26 15:12:13 -04:00
{
2023-01-24 08:45:18 -05:00
uint32 SurfaceId = Component . Mesh ? Component . Mesh - > GetSurfaceId ( MeshSurfaceIndex ) : OperationData - > LastUpdateData . SurfaceIds [ PrevUpdateComponent . FirstSurface + MeshSurfaceIndex ] ;
2022-10-04 07:53:49 -04:00
int32 InstanceSurfaceIndex = Instance - > FindSurfaceById ( MutableLODIndex , ComponentIndex , SurfaceId ) ;
2023-01-24 08:45:18 -05:00
check ( Component . bReuseMesh | | Component . Mesh - > GetVertexCount ( ) = = 0 | | InstanceSurfaceIndex > = 0 ) ;
2022-09-26 15:12:13 -04:00
if ( InstanceSurfaceIndex > = 0 )
{
OperationData - > InstanceUpdateData . Surfaces . Push ( { } ) ;
FInstanceUpdateData : : FSurface & Surface = OperationData - > InstanceUpdateData . Surfaces . Last ( ) ;
+ + Component . SurfaceCount ;
Surface . MaterialIndex = Instance - > GetSurfaceCustomId ( MutableLODIndex , ComponentIndex , InstanceSurfaceIndex ) ;
2022-10-04 07:53:49 -04:00
Surface . SurfaceId = SurfaceId ;
2022-09-26 15:12:13 -04:00
// Images
Surface . FirstImage = OperationData - > InstanceUpdateData . Images . Num ( ) ;
Surface . ImageCount = Instance - > GetImageCount ( MutableLODIndex , ComponentIndex , InstanceSurfaceIndex ) ;
for ( int32 ImageIndex = 0 ; ImageIndex < Surface . ImageCount ; + + ImageIndex )
{
MUTABLE_CPUPROFILER_SCOPE ( GetImageId ) ;
OperationData - > InstanceUpdateData . Images . Push ( { } ) ;
FInstanceUpdateData : : FImage & Image = OperationData - > InstanceUpdateData . Images . Last ( ) ;
Image . Name = Instance - > GetImageName ( MutableLODIndex , ComponentIndex , InstanceSurfaceIndex , ImageIndex ) ;
Image . ImageID = Instance - > GetImageId ( MutableLODIndex , ComponentIndex , InstanceSurfaceIndex , ImageIndex ) ;
Image . FullImageSizeX = 0 ;
Image . FullImageSizeY = 0 ;
2023-01-27 14:54:49 -05:00
Image . LOD = MutableLODIndex ;
2022-09-26 15:12:13 -04:00
}
// Vectors
Surface . FirstVector = OperationData - > InstanceUpdateData . Vectors . Num ( ) ;
Surface . VectorCount = Instance - > GetVectorCount ( MutableLODIndex , ComponentIndex , InstanceSurfaceIndex ) ;
for ( int32 VectorIndex = 0 ; VectorIndex < Surface . VectorCount ; + + VectorIndex )
{
MUTABLE_CPUPROFILER_SCOPE ( GetVector ) ;
OperationData - > InstanceUpdateData . Vectors . Push ( { } ) ;
FInstanceUpdateData : : FVector & Vector = OperationData - > InstanceUpdateData . Vectors . Last ( ) ;
Vector . Name = Instance - > GetVectorName ( MutableLODIndex , ComponentIndex , InstanceSurfaceIndex , VectorIndex ) ;
Instance - > GetVector ( MutableLODIndex , ComponentIndex , InstanceSurfaceIndex , VectorIndex , & Vector . Vector . R , & Vector . Vector . G , & Vector . Vector . B , & Vector . Vector . A ) ;
}
// Scalars
Surface . FirstScalar = OperationData - > InstanceUpdateData . Scalars . Num ( ) ;
Surface . ScalarCount = Instance - > GetScalarCount ( MutableLODIndex , ComponentIndex , InstanceSurfaceIndex ) ;
for ( int32 ScalarIndex = 0 ; ScalarIndex < Surface . ScalarCount ; + + ScalarIndex )
{
MUTABLE_CPUPROFILER_SCOPE ( GetScalar ) ;
OperationData - > InstanceUpdateData . Scalars . Push ( { } ) ;
FInstanceUpdateData : : FScalar & Scalar = OperationData - > InstanceUpdateData . Scalars . Last ( ) ;
Scalar . Name = Instance - > GetScalarName ( MutableLODIndex , ComponentIndex , InstanceSurfaceIndex , ScalarIndex ) ;
Scalar . Scalar = Instance - > GetScalar ( MutableLODIndex , ComponentIndex , InstanceSurfaceIndex , ScalarIndex ) ;
}
}
}
}
}
}
2022-12-09 03:57:57 -05:00
void Subtask_Mutable_GetImages ( const TSharedPtr < FMutableOperationData > & OperationData , TSharedPtr < mu : : Model , ESPMode : : ThreadSafe > Model , const mu : : Parameters * MutableParameters , int32 State )
2022-09-26 15:12:13 -04:00
{
MUTABLE_CPUPROFILER_SCOPE ( Subtask_Mutable_GetImages ) ;
// This runs in the mutable thread.
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( OperationData ) ;
2022-09-26 15:12:13 -04:00
check ( MutableParameters ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( UCustomizableObjectSystem : : GetInstance ( ) ! = nullptr ) ;
FCustomizableObjectSystemPrivate * CustomizableObjectSystemPrivateData = UCustomizableObjectSystem : : GetInstance ( ) - > GetPrivate ( ) ;
check ( CustomizableObjectSystemPrivateData ! = nullptr ) ;
mu : : System * System = CustomizableObjectSystemPrivateData - > MutableSystem . get ( ) ;
check ( System ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
// Generate all the required resources, that are not cached
TArray < mu : : RESOURCE_ID > ImagesInThisInstance ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
for ( FInstanceUpdateData : : FImage & Image : OperationData - > InstanceUpdateData . Images )
2022-09-26 15:12:13 -04:00
{
MUTABLE_CPUPROFILER_SCOPE ( GetImage ) ;
2023-02-02 02:41:54 -05:00
mu : : FImageDesc ImageDesc ;
2022-09-26 15:12:13 -04:00
// This should only be done when using progressive images, since GetImageDesc does some actual processing.
{
System - > GetImageDesc ( OperationData - > InstanceID , Image . ImageID , ImageDesc ) ;
Image . FullImageSizeX = ImageDesc . m_size [ 0 ] ;
Image . FullImageSizeY = ImageDesc . m_size [ 1 ] ;
}
bool bCached = false ;
// See if it is cached from this same instance (can happen with LODs)
bCached = ImagesInThisInstance . Contains ( Image . ImageID ) ;
// See if it is cached from another instance
if ( ! bCached )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
bCached = CustomizableObjectSystemPrivateData - > ProtectedObjectCachedImages . Contains ( Image . ImageID ) ;
2022-09-26 15:12:13 -04:00
}
if ( bCached )
{
UE_LOG ( LogMutable , Verbose , TEXT ( " Texture resource with id [%d] is cached. " ) , Image . ImageID ) ;
INC_DWORD_STAT ( STAT_MutableNumCachedTextures ) ;
}
else
{
int32 MaxSize = FMath : : Max ( Image . FullImageSizeX , Image . FullImageSizeY ) ;
int32 FullLODCount = FMath : : CeilLogTwo ( MaxSize ) + 1 ;
int32 MinMipsInImage = FMath : : Min ( FullLODCount , UTexture : : GetStaticMinTextureResidentMipCount ( ) ) ;
int32 MaxMipsToSkip = FullLODCount - MinMipsInImage ;
int32 MipsToSkip = FMath : : Min ( MaxMipsToSkip , OperationData - > MipsToSkip ) ;
2023-02-02 02:41:54 -05:00
if ( MipsToSkip > 0 & & CustomizableObjectSystemPrivateData - > EnableSkipGenerateResidentMips ! = 0 & & OperationData - > LowPriorityTextures . Find ( Image . Name ) ! = INDEX_NONE )
{
const int32 MipSizeX = FMath : : Max ( Image . FullImageSizeX > > MipsToSkip , 1 ) ;
const int32 MipSizeY = FMath : : Max ( Image . FullImageSizeY > > MipsToSkip , 1 ) ;
Image . Image = new mu : : Image ( MipSizeX , MipSizeY , FullLODCount - MipsToSkip , ImageDesc . m_format ) ;
}
else
{
Image . Image = System - > GetImage ( OperationData - > InstanceID , Image . ImageID , MipsToSkip , Image . LOD ) ;
}
2022-09-26 15:12:13 -04:00
// We need one mip or the complete chain. Otherwise there was a bug.
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Image . Image ) ;
2022-09-26 15:12:13 -04:00
int32 FullMipCount = Image . Image - > GetMipmapCount ( Image . Image - > GetSizeX ( ) , Image . Image - > GetSizeY ( ) ) ;
int32 RealMipCount = Image . Image - > GetLODCount ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( ( RealMipCount ! = 1 ) & & ( RealMipCount ! = FullMipCount ) )
2022-09-26 15:12:13 -04:00
{
MUTABLE_CPUPROFILER_SCOPE ( GetImage_MipFix ) ;
UE_LOG ( LogMutable , Warning , TEXT ( " Mutable generated an incomplete mip chain for image %d. " ) , Image . ImageID ) ;
// Force the right number of mips. The missing data will be black.
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
mu : : ImagePtr NewImage = new mu : : Image ( Image . Image - > GetSizeX ( ) , Image . Image - > GetSizeY ( ) , FullMipCount , Image . Image - > GetFormat ( ) ) ;
check ( NewImage ) ;
2022-09-26 15:12:13 -04:00
if ( NewImage - > GetDataSize ( ) > = Image . Image - > GetDataSize ( ) )
{
FMemory : : Memcpy ( NewImage - > GetData ( ) , Image . Image - > GetData ( ) , Image . Image - > GetDataSize ( ) ) ;
}
Image . Image = NewImage ;
}
ImagesInThisInstance . Add ( Image . ImageID ) ;
}
}
}
void Subtask_Mutable_PrepareTextures ( const TSharedPtr < FMutableOperationData > & OperationData )
{
// This runs in a worker thread
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( OperationData ) ;
2022-09-26 15:12:13 -04:00
for ( const FInstanceUpdateData : : FSurface & Surface : OperationData - > InstanceUpdateData . Surfaces )
{
for ( int32 ImageIndex = 0 ; ImageIndex < Surface . ImageCount ; + + ImageIndex )
{
const FInstanceUpdateData : : FImage & Image = OperationData - > InstanceUpdateData . Images [ Surface . FirstImage + ImageIndex ] ;
FString KeyName = Image . Name ;
mu : : ImagePtrConst MutableImage = Image . Image ;
// If the image is null, it must be in the cache (or repeated in this instance), and we don't need to do anything here.
if ( MutableImage )
{
2023-01-11 14:28:53 -05:00
FTexturePlatformData * PlatformData = UCustomizableInstancePrivateData : : MutableCreateImagePlatformData ( MutableImage , - 1 , Image . FullImageSizeX , Image . FullImageSizeY ) ;
2022-09-26 15:12:13 -04:00
OperationData - > ImageToPlatformDataMap . Add ( Image . ImageID , PlatformData ) ;
OperationData - > PendingTextureCoverageQueries . Add ( { KeyName , Surface . MaterialIndex , PlatformData } ) ;
}
}
}
}
void Subtask_Mutable_PrepareSkeletonData ( const TSharedPtr < FMutableOperationData > & OperationData )
{
// This runs in a worker thread
MUTABLE_CPUPROFILER_SCOPE ( PrepareSkeletonData ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( OperationData ) ;
2022-09-26 15:12:13 -04:00
const int32 LODCount = OperationData - > InstanceUpdateData . LODs . Num ( ) ;
const FInstanceUpdateData : : FLOD & MinLOD = OperationData - > InstanceUpdateData . LODs [ OperationData - > CurrentMinLOD ] ;
const int32 ComponentCount = MinLOD . ComponentCount ;
// Add SkeletonData for each component
OperationData - > InstanceUpdateData . Skeletons . AddDefaulted ( ComponentCount ) ;
for ( int32 ComponentIndex = 0 ; ComponentIndex < ComponentCount ; + + ComponentIndex )
{
2023-01-04 15:46:42 -05:00
FInstanceUpdateData : : FComponent & MinLODComponent = OperationData - > InstanceUpdateData . Components [ MinLOD . FirstComponent + ComponentIndex ] ;
2022-09-26 15:12:13 -04:00
// Set the ComponentIndex
OperationData - > InstanceUpdateData . Skeletons [ ComponentIndex ] . ComponentIndex = MinLODComponent . Id ;
// Fill the data used to generate the RefSkeletalMesh
TArray < uint32 > & SkeletonIds = OperationData - > InstanceUpdateData . Skeletons [ ComponentIndex ] . SkeletonIds ;
TArray < FName > & BoneNames = OperationData - > InstanceUpdateData . Skeletons [ ComponentIndex ] . BoneNames ;
TMap < FName , FMatrix44f > & BoneMatricesWithScale = OperationData - > InstanceUpdateData . Skeletons [ ComponentIndex ] . BoneMatricesWithScale ;
2023-01-04 15:46:42 -05:00
2022-09-26 15:12:13 -04:00
// Use first valid LOD bone count as a potential total number of bones, used for pre-allocating data arrays
if ( MinLODComponent . Mesh & & MinLODComponent . Mesh - > GetSkeleton ( ) )
{
const int32 TotalPossibleBones = MinLODComponent . Mesh - > GetSkeleton ( ) - > GetBoneCount ( ) ;
// Out Data
BoneNames . Reserve ( TotalPossibleBones ) ;
BoneMatricesWithScale . Reserve ( TotalPossibleBones ) ;
}
for ( int32 LODIndex = OperationData - > CurrentMinLOD ; LODIndex < = OperationData - > CurrentMaxLOD & & LODIndex < LODCount ; + + LODIndex )
{
MUTABLE_CPUPROFILER_SCOPE ( PrepareSkeletonData_LODs ) ;
const FInstanceUpdateData : : FLOD & CurrentLOD = OperationData - > InstanceUpdateData . LODs [ LODIndex ] ;
FInstanceUpdateData : : FComponent & CurrentLODComponent = OperationData - > InstanceUpdateData . Components [ CurrentLOD . FirstComponent + ComponentIndex ] ;
mu : : MeshPtrConst Mesh = CurrentLODComponent . Mesh ;
if ( ! Mesh | | ! Mesh - > GetSkeleton ( ) )
{
continue ;
}
2022-11-07 04:57:31 -05:00
// Add SkeletonIds
const int32 SkeletonIDsCount = Mesh - > GetSkeletonIDsCount ( ) ;
for ( int32 SkeletonIndex = 0 ; SkeletonIndex < SkeletonIDsCount ; + + SkeletonIndex )
{
SkeletonIds . AddUnique ( Mesh - > GetSkeletonID ( SkeletonIndex ) ) ;
}
2022-09-26 15:12:13 -04:00
2023-01-04 15:46:42 -05:00
const int32 MaxBoneIndex = Mesh - > GetBonePoseCount ( ) ;
// Add active bones and new names to the BoneNames array
CurrentLODComponent . BoneMap . Reserve ( MaxBoneIndex ) ;
CurrentLODComponent . ActiveBones . Reserve ( MaxBoneIndex ) ;
for ( int32 BonePoseIndex = 0 ; BonePoseIndex < MaxBoneIndex ; + + BonePoseIndex )
2022-09-26 15:12:13 -04:00
{
2023-01-04 15:46:42 -05:00
const FName BoneName = Mesh - > GetBonePoseName ( BonePoseIndex ) ;
check ( BoneName ! = NAME_None ) ;
2022-09-26 15:12:13 -04:00
2023-01-04 15:46:42 -05:00
int32 BoneIndex = BoneNames . Find ( BoneName ) ;
if ( BoneIndex = = INDEX_NONE )
2022-09-26 15:12:13 -04:00
{
2023-01-04 15:46:42 -05:00
BoneIndex = BoneNames . Add ( BoneName ) ;
FTransform3f Transform ;
Mesh - > GetBoneTransform ( BonePoseIndex , Transform ) ;
BoneMatricesWithScale . Emplace ( BoneName , Transform . Inverse ( ) . ToMatrixWithScale ( ) ) ;
2022-09-26 15:12:13 -04:00
}
2023-01-04 15:46:42 -05:00
if ( EnumHasAnyFlags ( Mesh - > GetBoneUsageFlags ( BonePoseIndex ) , mu : : EBoneUsageFlags : : Skinning ) )
2022-09-26 15:12:13 -04:00
{
2023-01-04 15:46:42 -05:00
CurrentLODComponent . BoneMap . Add ( BoneIndex ) ;
2022-09-26 15:12:13 -04:00
}
2023-01-04 15:46:42 -05:00
CurrentLODComponent . ActiveBones . Add ( BoneIndex ) ;
2022-09-26 15:12:13 -04:00
}
}
}
}
2022-12-09 03:57:57 -05:00
void Task_Mutable_Update_GetMesh ( TSharedPtr < FMutableOperationData > OperationData , TSharedPtr < mu : : Model , ESPMode : : ThreadSafe > Model , mu : : ParametersPtrConst Parameters , bool bBuildParameterDecorations , int32 State )
2022-09-26 15:12:13 -04:00
{
// This runs in a worker thread.
MUTABLE_CPUPROFILER_SCOPE ( Task_Mutable_GetMesh )
# if WITH_EDITOR
uint32 StartCycles = FPlatformTime : : Cycles ( ) ;
# endif
check ( OperationData . IsValid ( ) ) ;
if ( bBuildParameterDecorations )
{
// This cannot happen inside the beginupdate-endupdate cycle.
Subtask_Mutable_UpdateParameterDecorations ( OperationData , Model , Parameters . get ( ) ) ;
}
else
{
OperationData - > ParametersUpdateData . Clear ( ) ;
OperationData - > RelevantParametersInProgress . Reset ( ) ;
}
Subtask_Mutable_BeginUpdate_GetMesh ( OperationData , Model , Parameters . get ( ) , State ) ;
// TODO: Not strictly mutable: move to another worker thread task to free mutable access?
Subtask_Mutable_PrepareSkeletonData ( OperationData ) ;
# if WITH_EDITOR
uint32 EndCycles = FPlatformTime : : Cycles ( ) ;
OperationData - > MutableRuntimeCycles = EndCycles - StartCycles ;
# endif
}
2022-12-09 03:57:57 -05:00
void Task_Mutable_Update_GetImages ( TSharedPtr < FMutableOperationData > OperationData , TSharedPtr < mu : : Model , ESPMode : : ThreadSafe > Model , mu : : ParametersPtrConst Parameters , int32 State )
2022-09-26 15:12:13 -04:00
{
// This runs in a worker thread.
MUTABLE_CPUPROFILER_SCOPE ( Task_Mutable_GetImages )
# if WITH_EDITOR
uint32 StartCycles = FPlatformTime : : Cycles ( ) ;
# endif
check ( OperationData . IsValid ( ) ) ;
Subtask_Mutable_GetImages ( OperationData , Model , Parameters . get ( ) , State ) ;
// TODO: Not strictly mutable: move to another worker thread task to free mutable access?
Subtask_Mutable_PrepareTextures ( OperationData ) ;
# if WITH_EDITOR
uint32 EndCycles = FPlatformTime : : Cycles ( ) ;
OperationData - > MutableRuntimeCycles + = EndCycles - StartCycles ;
# endif
}
void Task_Mutable_ReleaseInstance ( TSharedPtr < FMutableOperationData > OperationData , mu : : SystemPtr MutableSystem )
{
MUTABLE_CPUPROFILER_SCOPE ( Task_Mutable_ReleaseInstance )
// This runs in a worker thread.
check ( OperationData . IsValid ( ) ) ;
if ( OperationData - > InstanceID > 0 )
{
MUTABLE_CPUPROFILER_SCOPE ( EndUpdate ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( MutableSystem ) ;
2022-09-26 15:12:13 -04:00
MutableSystem - > EndUpdate ( OperationData - > InstanceID ) ;
OperationData - > InstanceUpdateData . Clear ( ) ;
2023-01-10 15:48:59 -05:00
if ( ! OperationData - > bLiveUpdateMode )
{
MutableSystem - > ReleaseInstance ( OperationData - > InstanceID ) ;
OperationData - > InstanceID = 0 ;
}
}
}
void Task_Mutable_ReleaseInstanceID ( TSharedPtr < FMutableOperationData > OperationData , mu : : SystemPtr MutableSystem )
{
MUTABLE_CPUPROFILER_SCOPE ( Task_Mutable_ReleaseInstanceID )
// This runs in a worker thread.
check ( OperationData . IsValid ( ) ) ;
if ( OperationData - > InstanceID > 0 )
{
2022-09-26 15:12:13 -04:00
MutableSystem - > ReleaseInstance ( OperationData - > InstanceID ) ;
OperationData - > InstanceID = 0 ;
}
}
void Task_Game_ReleasePlatformData ( TSharedPtr < FMutableReleasePlatformOperationData > OperationData )
{
MUTABLE_CPUPROFILER_SCOPE ( Task_Game_ReleasePlatformData )
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( OperationData . IsValid ( ) ) ;
2022-09-26 15:12:13 -04:00
TMap < uint32 , FTexturePlatformData * > & ImageToPlatformDataMap = OperationData - > ImageToPlatformDataMap ;
for ( TPair < uint32 , FTexturePlatformData * > Pair : ImageToPlatformDataMap )
{
delete Pair . Value ; // If this is not null then it must mean it hasn't been used, otherwise they would have taken ownership and nulled it
}
ImageToPlatformDataMap . Reset ( ) ;
}
2022-10-10 07:09:51 -04:00
2022-09-26 15:12:13 -04:00
void Task_Game_Callbacks ( TSharedPtr < FMutableOperationData > OperationData , const TWeakObjectPtr < UCustomizableObjectInstance > & CustomizableObjectInstancePtr )
{
MUTABLE_CPUPROFILER_SCOPE ( Task_Game_Callbacks )
check ( IsInGameThread ( ) ) ;
UCustomizableObjectSystem * System = UCustomizableObjectSystem : : GetInstance ( ) ;
if ( ! System | | ! System - > IsValidLowLevel ( ) | | System - > HasAnyFlags ( RF_BeginDestroyed ) )
{
return ;
}
UCustomizableObjectInstance * CustomizableObjectInstance = CustomizableObjectInstancePtr . Get ( ) ;
// TODO: Review checks.
if ( ! CustomizableObjectInstance | | ! CustomizableObjectInstance - > IsValidLowLevel ( ) )
{
System - > ClearCurrentMutableOperation ( ) ;
return ;
}
2023-01-24 08:45:18 -05:00
FCustomizableObjectSystemPrivate * CustomizableObjectSystemPrivateData = System - > GetPrivate ( ) ;
check ( CustomizableObjectSystemPrivateData ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
// Actual work
2023-01-24 08:45:18 -05:00
// TODO MTBL-391: Review This hotfix
UpdateSkeletalMesh ( CustomizableObjectInstance , CustomizableObjectSystemPrivateData - > CurrentMutableOperation - > InstanceDescriptorRuntimeHash ) ;
2022-09-26 15:12:13 -04:00
// TODO: T2927
if ( LogBenchmarkUtil : : isLoggingActive ( ) )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
double deltaSeconds = FPlatformTime : : Seconds ( ) - CustomizableObjectSystemPrivateData - > CurrentMutableOperation - > StartUpdateTime ;
2022-09-26 15:12:13 -04:00
int32 deltaMs = int32 ( deltaSeconds * 1000 ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
int64 streamingCache = CustomizableObjectSystemPrivateData - > LastStreamingMemorySize / 1024 ;
2022-09-26 15:12:13 -04:00
LogBenchmarkUtil : : updateStat ( " customizable_instance_build_time " , deltaMs ) ;
LogBenchmarkUtil : : updateStat ( " mutable_streaming_cache_memory " , ( long double ) streamingCache / 1024.0 ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
CustomizableObjectSystemPrivateData - > TotalBuildMs + = deltaMs ;
CustomizableObjectSystemPrivateData - > TotalBuiltInstances + + ;
2022-09-26 15:12:13 -04:00
SET_DWORD_STAT ( STAT_MutableInstanceBuildTime , deltaMs ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
SET_DWORD_STAT ( STAT_MutableInstanceBuildTimeAvrg , CustomizableObjectSystemPrivateData - > TotalBuildMs / CustomizableObjectSystemPrivateData - > TotalBuiltInstances ) ;
2022-09-26 15:12:13 -04:00
SET_DWORD_STAT ( STAT_MutableStreamingCache , streamingCache ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
mu : : System * MutableSystem = CustomizableObjectSystemPrivateData - > MutableSystem . get ( ) ;
2022-09-26 15:12:13 -04:00
if ( MutableSystem )
{
SET_DWORD_STAT ( STAT_MutableProfile_LiveInstanceCount , MutableSystem - > GetProfileMetric ( mu : : System : : ProfileMetric : : LiveInstanceCount ) ) ;
SET_DWORD_STAT ( STAT_MutableProfile_StreamingCacheBytes , MutableSystem - > GetProfileMetric ( mu : : System : : ProfileMetric : : StreamingCacheBytes ) ) ;
SET_DWORD_STAT ( STAT_MutableProfile_InstanceUpdateCount , MutableSystem - > GetProfileMetric ( mu : : System : : ProfileMetric : : InstanceUpdateCount ) ) ;
}
else
{
SET_DWORD_STAT ( STAT_MutableProfile_LiveInstanceCount , 0 ) ;
SET_DWORD_STAT ( STAT_MutableProfile_StreamingCacheBytes , 0 ) ;
SET_DWORD_STAT ( STAT_MutableProfile_InstanceUpdateCount , 0 ) ;
}
}
// End Update
System - > ClearCurrentMutableOperation ( ) ;
}
void Task_Game_ConvertResources ( TSharedPtr < FMutableOperationData > OperationData , const TWeakObjectPtr < UCustomizableObjectInstance > & CustomizableObjectInstancePtr )
{
MUTABLE_CPUPROFILER_SCOPE ( Task_Game_ConvertResources )
check ( IsInGameThread ( ) ) ;
UCustomizableObjectSystem * System = UCustomizableObjectSystem : : GetInstance ( ) ;
if ( ! System | | ! System - > IsValidLowLevel ( ) | | System - > HasAnyFlags ( RF_BeginDestroyed ) )
{
return ;
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( OperationData . IsValid ( ) ) ;
2022-09-26 15:12:13 -04:00
UCustomizableObjectInstance * CustomizableObjectInstance = CustomizableObjectInstancePtr . Get ( ) ;
// TODO: Review checks.
bool bCancel = false ;
if ( ! CustomizableObjectInstance | | ! CustomizableObjectInstance - > IsValidLowLevel ( ) )
{
bCancel = true ;
}
// Actual work
if ( ! bCancel )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
UCustomizableInstancePrivateData * CustomizableInstancePrivateData = CustomizableObjectInstance - > GetPrivate ( ) ;
check ( CustomizableInstancePrivateData ! = nullptr ) ;
// Process the pending texture coverage queries
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
MUTABLE_CPUPROFILER_SCOPE ( GameTextureQueries ) ;
for ( const FPendingTextureCoverageQuery & Query : OperationData - > PendingTextureCoverageQueries )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
UMaterialInterface * Material = nullptr ;
const uint32 * InstanceIndex = CustomizableInstancePrivateData - > ObjectToInstanceIndexMap . Find ( Query . MaterialIndex ) ;
if ( InstanceIndex & & CustomizableInstancePrivateData - > ReferencedMaterials . IsValidIndex ( * InstanceIndex ) )
{
Material = CustomizableInstancePrivateData - > ReferencedMaterials [ * InstanceIndex ] ;
}
UCustomizableInstancePrivateData : : ProcessTextureCoverageQueries ( OperationData , CustomizableObjectInstance - > GetCustomizableObject ( ) , Query . KeyName , Query . PlatformData , Material ) ;
2022-09-26 15:12:13 -04:00
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
OperationData - > PendingTextureCoverageQueries . Empty ( ) ;
2022-09-26 15:12:13 -04:00
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
// Process texture coverage queries because it's safe to do now that the Mutable thread is stopped
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( OperationData - > TextureCoverageQueries_MutableThreadResults . Num ( ) > 0 )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
for ( auto & Result : OperationData - > TextureCoverageQueries_MutableThreadResults )
{
FTextureCoverageQueryData * FinalResultData = CustomizableInstancePrivateData - > TextureCoverageQueries . Find ( Result . Key ) ;
* FinalResultData = Result . Value ;
}
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
OperationData - > TextureCoverageQueries_MutableThreadResults . Empty ( ) ;
}
2022-09-26 15:12:13 -04:00
# if WITH_EDITOR
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
CustomizableObjectInstance - > LastUpdateMutableRuntimeCycles = OperationData - > MutableRuntimeCycles ;
2022-09-26 15:12:13 -04:00
# endif
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
// Convert Step
//-------------------------------------------------------------
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
// \TODO: Bring that code here instead of keeping it in the UCustomizableObjectInstance
if ( CustomizableInstancePrivateData - > UpdateSkeletalMesh_PostBeginUpdate0 ( CustomizableObjectInstance , OperationData ) )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
// This used to be CustomizableObjectInstance::UpdateSkeletalMesh_PostBeginUpdate1
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
MUTABLE_CPUPROFILER_SCOPE ( UpdateSkeletalMesh_PostBeginUpdate1 ) ;
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
// \TODO: Bring here
CustomizableInstancePrivateData - > BuildMaterials ( OperationData , CustomizableObjectInstance ) ;
}
// This used to be CustomizableObjectInstance::UpdateSkeletalMesh_PostBeginUpdate2
{
MUTABLE_CPUPROFILER_SCOPE ( UpdateSkeletalMesh_PostBeginUpdate2 ) ;
for ( int32 Component = 0 ; Component < CustomizableObjectInstance - > SkeletalMeshes . Num ( ) ; + + Component )
{
if ( CustomizableObjectInstance - > SkeletalMeshes [ Component ] & & CustomizableObjectInstance - > SkeletalMeshes [ Component ] - > GetLODInfoArray ( ) . Num ( ) )
{
MUTABLE_CPUPROFILER_SCOPE ( UpdateSkeletalMesh_PostEditChangeProperty ) ;
CustomizableInstancePrivateData - > PostEditChangePropertyWithoutEditor ( CustomizableObjectInstance - > SkeletalMeshes [ Component ] ) ;
}
2022-09-26 15:12:13 -04:00
}
}
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
} // END - Process texture coverage queries
} // if (!bCancel)
FCustomizableObjectSystemPrivate * CustomizableObjectSystemPrivateData = System - > GetPrivate ( ) ;
check ( CustomizableObjectSystemPrivateData ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
// Next Task: Release Mutable. We need this regardless if we cancel or not
//-------------------------------------------------------------
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
mu : : SystemPtr MutableSystem = CustomizableObjectSystemPrivateData - > MutableSystem ;
CustomizableObjectSystemPrivateData - > AddMutableThreadTask (
2022-09-26 15:12:13 -04:00
TEXT ( " Task_Mutable_ReleaseInstance " ) ,
[ OperationData , MutableSystem ] ( ) { Task_Mutable_ReleaseInstance ( OperationData , MutableSystem ) ; } ,
UE : : Tasks : : ETaskPriority : : BackgroundNormal ) ;
}
// Next Task: Release Platform Data
//-------------------------------------------------------------
if ( ! bCancel )
{
TSharedPtr < FMutableReleasePlatformOperationData > ReleaseOperationData = MakeShared < FMutableReleasePlatformOperationData > ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( ReleaseOperationData ) ;
2022-09-26 15:12:13 -04:00
ReleaseOperationData - > ImageToPlatformDataMap = MoveTemp ( OperationData - > ImageToPlatformDataMap ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
CustomizableObjectSystemPrivateData - > AddAnyThreadTask (
2022-09-26 15:12:13 -04:00
TEXT ( " Mutable_ReleasePlatformData " ) ,
[ ReleaseOperationData ] ( ) { Task_Game_ReleasePlatformData ( ReleaseOperationData ) ; } ,
UE : : Tasks : : ETaskPriority : : BackgroundNormal
) ;
// Unlock step
//-------------------------------------------------------------
if ( CustomizableObjectInstance - > GetCustomizableObject ( ) )
{
// Unlock the resource cache for the object used by this instance to avoid
// the destruction of resources that we may want to reuse.
System - > ClearResourceCacheProtected ( ) ;
}
// Next Task: Callbacks
//-------------------------------------------------------------
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
CustomizableObjectSystemPrivateData - > AddGameThreadTask (
2022-09-26 15:12:13 -04:00
{
FMutableTaskDelegate : : CreateLambda (
[ OperationData , CustomizableObjectInstancePtr ] ( )
{
Task_Game_Callbacks ( OperationData , CustomizableObjectInstancePtr ) ;
} ) ,
{ }
} ) ;
}
}
/** "Lock Cached Resources" */
void Task_Game_LockCache ( TSharedPtr < FMutableOperationData > OperationData , const TWeakObjectPtr < UCustomizableObjectInstance > & CustomizableObjectInstancePtr , mu : : Ptr < const mu : : Parameters > Parameters , bool bBuildParameterDecorations )
{
check ( IsInGameThread ( ) ) ;
UCustomizableObjectSystem * System = UCustomizableObjectSystem : : GetInstance ( ) ;
if ( ! System )
{
return ;
}
UCustomizableObjectInstance * ObjectInstance = CustomizableObjectInstancePtr . Get ( ) ;
if ( ! ObjectInstance )
{
System - > ClearCurrentMutableOperation ( ) ;
return ;
}
2023-01-10 15:48:59 -05:00
UCustomizableInstancePrivateData * ObjectInstancePrivateData = ObjectInstance - > GetPrivate ( ) ;
check ( ObjectInstancePrivateData ! = nullptr ) ;
if ( OperationData - > bLiveUpdateMode )
{
check ( OperationData - > InstanceID ! = 0 ) ;
if ( ObjectInstancePrivateData - > LiveUpdateModeInstanceID = = 0 )
{
// From now this instance will reuse this InstanceID until it gets out of LiveUpdateMode
ObjectInstancePrivateData - > LiveUpdateModeInstanceID = OperationData - > InstanceID ;
}
}
2022-09-26 15:12:13 -04:00
const UCustomizableObject * CustomizableObject = ObjectInstance - > GetCustomizableObject ( ) ;
if ( ! CustomizableObject )
{
System - > ClearCurrentMutableOperation ( ) ;
return ;
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( OperationData . IsValid ( ) ) ;
2022-09-26 15:12:13 -04:00
// Process the parameter decorations if requested
if ( bBuildParameterDecorations )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
ObjectInstancePrivateData - > UpdateParameterDecorationsEngineResources ( OperationData ) ;
2022-09-26 15:12:13 -04:00
}
2023-01-25 13:01:06 -05:00
if ( const TObjectPtr < UDefaultImageProvider > DefaultImageProvider = System - > GetDefaultImageProvider ( ) )
{
2023-01-26 05:27:35 -05:00
DefaultImageProvider - > CacheTextures ( * OperationData - > MutableParameters ) ;
2023-01-25 13:01:06 -05:00
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
// Selectively lock the resource cache for the object used by this instance to avoid the destruction of resources that we may want to reuse.
2022-09-26 15:12:13 -04:00
// When protecting textures there mustn't be any left from a previous update
check ( System - > ProtectedCachedTextures . Num ( ) = = 0 ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
FCustomizableObjectSystemPrivate * SystemPrivateData = System - > GetPrivate ( ) ;
check ( SystemPrivateData ! = nullptr ) ;
FMutableResourceCache & Cache = SystemPrivateData - > GetObjectCache ( CustomizableObject ) ;
2022-09-26 15:12:13 -04:00
System - > ProtectedCachedTextures . Reset ( Cache . Images . Num ( ) ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
SystemPrivateData - > ProtectedObjectCachedImages . Reset ( Cache . Images . Num ( ) ) ;
2022-09-26 15:12:13 -04:00
for ( const FInstanceUpdateData : : FImage & Image : OperationData - > InstanceUpdateData . Images )
{
2022-10-21 19:53:30 -04:00
FMutableImageCacheKey Key ( Image . ImageID , OperationData - > MipsToSkip ) ;
TWeakObjectPtr < UTexture2D > * TexturePtr = Cache . Images . Find ( Key ) ;
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( TexturePtr & & TexturePtr - > Get ( ) & & SystemPrivateData - > TextureHasReferences ( Image . ImageID ) )
2022-09-26 15:12:13 -04:00
{
System - > ProtectedCachedTextures . Add ( TexturePtr - > Get ( ) ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
SystemPrivateData - > ProtectedObjectCachedImages . Add ( Image . ImageID ) ;
2022-09-26 15:12:13 -04:00
}
}
2022-10-04 09:10:32 -04:00
// Any external texture that may be needed for this update will be requested from Mutable Core's GetImage
// which will safely access the GlobalExternalImages map, and then just get the cached image or issue a disk read
2022-09-26 15:12:13 -04:00
// Copy data generated in the mutable thread over to the instance
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
ObjectInstancePrivateData - > PrepareForUpdate ( OperationData ) ;
2022-09-26 15:12:13 -04:00
// Task: Mutable GetImages
//-------------------------------------------------------------
FGraphEventRef Mutable_GetImagesTask ;
{
// Task inputs
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( CustomizableObject - > GetPrivate ( ) ! = nullptr ) ;
2022-12-09 03:57:57 -05:00
TSharedPtr < mu : : Model , ESPMode : : ThreadSafe > Model = CustomizableObject - > GetPrivate ( ) - > GetModel ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
int32 State = ObjectInstance - > GetState ( ) ;
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
Mutable_GetImagesTask = SystemPrivateData - > AddMutableThreadTask (
2022-09-26 15:12:13 -04:00
TEXT ( " Task_Mutable_GetImages " ) ,
[ OperationData , Parameters , Model , State ] ( )
{
impl : : Task_Mutable_Update_GetImages ( OperationData , Model , Parameters , State ) ;
} ,
UE : : Tasks : : ETaskPriority : : BackgroundHigh ) ;
}
// Next Task: Load Unreal Assets
//-------------------------------------------------------------
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
FGraphEventRef Game_LoadUnrealAssets = ObjectInstancePrivateData - > LoadAdditionalAssetsAsync ( OperationData , ObjectInstance , UCustomizableObjectSystem : : GetInstance ( ) - > GetStreamableManager ( ) ) ;
if ( Game_LoadUnrealAssets )
{
Game_LoadUnrealAssets - > SetDebugName ( TEXT ( " LoadAdditionalAssetsAsync " ) ) ;
}
2022-09-26 15:12:13 -04:00
// Next-next Task: Convert Resources
//-------------------------------------------------------------
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
SystemPrivateData - > AddGameThreadTask (
2022-09-26 15:12:13 -04:00
{
FMutableTaskDelegate : : CreateLambda (
[ OperationData , CustomizableObjectInstancePtr ] ( )
{
Task_Game_ConvertResources ( OperationData , CustomizableObjectInstancePtr ) ;
} ) ,
# ifdef MUTABLE_USE_NEW_TASKGRAPH
{ } ,
# endif
Game_LoadUnrealAssets ,
Mutable_GetImagesTask
} ) ;
}
2023-01-10 15:48:59 -05:00
/** Enqueue the release ID operation in the Mutable queue */
void Task_Game_ReleaseInstanceID ( const mu : : Instance : : ID IDToRelease )
{
UCustomizableObjectSystem * System = UCustomizableObjectSystem : : GetInstance ( ) ;
check ( System ! = nullptr ) ;
FCustomizableObjectSystemPrivate * SystemPrivateData = System - > GetPrivate ( ) ;
check ( SystemPrivateData ! = nullptr ) ;
mu : : SystemPtr MutableSystem = SystemPrivateData - > MutableSystem ;
// Task: Release Instance ID
//-------------------------------------------------------------
TSharedPtr < FMutableOperationData > CurrentOperationData = MakeShared < FMutableOperationData > ( ) ;
check ( CurrentOperationData ) ;
CurrentOperationData - > InstanceID = IDToRelease ;
FGraphEventRef Mutable_GetMeshTask ;
{
// Task inputs
TSharedPtr < FMutableOperation > CurrentMutableOperation = SystemPrivateData - > CurrentMutableOperation ;
check ( CurrentMutableOperation ) ;
Mutable_GetMeshTask = SystemPrivateData - > AddMutableThreadTask (
TEXT ( " Task_Mutable_ReleaseInstanceID " ) ,
[ CurrentOperationData , MutableSystem ] ( )
{
impl : : Task_Mutable_ReleaseInstanceID ( CurrentOperationData , MutableSystem ) ;
} ,
UE : : Tasks : : ETaskPriority : : BackgroundHigh ) ;
}
}
/** Enqueue the release ID operation in the Mutable queue */
void Task_Game_ReleaseInstanceID ( TSharedPtr < FMutableOperation > Operation )
{
check ( Operation ) ;
check ( Operation - > Type = = FMutableOperation : : EOperationType : : IDRelease ) ;
Task_Game_ReleaseInstanceID ( Operation - > IDToRelease ) ;
}
2022-09-26 15:12:13 -04:00
/** "Start Update" */
void Task_Game_StartUpdate ( TSharedPtr < FMutableOperation > Operation )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Operation ) ;
2022-09-26 15:12:13 -04:00
check ( Operation - > Type = = FMutableOperation : : EOperationType : : Update ) ;
UCustomizableObjectSystem * System = UCustomizableObjectSystem : : GetInstance ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( System ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
if ( ! Operation - > CustomizableObjectInstance . IsValid ( ) | | ! Operation - > CustomizableObjectInstance - > IsValidLowLevel ( ) ) // Only start if it hasn't been already destroyed (i.e. GC after finish PIE)
{
System - > ClearCurrentMutableOperation ( ) ;
return ;
}
2023-01-24 08:45:18 -05:00
TObjectPtr < UCustomizableObjectInstance > CandidateInstance = Operation - > CustomizableObjectInstance . Get ( ) ;
UCustomizableInstancePrivateData * CandidateInstancePrivateData = CandidateInstance - > GetPrivate ( ) ;
2023-01-25 11:08:55 -05:00
check ( CandidateInstancePrivateData ! = nullptr ) ;
2023-01-24 08:45:18 -05:00
2023-01-27 14:45:45 -05:00
if ( CandidateInstancePrivateData & & CandidateInstancePrivateData - > HasCOInstanceFlags ( PendingLODsUpdate ) )
2022-09-26 15:12:13 -04:00
{
2023-01-24 08:45:18 -05:00
CandidateInstancePrivateData - > ClearCOInstanceFlags ( PendingLODsUpdate ) ;
2022-09-26 15:12:13 -04:00
// TODO: Is anything needed for this now?
//Operation->CustomizableObjectInstance->ReleaseMutableInstanceId(); // To make mutable regenerate the LODs even if the instance parameters have not changed
}
bool bCancel = false ;
// If the object is locked (for instance, compiling) we skip any instance update.
2023-01-24 08:45:18 -05:00
TObjectPtr < UCustomizableObject > CustomizableObject = CandidateInstance - > GetCustomizableObject ( ) ;
if ( ! CustomizableObject )
2022-09-26 15:12:13 -04:00
{
bCancel = true ;
}
2022-09-27 08:28:56 -04:00
else
{
2023-01-24 08:45:18 -05:00
check ( CustomizableObject - > GetPrivate ( ) ) ;
if ( CustomizableObject - > GetPrivate ( ) - > bLocked )
2022-09-27 08:28:56 -04:00
{
bCancel = true ;
}
2022-09-26 15:12:13 -04:00
}
2023-01-24 08:45:18 -05:00
// Only update resources if the instance is in range (it could have got far from the player since the task was queued)
check ( System - > CurrentInstanceLODManagement ! = nullptr ) ;
if ( System - > CurrentInstanceLODManagement - > IsOnlyUpdateCloseCustomizableObjectsEnabled ( )
2023-01-27 14:45:45 -05:00
& & CandidateInstancePrivateData
2023-01-24 08:45:18 -05:00
& & CandidateInstancePrivateData - > LastMinSquareDistFromComponentToPlayer > FMath : : Square ( System - > CurrentInstanceLODManagement - > GetOnlyUpdateCloseCustomizableObjectsDist ( ) )
& & CandidateInstancePrivateData - > LastMinSquareDistFromComponentToPlayer ! = FLT_MAX // This means it is the first frame so it has to be updated
)
{
bCancel = true ;
}
// Skip update, the requested update is equal to the running update.
if ( Operation - > InstanceDescriptorRuntimeHash . IsSubset ( CandidateInstance - > GetDescriptorRuntimeHash ( ) ) )
{
UpdateSkeletalMesh ( CandidateInstance , CandidateInstance - > GetDescriptorRuntimeHash ( ) ) ;
bCancel = true ;
}
mu : : Ptr < const mu : : Parameters > Parameters = Operation - > GetParameters ( ) ;
if ( ! Parameters )
{
bCancel = true ;
}
2022-09-26 15:12:13 -04:00
if ( bCancel )
{
2023-01-24 08:45:18 -05:00
if ( CandidateInstancePrivateData )
2022-09-27 08:28:56 -04:00
{
2023-01-24 08:45:18 -05:00
CandidateInstancePrivateData - > ClearCOInstanceFlags ( Updating ) ;
2022-09-27 08:28:56 -04:00
}
2023-01-24 08:45:18 -05:00
2022-09-26 15:12:13 -04:00
System - > ClearCurrentMutableOperation ( ) ;
return ;
}
if ( LogBenchmarkUtil : : isLoggingActive ( ) )
{
Operation - > StartUpdateTime = FPlatformTime : : Seconds ( ) ;
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
FCustomizableObjectSystemPrivate * SystemPrivateData = System - > GetPrivate ( ) ;
check ( SystemPrivateData ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
SystemPrivateData - > CurrentInstanceBeingUpdated = CandidateInstance ;
2022-09-26 15:12:13 -04:00
// Prepare streaming for the current customizable object
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( SystemPrivateData - > Streamer ! = nullptr ) ;
SystemPrivateData - > Streamer - > PrepareStreamingForObject ( CustomizableObject ) ;
2022-09-26 15:12:13 -04:00
2022-11-28 07:21:35 -05:00
CandidateInstance - > CommitMinMaxLOD ( ) ;
2023-01-10 15:48:59 -05:00
2023-01-19 10:44:15 -05:00
FString StateName = CandidateInstance - > GetCustomizableObject ( ) - > GetStateName ( CandidateInstance - > GetState ( ) ) ;
const FParameterUIData * StateData = CandidateInstance - > GetCustomizableObject ( ) - > StateUIDataMap . Find ( StateName ) ;
2023-01-11 14:44:41 -05:00
bool bLiveUpdateMode = false ;
if ( SystemPrivateData - > EnableMutableLiveUpdate )
{
bLiveUpdateMode = StateData ? StateData - > bLiveUpdateMode : false ;
}
2023-01-10 15:48:59 -05:00
if ( bLiveUpdateMode & & ( ! Operation - > bNeverStream | | Operation - > MipsToSkip > 0 ) )
{
UE_LOG ( LogMutable , Warning , TEXT ( " Instance LiveUpdateMode does not yet support progressive streaming of Mutable textures. Disabling LiveUpdateMode for this update. " ) ) ;
bLiveUpdateMode = false ;
}
2023-01-19 10:44:15 -05:00
bool bReuseInstanceTextures = false ;
if ( SystemPrivateData - > EnableReuseInstanceTextures )
{
if ( Operation - > bNeverStream )
{
bReuseInstanceTextures = StateData ? StateData - > bReuseInstanceTextures : false ;
bReuseInstanceTextures | = CandidateInstancePrivateData - > HasCOInstanceFlags ( ReuseTextures ) ;
}
else
{
UE_LOG ( LogMutable , Warning , TEXT ( " Instance texture reuse requires that the current Mutable state is in non-streaming mode. Change it in the Mutable graph base node in the state definition. " ) ) ;
bReuseInstanceTextures = false ;
}
}
2023-01-10 15:48:59 -05:00
if ( ! bLiveUpdateMode & & CandidateInstancePrivateData - > LiveUpdateModeInstanceID ! = 0 )
{
// The instance was in live update mode last update, but now it's not. So the Id and resources have to be released.
// Enqueue a new mutable task to release them
Task_Game_ReleaseInstanceID ( CandidateInstancePrivateData - > LiveUpdateModeInstanceID ) ;
CandidateInstancePrivateData - > LiveUpdateModeInstanceID = 0 ;
}
2022-11-28 07:21:35 -05:00
2022-09-26 15:12:13 -04:00
// Task: Mutable Update and GetMesh
//-------------------------------------------------------------
TSharedPtr < FMutableOperationData > CurrentOperationData = MakeShared < FMutableOperationData > ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( CurrentOperationData ) ;
CurrentOperationData - > TextureCoverageQueries_MutableThreadParams = CandidateInstancePrivateData - > TextureCoverageQueries ;
2022-09-26 15:12:13 -04:00
CurrentOperationData - > TextureCoverageQueries_MutableThreadResults . Empty ( ) ;
2023-01-24 08:45:18 -05:00
CurrentOperationData - > bCanReuseGeneratedData = SystemPrivateData - > bEnableMutableReusePreviousUpdateData ;
CurrentOperationData - > LastUpdateData = SystemPrivateData - > bEnableMutableReusePreviousUpdateData ? CandidateInstancePrivateData - > LastUpdateData : FInstanceGeneratedData ( ) ;
2022-11-28 07:21:35 -05:00
CurrentOperationData - > CurrentMinLOD = Operation - > InstanceDescriptorRuntimeHash . GetMinLOD ( ) ;
CurrentOperationData - > CurrentMaxLOD = Operation - > InstanceDescriptorRuntimeHash . GetMaxLOD ( ) ;
2022-09-26 15:12:13 -04:00
CurrentOperationData - > bNeverStream = Operation - > bNeverStream ;
2023-01-10 15:48:59 -05:00
CurrentOperationData - > bLiveUpdateMode = bLiveUpdateMode ;
2023-01-19 10:44:15 -05:00
CurrentOperationData - > bReuseInstanceTextures = bReuseInstanceTextures ;
2023-01-10 15:48:59 -05:00
CurrentOperationData - > InstanceID = bLiveUpdateMode ? CandidateInstancePrivateData - > LiveUpdateModeInstanceID : 0 ;
2022-09-26 15:12:13 -04:00
CurrentOperationData - > MipsToSkip = Operation - > MipsToSkip ;
CurrentOperationData - > MutableParameters = Parameters ;
2023-01-24 08:45:18 -05:00
CurrentOperationData - > State = CandidateInstance - > GetState ( ) ;
2023-02-02 02:41:54 -05:00
CustomizableObject - > GetLowPriorityTextureNames ( CurrentOperationData - > LowPriorityTextures ) ;
2023-01-24 08:45:18 -05:00
2023-01-27 14:45:45 -05:00
if ( System - > IsOnlyGenerateRequestedLODsEnabled ( ) & & System - > CurrentInstanceLODManagement - > IsOnlyGenerateRequestedLODLevelsEnabled ( ) & & ! CandidateInstancePrivateData - > HasCOInstanceFlags ( ForceGenerateAllLODs ) )
2023-01-24 08:45:18 -05:00
{
CurrentOperationData - > RequestedLODs = Operation - > InstanceDescriptorRuntimeHash . GetRequestedLODs ( ) ;
}
2022-09-26 15:12:13 -04:00
FGraphEventRef Mutable_GetMeshTask ;
{
// Task inputs
TWeakObjectPtr < UCustomizableObjectInstance > CustomizableObjectInstancePtr = CandidateInstance ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( CustomizableObjectInstancePtr . IsValid ( ) ) ;
TSharedPtr < FMutableOperation > CurrentMutableOperation = SystemPrivateData - > CurrentMutableOperation ;
check ( CurrentMutableOperation ) ;
2022-09-26 15:12:13 -04:00
bool bBuildParameterDecorations = CurrentMutableOperation - > IsBuildParameterDecorations ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( CustomizableObject - > GetPrivate ( ) ! = nullptr ) ;
2022-12-09 03:57:57 -05:00
TSharedPtr < mu : : Model , ESPMode : : ThreadSafe > Model = CustomizableObject - > GetPrivate ( ) - > GetModel ( ) ;
2022-09-26 15:12:13 -04:00
int32 State = CustomizableObjectInstancePtr - > GetState ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
Mutable_GetMeshTask = SystemPrivateData - > AddMutableThreadTask (
2022-09-26 15:12:13 -04:00
TEXT ( " Task_Mutable_Update_GetMesh " ) ,
[ CurrentOperationData , bBuildParameterDecorations , Parameters , Model , State ] ( )
{
impl : : Task_Mutable_Update_GetMesh ( CurrentOperationData , Model , Parameters , bBuildParameterDecorations , State ) ;
} ,
UE : : Tasks : : ETaskPriority : : BackgroundHigh ) ;
}
// Task: Lock cache
//-------------------------------------------------------------
{
// Task inputs
TWeakObjectPtr < UCustomizableObjectInstance > CustomizableObjectInstancePtr = CandidateInstance ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( CustomizableObjectInstancePtr . IsValid ( ) ) ;
TSharedPtr < FMutableOperation > CurrentMutableOperation = SystemPrivateData - > CurrentMutableOperation ;
check ( CurrentMutableOperation ) ;
bool bBuildParameterDecorations = CurrentMutableOperation - > IsBuildParameterDecorations ( ) ;
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
SystemPrivateData - > AddGameThreadTask (
2022-09-26 15:12:13 -04:00
{
FMutableTaskDelegate : : CreateLambda (
[ CurrentOperationData , CustomizableObjectInstancePtr , bBuildParameterDecorations , Parameters ] ( )
{
impl : : Task_Game_LockCache ( CurrentOperationData , CustomizableObjectInstancePtr , Parameters , bBuildParameterDecorations ) ;
} ) ,
Mutable_GetMeshTask
} ) ;
}
}
} // namespace impl
void UCustomizableObjectSystem : : AdvanceCurrentOperation ( )
{
2022-12-01 06:49:41 -05:00
MUTABLE_CPUPROFILER_SCOPE ( AdvanceCurrentOperation ) ;
2022-09-26 15:12:13 -04:00
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
// See if we can clear the last reference to the mutable-thread task
Private - > ClearMutableTaskIfDone ( ) ;
// See if we have a game-thread task to process
FMutableTask * PendingTask = Private - > PendingTasks . Peek ( ) ;
if ( PendingTask )
{
if ( PendingTask - > AreDependenciesComplete ( ) )
{
PendingTask - > ClearDependencies ( ) ;
PendingTask - > Function . Execute ( ) ;
Private - > PendingTasks . Pop ( ) ;
}
// Don't do anything else until the pending work is completed.
return ;
}
// It is safe to do this now.
Private - > UpdateStreamingLimit ( ) ;
// If we don't have an ongoing operation, don't do anything.
if ( ! Private - > CurrentMutableOperation . IsValid ( ) )
{
return ;
}
// If we reach here it means:
// - we have an ongoing operations
// - we have no pending work for the ongoing operation
// - so we are starting it.
switch ( Private - > CurrentMutableOperation - > Type )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
case FMutableOperation : : EOperationType : : Discard :
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
MUTABLE_CPUPROFILER_SCOPE ( OperationDiscard ) ;
// \TODO: Discards could be done in any case, concurrently with update operations. Should they be
// in their own "queue"?
UCustomizableObjectInstance * COI = Private - > CurrentMutableOperation - > CustomizableObjectInstance . Get ( ) ;
UCustomizableInstancePrivateData * COIPrivateData = COI ? COI - > GetPrivate ( ) : nullptr ;
// Only discard resources if the instance is still out range (it could have got closer to the player since the task was queued)
if ( ! CurrentInstanceLODManagement - > IsOnlyUpdateCloseCustomizableObjectsEnabled ( ) | |
! COI | |
( ( COIPrivateData ! = nullptr ) & &
( COIPrivateData - > LastMinSquareDistFromComponentToPlayer > FMath : : Square ( CurrentInstanceLODManagement - > GetOnlyUpdateCloseCustomizableObjectsDist ( ) ) )
)
)
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( COI & & COI - > IsValidLowLevel ( ) )
{
check ( COIPrivateData ! = nullptr ) ;
COIPrivateData - > DiscardResourcesAndSetReferenceSkeletalMesh ( COI ) ;
COIPrivateData - > ClearCOInstanceFlags ( Updating ) ;
COI - > SkeletalMeshStatus = ESkeletalMeshState : : Correct ;
}
2022-09-26 15:12:13 -04:00
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
else
{
check ( COIPrivateData ! = nullptr ) ;
COIPrivateData - > ClearCOInstanceFlags ( Updating ) ;
}
if ( COI & & ! COI - > HasAnySkeletalMesh ( ) )
{
// To solve the problem in the Mutable demo where PIE just after editor start made all instances appear as reference mesh until editor restart
check ( COIPrivateData ! = nullptr ) ;
COIPrivateData - > ClearCOInstanceFlags ( Generated ) ;
}
ClearCurrentMutableOperation ( ) ;
break ;
2022-09-26 15:12:13 -04:00
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
case FMutableOperation : : EOperationType : : Update :
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
MUTABLE_CPUPROFILER_SCOPE ( OperationUpdate ) ;
// Start the first task of the update process. See namespace impl comments above.
impl : : Task_Game_StartUpdate ( Private - > CurrentMutableOperation ) ;
break ;
2022-09-26 15:12:13 -04:00
}
2023-01-10 15:48:59 -05:00
case FMutableOperation : : EOperationType : : IDRelease :
{
impl : : Task_Game_ReleaseInstanceID ( Private - > CurrentMutableOperation ) ;
ClearCurrentMutableOperation ( ) ;
break ;
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
default :
check ( false ) ;
break ;
2022-09-26 15:12:13 -04:00
}
}
bool UCustomizableObjectSystem : : Tick ( float DeltaTime )
{
MUTABLE_CPUPROFILER_SCOPE ( UCustomizableObjectSystem : : Tick )
// Building instances is not enable in servers. If at some point relevant collision or animation data is necessary for server logic this will need to be changed.
# if UE_SERVER
return true ;
# endif
if ( ! Private . IsValid ( ) )
{
return true ;
}
UWorld * World = GWorld ;
if ( World )
{
EWorldType : : Type WorldType = World - > WorldType ;
if ( WorldType ! = EWorldType : : PIE & & WorldType ! = EWorldType : : Game & & WorldType ! = EWorldType : : Editor & & WorldType ! = EWorldType : : GamePreview )
{
return true ;
}
}
// \TODO: Review: We should never compile an object from this tick, so this could be removed
# if WITH_EDITOR
FAssetRegistryModule & AssetRegistryModule = FModuleManager : : LoadModuleChecked < FAssetRegistryModule > ( " AssetRegistry " ) ;
if ( AssetRegistryModule . Get ( ) . IsLoadingAssets ( ) )
{
return true ; // Assets are still being loaded, so subobjects won't be found, compiled objects incomplete and thus updates wrong
}
# endif
MUTABLE_CPUPROFILER_SCOPE ( TickCustomizableObjectSystem )
// Get a new operation if we aren't working on one
if ( ! Private - > CurrentMutableOperation )
{
2023-01-24 08:45:18 -05:00
// Reset the instance relevancy
// \TODO: Review
// TODO: This should be done only when requiring a new job. And for the current operation instance, in case it needs to be cancelled.
CurrentInstanceLODManagement - > UpdateInstanceDistsAndLODs ( ) ;
for ( TObjectIterator < UCustomizableObjectInstance > CustomizableObjectInstance ; CustomizableObjectInstance ; + + CustomizableObjectInstance )
{
if ( IsValidChecked ( * CustomizableObjectInstance ) & & CustomizableObjectInstance - > GetPrivate ( ) )
{
UCustomizableInstancePrivateData * ObjectInstancePrivateData = CustomizableObjectInstance - > GetPrivate ( ) ;
check ( ObjectInstancePrivateData ! = nullptr ) ;
if ( ObjectInstancePrivateData - > HasCOInstanceFlags ( UsedByComponentInPlay ) )
{
ObjectInstancePrivateData - > TickUpdateCloseCustomizableObjects ( * * CustomizableObjectInstance ) ;
}
else if ( ObjectInstancePrivateData - > HasCOInstanceFlags ( UsedByComponent ) )
{
ObjectInstancePrivateData - > UpdateInstanceIfNotGenerated ( * * CustomizableObjectInstance ) ;
}
ObjectInstancePrivateData - > ClearCOInstanceFlags ( ( ECOInstanceFlags ) ( UsedByComponent | UsedByComponentInPlay | PendingLODsUpdate ) ) ; // TODO MTBL-391: Makes no sense to clear it here, what if an update is requested before we set it back to true
}
}
// Update the queue. TODO: This should be done only when requiring a new job. And for the current operation instance, in case it needs to be cancelled.
{
Private - > MutableOperationQueue . ChangePriorities ( ) ;
for ( TObjectIterator < UCustomizableObjectInstance > CustomizableObjectInstance ; CustomizableObjectInstance ; + + CustomizableObjectInstance )
{
if ( IsValidChecked ( * CustomizableObjectInstance ) & & CustomizableObjectInstance - > GetPrivate ( ) )
{
CustomizableObjectInstance - > GetPrivate ( ) - > LastMinSquareDistFromComponentToPlayer = CustomizableObjectInstance - > GetPrivate ( ) - > MinSquareDistFromComponentToPlayer ;
CustomizableObjectInstance - > GetPrivate ( ) - > MinSquareDistFromComponentToPlayer = FLT_MAX ;
}
}
Private - > MutableOperationQueue . Sort ( ) ;
}
2022-09-26 15:12:13 -04:00
// Update the streaming limit if it has changed. It is safe to do this now.
Private - > UpdateStreamingLimit ( ) ;
// Decide the next mutable operation to perform.
if ( ! Private - > MutableOperationQueue . IsEmpty ( ) )
{
FMutableQueueElem AuxElem ;
Private - > MutableOperationQueue . Dequeue ( & AuxElem ) ;
Private - > CurrentMutableOperation = AuxElem . Operation ;
}
else
{
Private - > CurrentMutableOperation = nullptr ;
}
}
// Advance the current operation
if ( Private - > CurrentMutableOperation )
{
AdvanceCurrentOperation ( ) ;
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
2022-09-26 15:12:13 -04:00
// TODO: T2927
if ( LogBenchmarkUtil : : isLoggingActive ( ) )
{
uint64 SizeCache = 0 ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
for ( const UTexture2D * CachedTextures : ProtectedCachedTextures )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( CachedTextures )
2022-09-26 15:12:13 -04:00
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
SizeCache + = CachedTextures - > CalcTextureMemorySizeEnum ( TMC_AllMips ) ;
2022-09-26 15:12:13 -04:00
}
}
SET_DWORD_STAT ( STAT_MutableTextureCacheMemory , SizeCache / 1024.f ) ;
}
Private - > UpdateStats ( ) ;
# if WITH_EDITOR
TickRecompileCustomizableObjects ( ) ;
# endif
return true ;
}
TArray < FCustomizableObjectExternalTexture > UCustomizableObjectSystem : : GetTextureParameterValues ( )
{
TArray < FCustomizableObjectExternalTexture > Result ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
check ( Private - > ImageProvider ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
for ( const TWeakObjectPtr < UCustomizableSystemImageProvider > Provider : Private - > ImageProvider - > ImageProviders )
{
if ( Provider . IsValid ( ) )
{
Provider - > GetTextureParameterValues ( Result ) ;
}
}
return Result ;
}
void UCustomizableObjectSystem : : RegisterImageProvider ( UCustomizableSystemImageProvider * Provider )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
check ( Private - > ImageProvider ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
Private - > ImageProvider - > ImageProviders . Add ( Provider ) ;
}
void UCustomizableObjectSystem : : UnregisterImageProvider ( UCustomizableSystemImageProvider * Provider )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
check ( Private - > ImageProvider ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
Private - > ImageProvider - > ImageProviders . Remove ( Provider ) ;
}
2022-11-04 09:18:44 -04:00
2023-01-25 13:01:06 -05:00
TObjectPtr < UDefaultImageProvider > UCustomizableObjectSystem : : GetDefaultImageProvider ( ) const
{
return DefaultImageProvider ;
}
UDefaultImageProvider & UCustomizableObjectSystem : : GetOrCreateDefaultImageProvider ( )
2022-11-04 09:18:44 -04:00
{
if ( ! DefaultImageProvider )
{
DefaultImageProvider = NewObject < UDefaultImageProvider > ( ) ;
RegisterImageProvider ( DefaultImageProvider ) ;
}
return * DefaultImageProvider ;
2022-09-26 15:12:13 -04:00
}
FMutableOperation FMutableOperation : : CreateInstanceUpdate ( UCustomizableObjectInstance * InCustomizableObjectInstance , bool bInNeverStream , int32 InMipsToSkip )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( InCustomizableObjectInstance ! = nullptr ) ;
check ( InCustomizableObjectInstance - > GetPrivate ( ) ! = nullptr ) ;
check ( InCustomizableObjectInstance - > GetCustomizableObject ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
FMutableOperation Op ;
Op . Type = EOperationType : : Update ;
Op . bNeverStream = bInNeverStream ;
Op . MipsToSkip = InMipsToSkip ;
Op . CustomizableObjectInstance = InCustomizableObjectInstance ;
2022-10-26 22:18:24 -04:00
Op . InstanceDescriptorRuntimeHash = InCustomizableObjectInstance - > GetUpdateDescriptorRuntimeHash ( ) ;
2022-09-26 15:12:13 -04:00
Op . bStarted = false ;
2022-10-06 19:53:04 -04:00
Op . bBuildParameterDecorations = InCustomizableObjectInstance - > GetBuildParameterDecorations ( ) ;
2022-11-03 14:23:00 -04:00
Op . Parameters = InCustomizableObjectInstance - > GetPrivate ( ) - > GetParameters ( InCustomizableObjectInstance ) ;
2022-09-26 15:12:13 -04:00
InCustomizableObjectInstance - > GetCustomizableObject ( ) - > ApplyStateForcedValuesToParameters ( InCustomizableObjectInstance - > GetState ( ) , Op . Parameters . get ( ) ) ;
if ( ! Op . Parameters )
{
// Cancel the update because the parameters aren't valid, probably because the object is not compiled
Op . CustomizableObjectInstance = nullptr ;
}
return Op ;
}
FMutableOperation FMutableOperation : : CreateInstanceDiscard ( UCustomizableObjectInstance * InCustomizableObjectInstance )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( InCustomizableObjectInstance ! = nullptr ) ;
check ( InCustomizableObjectInstance - > GetPrivate ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
FMutableOperation Op ;
Op . Type = EOperationType : : Discard ;
Op . CustomizableObjectInstance = InCustomizableObjectInstance ;
Op . CustomizableObjectInstance - > GetPrivate ( ) - > SetCOInstanceFlags ( Updating ) ;
return Op ;
}
2023-01-10 15:48:59 -05:00
FMutableOperation FMutableOperation : : CreateInstanceIDRelease ( mu : : Instance : : ID IDToRelease )
{
FMutableOperation Op ;
Op . Type = EOperationType : : IDRelease ;
Op . IDToRelease = IDToRelease ;
return Op ;
}
2022-09-26 15:12:13 -04:00
void FMutableOperation : : MutableIsDisabledCase ( )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( CustomizableObjectInstance ! = nullptr ) ;
check ( CustomizableObjectInstance - > GetPrivate ( ) ! = nullptr ) ;
check ( CustomizableObjectInstance - > GetCustomizableObject ( ) ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
for ( TObjectIterator < UCustomizableSkeletalComponent > It ; It ; + + It )
{
UCustomizableSkeletalComponent * CustomizableSkeletalComponent = * It ;
2022-10-10 07:09:51 -04:00
if ( CustomizableSkeletalComponent & & CustomizableSkeletalComponent - > CustomizableObjectInstance = = CustomizableObjectInstance . Get ( ) )
2022-09-26 15:12:13 -04:00
{
CustomizableSkeletalComponent - > SetSkeletalMesh ( CustomizableObjectInstance - > GetCustomizableObject ( ) - > GetRefSkeletalMesh ( CustomizableSkeletalComponent - > ComponentIndex ) , false ) ;
}
}
CustomizableObjectInstance - > GetPrivate ( ) - > SetCOInstanceFlags ( Generated ) ;
CustomizableObjectInstance - > GetPrivate ( ) - > ClearCOInstanceFlags ( CreatingSkeletalMesh ) ;
if ( CustomizableObjectInstance - > bEditorPropertyChanged )
{
CustomizableObjectInstance - > bEditorPropertyChanged = false ;
}
2023-01-24 08:45:18 -05:00
// We must invalidate the current DescriptorRuntimeHash, since we're discarding everything.
CustomizableObjectInstance - > Updated ( EUpdateResult : : Success , FDescriptorRuntimeHash ( ) ) ;
2022-09-26 15:12:13 -04:00
# if WITH_EDITOR
CustomizableObjectInstance - > InstanceUpdated = true ;
# endif
}
int32 UCustomizableObjectSystem : : GetNumInstances ( ) const
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
return Private - > NumInstances ;
}
int32 UCustomizableObjectSystem : : GetNumPendingInstances ( ) const
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
return Private - > NumPendingInstances ;
}
int32 UCustomizableObjectSystem : : GetTotalInstances ( ) const
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
return Private - > TotalInstances ;
}
int32 UCustomizableObjectSystem : : GetTextureMemoryUsed ( ) const
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
return int32 ( Private - > TextureMemoryUsed ) ;
}
int32 UCustomizableObjectSystem : : GetAverageBuildTime ( ) const
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
return Private - > TotalBuiltInstances = = 0 ? 0 : Private - > TotalBuildMs / Private - > TotalBuiltInstances ;
}
bool UCustomizableObjectSystem : : IsCompactSerializationEnabled ( ) const
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
return Private - > bCompactSerialization ;
}
bool UCustomizableObjectSystem : : IsSupport16BitBoneIndexEnabled ( ) const
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
return Private - > bSupport16BitBoneIndex ;
}
2023-01-24 08:45:18 -05:00
2022-09-26 15:12:13 -04:00
bool UCustomizableObjectSystem : : IsProgressiveMipStreamingEnabled ( ) const
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
return Private - > EnableMutableProgressiveMipStreaming ! = 0 ;
}
2023-01-24 08:45:18 -05:00
bool UCustomizableObjectSystem : : IsOnlyGenerateRequestedLODsEnabled ( ) const
{
check ( Private ! = nullptr ) ;
2023-01-27 14:45:45 -05:00
return Private - > EnableOnlyGenerateRequestedLODs ! = 0 ;
2023-01-24 08:45:18 -05:00
}
2022-09-26 15:12:13 -04:00
void UCustomizableObjectSystem : : AddUncompiledCOWarning ( UCustomizableObject * InObject )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( ! InObject )
{
return ;
}
2022-09-26 15:12:13 -04:00
FString Msg ;
Msg + = FString : : Printf ( TEXT ( " Warning: Customizable Object [%s] not compiled. Please compile and save the object. " ) , * InObject - > GetName ( ) ) ;
GEngine - > AddOnScreenDebugMessage ( ( uint64 ) ( ( PTRINT ) InObject ) , 10.0f , FColor : : Red , Msg ) ;
# if WITH_EDITOR
if ( UncompiledCustomizableObjectIds . Find ( InObject - > GetVersionId ( ) ) = = INDEX_NONE )
{
UncompiledCustomizableObjectIds . Add ( InObject - > GetVersionId ( ) ) ;
FMessageLog MessageLog ( " Mutable " ) ;
MessageLog . Warning ( FText : : FromString ( Msg ) ) ;
if ( ! UncompiledCustomizableObjectsNotificationPtr . IsValid ( ) )
{
FNotificationInfo Info ( FText : : FromString ( " Uncompiled Customizable Object/s found. Please, check the Message Log - Mutable for more information. " ) ) ;
Info . bFireAndForget = true ;
Info . bUseThrobber = true ;
Info . FadeOutDuration = 1.0f ;
Info . ExpireDuration = 5.0f ;
UncompiledCustomizableObjectsNotificationPtr = FSlateNotificationManager : : Get ( ) . AddNotification ( Info ) ;
}
}
# endif
}
void UCustomizableObjectSystem : : EnableBenchmark ( )
{
LogBenchmarkUtil : : startLogging ( ) ;
}
void UCustomizableObjectSystem : : EndBenchmark ( )
{
LogBenchmarkUtil : : shutdownAndSaveResults ( ) ;
}
void UCustomizableObjectSystem : : SetReleaseMutableTexturesImmediately ( bool bReleaseTextures )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( Private ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
Private - > bReleaseTexturesImmediately = bReleaseTextures ;
}
# if WITH_EDITOR
void UCustomizableObjectSystem : : OnPreBeginPIE ( const bool bIsSimulatingInEditor )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( ! EditorSettings . bCompileRootObjectsOnStartPIE | | IsRunningGame ( ) | | IsCompilationDisabled ( ) )
2022-09-26 15:12:13 -04:00
{
return ;
}
// Find root customizable objects
FARFilter AssetRegistryFilter ;
AssetRegistryFilter . ClassPaths . Add ( FTopLevelAssetPath ( TEXT ( " /Script/CustomizableObject " ) , TEXT ( " CustomizableObject " ) ) ) ;
AssetRegistryFilter . TagsAndValues . Add ( FName ( " IsRoot " ) , FString : : FromInt ( 1 ) ) ;
TArray < FAssetData > OutAssets ;
const FAssetRegistryModule & AssetRegistryModule = FModuleManager : : LoadModuleChecked < FAssetRegistryModule > ( " AssetRegistry " ) ;
AssetRegistryModule . Get ( ) . GetAssets ( AssetRegistryFilter , OutAssets ) ;
TArray < FAssetData > TempObjectsToRecompile ;
for ( const FAssetData & Asset : OutAssets )
{
// If it is referenced by PIE it should be loaded
if ( ! Asset . IsAssetLoaded ( ) )
{
continue ;
}
const UCustomizableObject * Object = Cast < UCustomizableObject > ( Asset . GetAsset ( ) ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( ! Object | | Object - > IsCompiled ( ) | | Object - > IsLocked ( ) | | Object - > bIsChildObject )
2022-09-26 15:12:13 -04:00
{
continue ;
}
// Add uncompiled objects to the objects to cook list
TempObjectsToRecompile . Add ( Asset ) ;
}
if ( ! TempObjectsToRecompile . IsEmpty ( ) )
{
FText Msg = FText : : FromString ( TEXT ( " Warning: one or more Customizable Objects used in PIE are uncompiled. \n \n Do you want to compile them? " ) ) ;
if ( FMessageDialog : : Open ( EAppMsgType : : OkCancel , Msg ) = = EAppReturnType : : Ok )
{
ObjectsToRecompile . Empty ( TempObjectsToRecompile . Num ( ) ) ;
RecompileCustomizableObjects ( TempObjectsToRecompile ) ;
}
}
}
void UCustomizableObjectSystem : : StartNextRecompile ( )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( ObjectsToRecompile . Num ( ) % 10 = = 0 ) // TODO DRB: What? If we can add more than one between calls, this might never be hit. Why % 10?
2022-09-26 15:12:13 -04:00
{
CollectGarbage ( GARBAGE_COLLECTION_KEEPFLAGS ) ;
}
FAssetData Itr = ObjectsToRecompile . Pop ( ) ;
UCustomizableObject * CustomizableObject = Cast < UCustomizableObject > ( Itr . GetAsset ( ) ) ;
if ( CustomizableObject )
{
FText UpdateMsg = FText : : FromString ( FString : : Printf ( TEXT ( " Compiling Customizable Objects: \n %s " ) , * CustomizableObject - > GetName ( ) ) ) ;
FSlateNotificationManager : : Get ( ) . UpdateProgressNotification ( RecompileNotificationHandle , NumObjectsCompiled , TotalNumObjectsToRecompile , UpdateMsg ) ;
// Use default options
FCompilationOptions Options = CustomizableObject - > CompileOptions ;
Options . bSilentCompilation = true ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( RecompileCustomizableObjectsCompiler ! = nullptr ) ;
2022-09-26 15:12:13 -04:00
RecompileCustomizableObjectsCompiler - > Compile ( * CustomizableObject , Options , true ) ;
}
}
void UCustomizableObjectSystem : : RecompileCustomizableObjectAsync ( const FAssetData & InAssetData ,
const UCustomizableObject * InObject )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( IsRunningGame ( ) | | IsCompilationDisabled ( ) )
2022-09-26 15:12:13 -04:00
{
return ;
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( ( InObject & & InObject - > IsLocked ( ) ) | | ObjectsToRecompile . Find ( ( InAssetData ) ) ! = INDEX_NONE )
2022-09-26 15:12:13 -04:00
{
return ;
}
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( ! ObjectsToRecompile . IsEmpty ( ) )
2022-09-26 15:12:13 -04:00
{
ObjectsToRecompile . Add ( InAssetData ) ;
}
else
{
RecompileCustomizableObjects ( { InAssetData } ) ;
}
}
void UCustomizableObjectSystem : : RecompileCustomizableObjects ( const TArray < FAssetData > & InObjects )
{
if ( IsRunningGame ( ) | | IsCompilationDisabled ( ) )
{
return ;
}
if ( InObjects . Num ( ) )
{
if ( ! RecompileCustomizableObjectsCompiler )
{
RecompileCustomizableObjectsCompiler = GetNewCompiler ( ) ;
if ( ! RecompileCustomizableObjectsCompiler )
{
return ;
}
}
ObjectsToRecompile . Append ( InObjects ) ;
TotalNumObjectsToRecompile = ObjectsToRecompile . Num ( ) ;
NumObjectsCompiled = 0 ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( RecompileNotificationHandle . IsValid ( ) )
2022-09-26 15:12:13 -04:00
{
+ + TotalNumObjectsToRecompile ;
FSlateNotificationManager : : Get ( ) . UpdateProgressNotification ( RecompileNotificationHandle , NumObjectsCompiled , TotalNumObjectsToRecompile ) ;
}
else
{
RecompileNotificationHandle = FSlateNotificationManager : : Get ( ) . StartProgressNotification ( FText : : FromString ( TEXT ( " Compiling Customizable Objects " ) ) , TotalNumObjectsToRecompile ) ;
StartNextRecompile ( ) ;
}
}
}
void UCustomizableObjectSystem : : TickRecompileCustomizableObjects ( )
{
bool bUpdated = false ;
if ( RecompileCustomizableObjectsCompiler )
{
bUpdated = RecompileCustomizableObjectsCompiler - > Tick ( ) | | RecompileCustomizableObjectsCompiler - > GetCompilationState ( ) = = ECustomizableObjectCompilationState : : Failed ;
}
if ( bUpdated )
{
NumObjectsCompiled + + ;
if ( ! ObjectsToRecompile . IsEmpty ( ) )
{
StartNextRecompile ( ) ;
}
else // All objects compiled, clean up
{
// Delete compiler
delete RecompileCustomizableObjectsCompiler ;
RecompileCustomizableObjectsCompiler = nullptr ;
// Remove progress bar
FSlateNotificationManager : : Get ( ) . UpdateProgressNotification ( RecompileNotificationHandle , NumObjectsCompiled , TotalNumObjectsToRecompile ) ;
FSlateNotificationManager : : Get ( ) . CancelProgressNotification ( RecompileNotificationHandle ) ;
RecompileNotificationHandle . Reset ( ) ;
CollectGarbage ( GARBAGE_COLLECTION_KEEPFLAGS ) ;
}
}
}
uint64 UCustomizableObjectSystem : : GetMaxChunkSizeForPlatform ( const ITargetPlatform * TargetPlatform )
{
const FString & PlatformName = TargetPlatform ? TargetPlatform - > IniPlatformName ( ) : FPlatformProperties : : IniPlatformName ( ) ;
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( const int64 * CachedMaxChunkSize = PlatformMaxChunkSize . Find ( PlatformName ) )
2022-09-26 15:12:13 -04:00
{
return * CachedMaxChunkSize ;
}
int64 MaxChunkSize = - 1 ;
if ( ! FParse : : Value ( FCommandLine : : Get ( ) , TEXT ( " ExtraFlavorChunkSize= " ) , MaxChunkSize ) | | MaxChunkSize < 0 )
{
FConfigFile PlatformIniFile ;
FConfigCacheIni : : LoadLocalIniFile ( PlatformIniFile , TEXT ( " Game " ) , true , * PlatformName ) ;
FString ConfigString ;
if ( PlatformIniFile . GetString ( TEXT ( " /Script/UnrealEd.ProjectPackagingSettings " ) , TEXT ( " MaxChunkSize " ) , ConfigString ) )
{
MaxChunkSize = FCString : : Atoi64 ( * ConfigString ) ;
}
}
// If no limit is specified default it to MUTABLE_STREAMED_DATA_MAXCHUNKSIZE
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
if ( MaxChunkSize < = 0 )
2022-09-26 15:12:13 -04:00
{
MaxChunkSize = MUTABLE_STREAMED_DATA_MAXCHUNKSIZE ;
}
PlatformMaxChunkSize . Add ( PlatformName , MaxChunkSize ) ;
return MaxChunkSize ;
}
2022-11-04 09:18:44 -04:00
# endif // WITH_EDITOR
2022-10-04 09:10:32 -04:00
void UCustomizableObjectSystem : : CacheImage ( uint64 ImageId )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( GetPrivate ( ) ! = nullptr ) ;
check ( GetPrivate ( ) - > ImageProvider ! = nullptr ) ;
2022-11-04 09:18:44 -04:00
GetPrivate ( ) - > ImageProvider - > CacheImage ( ImageId ) ;
2022-10-04 09:10:32 -04:00
}
void UCustomizableObjectSystem : : UnCacheImage ( uint64 ImageId )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( GetPrivate ( ) ! = nullptr ) ;
check ( GetPrivate ( ) - > ImageProvider ! = nullptr ) ;
2022-11-04 09:18:44 -04:00
GetPrivate ( ) - > ImageProvider - > UnCacheImage ( ImageId ) ;
2022-10-04 09:10:32 -04:00
}
void UCustomizableObjectSystem : : CacheAllImagesInAllProviders ( bool bClearPreviousCacheImages )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( GetPrivate ( ) ! = nullptr ) ;
check ( GetPrivate ( ) - > ImageProvider ! = nullptr ) ;
2022-11-04 09:18:44 -04:00
GetPrivate ( ) - > ImageProvider - > CacheAllImagesInAllProviders ( bClearPreviousCacheImages ) ;
2022-10-04 09:10:32 -04:00
}
void UCustomizableObjectSystem : : ClearImageCache ( )
{
While Investigating a client hang, found some code that is either unsafe, not clearly safe, or violates UE coding standards.
Code cleanup:
* Added a lot of checks() to make sure we crash explicitly with useful information rather than hoping a crash will have enough info to work from.
** NOTE: I'm aware that _some_ of the "GetPrivate()" calls have a check internal to them, but they're not named to indicate that, so it may change, and other GetPrivate() calls do NOT have internal checks for nullptr. So to reduce the need for specific implementation knowledge and the possible confusion between them, I just re-assert in those cases if the pointer is nullptr.
* Fixed a number of coding standard issues, including:
** Variable names must start with initial capitals
** Spacing, indentation, and bracing issues that didn't match UE coding standards.
* Cleaned up some other spacing and indentation issues to be consistent within the file and for general readability.
Also, removed a line of code that would cause a crash due to dereferencing a pointer that's guaranteed to be nullptr or invalid.
Added a few temporary comments to investigate some other oddities in the code.
#RB Alexei.Lebedev, Pere.Rifa, Joel.Anderson
#UE5 #RNX #NoReleaseNotes
[CL 23519838 by daniel broder in ue5-main branch]
2022-12-14 17:05:40 -05:00
check ( GetPrivate ( ) ! = nullptr ) ;
check ( GetPrivate ( ) - > ImageProvider ! = nullptr ) ;
2022-11-04 09:18:44 -04:00
GetPrivate ( ) - > ImageProvider - > ClearCache ( ) ;
2022-11-22 04:57:22 -05:00
}
bool FCustomizableObjectSystemPrivate : : IsMutableAnimInfoDebuggingEnabled ( ) const
{
# if WITH_EDITORONLY_DATA
return EnableMutableAnimInfoDebugging > 0 ;
# else
return false ;
# endif
}
bool UCustomizableObjectSystem : : IsMutableAnimInfoDebuggingEnabled ( ) const
{
# if WITH_EDITOR
return GetPrivate ( ) - > IsMutableAnimInfoDebuggingEnabled ( ) ;
# else
return false ;
# endif
}