FAssetDataGatherer::FAssetDataGatherer(const TArray<FString>& InPaths, const TArray<FString>& InSpecificFiles, bool bInIsSynchronous, EAssetDataCacheMode AssetDataCacheMode) : StopTaskCounter( 0 ) , bIsSynchronous( bInIsSynchronous ) , bIsDiscoveringFiles( false ) , SearchStartTime( 0 ) , NumPathsToSearchAtLastSyncPoint( InPaths.Num() ) , bLoadAndSaveCache( false ) , bFinishedInitialDiscovery( false ) , Thread(nullptr) { bGatherDependsData = GIsEditor && !FParse::Param( FCommandLine::Get(), TEXT("NoDependsGathering") ); if (FParse::Param(FCommandLine::Get(), TEXT("NoAssetRegistryCache")) || FParse::Param(FCommandLine::Get(), TEXT("multiprocess"))) { bLoadAndSaveCache = false; } else if (AssetDataCacheMode != EAssetDataCacheMode::NoCache) { if (AssetDataCacheMode == EAssetDataCacheMode::UseMonolithicCache) { bLoadAndSaveCache = true; CacheFilename = FPaths::GameIntermediateDir() / TEXT("CachedAssetRegistry.bin"); } else if (InPaths.Num() > 0) { // todo: handle hash collisions? uint32 CacheHash = GetTypeHash(InPaths[0]); for (int32 PathIndex = 1; PathIndex < InPaths.Num(); ++PathIndex) { CacheHash = HashCombine(CacheHash, GetTypeHash(InPaths[PathIndex])); } bLoadAndSaveCache = true; CacheFilename = FPaths::GameIntermediateDir() / TEXT("AssetRegistryCache") / FString::Printf(TEXT("%08x.bin"), CacheHash); } } // Add any specific files before doing search AddFilesToSearch(InSpecificFiles); if ( bIsSynchronous ) { // Run the package file discovery synchronously FAssetDataDiscovery PackageFileDiscovery(InPaths, bIsSynchronous); PackageFileDiscovery.GetAndTrimSearchResults(DiscoveredPaths, FilesToSearch, NumPathsToSearchAtLastSyncPoint); Run(); } else { BackgroundPackageFileDiscovery = MakeShareable(new FAssetDataDiscovery(InPaths, bIsSynchronous)); Thread = FRunnableThread::Create(this, TEXT("FAssetDataGatherer"), 0, TPri_BelowNormal); } }
Statement *ParseCatchStatement() { Statement *snp; SYM *sp; TYP *tp,*tp1,*tp2; snp = NewStatement(st_catch, TRUE); if (lastst != openpa) { snp->label = NULL; snp->s2 = 99999; snp->s1 = ParseStatement(); return snp; } needpunc(openpa); tp = head; tp1 = tail; catchdecl = TRUE; ParseAutoDeclarations(); catchdecl = FALSE; tp2 = head; head = tp; tail = tp1; needpunc(closepa); if( (sp = search(declid,&lsyms)) == NULL) sp = makeint(declid); snp->s1 = ParseStatement(); snp->label = (char *)sp; // save off symbol pointer if (sp->tp->typeno >= bt_last) error(ERR_CATCHSTRUCT); snp->s2 = GetTypeHash(sp->tp); return snp; }
FMaterialRenderProxy* operator[](FLinearColor Color) { FMaterialRenderProxy* MeshColor = NULL; const uint32 HashKey = GetTypeHash(Color); if (MeshColorInstances.Contains(HashKey)) { MeshColor = *MeshColorInstances.Find(HashKey); } else { if (bUseFakeLight && SolidMeshMaterial.IsValid()) { MeshColor = new(FMemStack::Get()) FColoredMaterialRenderProxy( SolidMeshMaterial->GetRenderProxy(false, false), Color, "GizmoColor" ); } else { MeshColor = new(FMemStack::Get()) FColoredMaterialRenderProxy(GEngine->DebugMeshMaterial->GetRenderProxy(false, false), Color); } MeshColorInstances.Add(HashKey, MeshColor); } return MeshColor; }
Statement *ParseCatchStatement() { Statement *snp; SYM *sp; TYP *tp,*tp1,*tp2; ENODE *node; static char buf[200]; snp = NewStatement(st_catch, TRUE); currentStmt = snp; if (lastst != openpa) { snp->label = (int64_t *)NULL; snp->s2 = (Statement *)99999; snp->s1 = ParseStatement(); // Empty statements return NULL if (snp->s1) snp->s1->outer = snp; return snp; } needpunc(openpa,33); tp = head; tp1 = tail; catchdecl = TRUE; AutoDeclaration::Parse(NULL,&snp->ssyms); cseg(); catchdecl = FALSE; tp2 = head; head = tp; tail = tp1; needpunc(closepa,34); if( (sp = snp->ssyms.Find(*declid,false)) == NULL) sp = makeint((char *)declid->c_str()); node = makenode(sp->storage_class==sc_static ? en_labcon : en_autocon,NULL,NULL); // nameref looks up the symbol using lastid, so we need to back it up and // restore it. strncpy(buf,lastid,199); strncpy(lastid, declid->c_str(),sizeof(lastid)-1); nameref(&node,FALSE); strcpy(lastid,buf); snp->s1 = ParseStatement(); // Empty statements return NULL if (snp->s1) snp->s1->outer = snp; snp->label = (int64_t *)node; // save name reference if (sp->tp->typeno >= bt_last) error(ERR_CATCHSTRUCT); snp->s2 = (Statement *)GetTypeHash(sp->tp); // Empty statements return NULL // if (snp->s2) // snp->s2->outer = snp; return snp; }
Statement *ParseThrowStatement() { Statement *snp; TYP *tp; currentFn->DoesThrow = TRUE; snp = NewStatement(st_throw, TRUE); tp = expression(&(snp->exp)); snp->label = GetTypeHash(tp); if( lastst != end ) needpunc( semicolon ); return snp; }
// Includes this (if the type matches), unless it is the root element. // - Fast if called on root or an end node. void CElement::GetDescendantsByType ( std::vector < CElement* >& outResult, EElementType elementType ) { // Type hash is the same as element type up to EElementType::UNKNOWN unsigned int uiTypeHash = elementType; if ( this == g_pGame->GetMapManager ()->GetRootElement () ) { GetEntitiesFromRoot ( uiTypeHash, outResult ); } else { if ( GetTypeHash () == uiTypeHash ) outResult.push_back ( this ); GetDescendantsByTypeSlow ( outResult, uiTypeHash ); } }
FMaterialRenderProxy* operator[](FLinearColor Color) const { FMaterialRenderProxy* MeshColor = NULL; const uint32 HashKey = GetTypeHash(Color); if (MeshColorInstances.Contains(HashKey)) { MeshColor = *MeshColorInstances.Find(HashKey); } else { MeshColor = new(FMemStack::Get()) FColoredMaterialRenderProxy(GEngine->DebugMeshMaterial->GetRenderProxy(false), Color); MeshColorInstances.Add(HashKey, MeshColor); } return MeshColor; }
uint32 GetTypeHash( const FUserDefinedGestureKey& Key ) { return GetTypeHash(Key.BindingContext) ^ GetTypeHash(Key.CommandName); }
uint32 GetTypeHash(const FOverlapKey& Key) { return GetTypeHash(Key.Component) ^ GetTypeHash(Key.ComponentIndex); }
void UGameplayCueManager::OnWorldCleanup(UWorld* World, bool bSessionEnded, bool bCleanupResources) { // Attempting to track down rare GC error where PreallocationInfo_Internal.OwningWorld is not cleaned up. ABILITY_LOG(Display, TEXT("UGameplayCueManager::OnWorldCleanup %s Key 0x%X . Current PreallocationInfo_Internal: Key 0x%X"), *GetNameSafe(World), GetTypeHash(FObjectKey(World)), GetTypeHash(PreallocationInfo_Internal.OwningWorldKey)); #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) DumpPreallocationStats(World); #endif if (PreallocationInfo_Internal.OwningWorldKey == FObjectKey(World)) { // Reset PreallocationInfo_Internal OnWorldCreated(nullptr, UWorld::InitializationValues()); ABILITY_LOG(Display, TEXT("UGameplayCueManager::OnWorldCleanup Reset PreallocationInfo_Internal")); } else { ABILITY_LOG(Display, TEXT("UGameplayCueManager::OnWorldCleanup did NOT Reset PreallocationInfo_Internal")); } #if WITH_EDITOR for (int32 idx=0; idx < PreallocationInfoList_Internal.Num(); ++idx) { if (PreallocationInfoList_Internal[idx].OwningWorldKey == FObjectKey(World)) { ABILITY_LOG(Display, TEXT("UGameplayCueManager::OnWorldCleanup Removing PreallocationInfoList_Internal element %d"), idx); PreallocationInfoList_Internal.RemoveAtSwap(idx, 1, false); idx--; } } #endif }
void UGameplayCueManager::OnWorldCreated(UWorld* NewWorld, const UWorld::InitializationValues IV ) { // Attempting to track down rare GC error where PreallocationInfo_Internal.OwningWorld is not cleaned up. ABILITY_LOG(Display, TEXT("UGameplayCueManager::OnWorldCreated %s Key 0x%X . Current PreallocationInfo_Internal: Key 0x%X"), *GetNameSafe(NewWorld), GetTypeHash(FObjectKey(NewWorld)), GetTypeHash(PreallocationInfo_Internal.OwningWorldKey)); PreallocationInfo_Internal.PreallocatedInstances.Reset(); PreallocationInfo_Internal.OwningWorldKey = FObjectKey(NewWorld); }
uint32 GetTypeHash( const FPhyaBodyInstancePair& Pair ) { return GetTypeHash(Pair.Body0) ^ GetTypeHash(Pair.Body1); }
FIndexKey::FIndexKey(FString InNodePath, UMovieSceneSection* InSection) : NodePath(MoveTemp(InNodePath)) , Section(InSection) , CachedHash(HashCombine(GetTypeHash(NodePath), GetTypeHash(InSection))) {}
uint32 GetTypeHash(const FPortableObjectEntryIdentity& ID) { const uint32 HashA = HashCombine(GetTypeHash(ID.MsgCtxt), GetTypeHash(ID.MsgId)); const uint32 HashB = GetTypeHash(ID.MsgIdPlural); return HashCombine(HashA, HashB); }
bool FProjectDescriptor::IsSigned(const FString& FilePath) const { return EpicSampleNameHash == GetTypeHash(FPaths::GetCleanFilename(FilePath)); }
void FProjectDescriptor::Sign(const FString& FilePath) { EpicSampleNameHash = GetTypeHash(FPaths::GetCleanFilename(FilePath)); }