UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LevelTextureManager.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4TextureInstanceManager.h: Definitions of classes used for texture streaming.
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
13#include "ContentStreaming.h"
16#include "UObject/UObjectHash.h"
17#include "Async/Mutex.h"
18
19// The streaming data of a level.
21{
22public:
23
25
26 ULevel* GetLevel() const { return Level; }
27
28 FORCEINLINE bool HasRenderAssetReferences() const { return StaticInstances.HasRenderAssetReferences(); }
29
30 // Remove the whole level. Optional list of textures or meshes referenced
32
33 // Invalidate a component reference.
34
36
38 {
39 // Check everywhere as the mobility can change in game.
40 StaticInstances.Remove(Component, &RemovedRenderAssets);
41 UnprocessedComponents.RemoveSingleSwap(Component);
42 PendingComponents.RemoveSingleSwap(Component);
43 }
44
45 const FStaticRenderAssetInstanceManager& GetStaticInstances() const { return StaticInstances; }
46
47 float GetWorldTime() const;
48
50 FORCEINLINE const FRenderAssetInstanceView* GetRawAsyncView() { return StaticInstances.GetAsyncView(false); }
51
53
55
56 bool IsInitialized() const { return bIsInitialized; }
57 bool HasBeenReferencedToStreamedTextures() const { return bHasBeenReferencedToStreamedTextures; }
58 void SetReferencedToStreamedTextures() { bHasBeenReferencedToStreamedTextures = true; }
59
60 void NotifyLevelOffset(const FVector& Offset);
61
62private:
63
64 ULevel* Level;
65
66 bool bIsInitialized;
67 bool bHasBeenReferencedToStreamedTextures;
68
70
73 enum class EStaticBuildStep : uint8
74 {
75 BuildTextureLookUpMap,
76 ProcessActors,
77 ProcessComponents,
78 NormalizeLightmapTexelFactors,
79 CompileElements,
80 WaitForRegistration,
81 Done,
82 };
83
84 // The current step of the incremental build.
85 EStaticBuildStep BuildStep;
86 // The components left to be processed in ProcessComponents
87 TArray<const UPrimitiveComponent*> UnprocessedComponents;
88 // The components that could not be processed by the incremental build.
89 TArray<const UPrimitiveComponent*> PendingComponents;
90 // Reversed lookup for ULevel::StreamingTextureGuids.
91 TMap<FGuid, int32> TextureGuidToLevelIndex;
92 // Used when SetAsStatic and/or SetAsDynamic are called concurrently
93 UE::FMutex SetAsLock;
94
95 bool NeedsIncrementalBuild(int32 NumStepsLeftForIncrementalBuild) const;
97
98 FORCEINLINE_DEBUGGABLE void SetAsStatic(FDynamicRenderAssetInstanceManager& DynamicComponentManager, const UPrimitiveComponent* Primitive, bool bIsConcurrent = false);
99 FORCEINLINE_DEBUGGABLE void SetAsDynamic(FDynamicRenderAssetInstanceManager& DynamicComponentManager, FStreamingTextureLevelContext& LevelContext, const UPrimitiveComponent* Primitive, bool bIsConcurrent = false);
100};
#define FORCEINLINE
Definition AndroidPlatform.h:140
void AsyncTask(ENamedThreads::Type Thread, TUniqueFunction< void()> Function)
Definition Async.cpp:54
#define FORCEINLINE_DEBUGGABLE
Definition CoreMiscDefines.h:74
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
@ Percentage
uint32 Offset
Definition VulkanMemory.cpp:4033
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Actor.h:257
Definition DynamicTextureInstanceManager.h:19
Definition LevelTextureManager.h:21
void NotifyLevelOffset(const FVector &Offset)
Definition LevelTextureManager.cpp:401
float GetWorldTime() const
Definition LevelTextureManager.cpp:72
bool IsInitialized() const
Definition LevelTextureManager.h:56
void RemoveComponentReferences(const UPrimitiveComponent *Component, FRemovedRenderAssetArray &RemovedRenderAssets)
Definition LevelTextureManager.h:37
FORCEINLINE bool HasRenderAssetReferences() const
Definition LevelTextureManager.h:28
const FStaticRenderAssetInstanceManager & GetStaticInstances() const
Definition LevelTextureManager.h:45
bool HasBeenReferencedToStreamedTextures() const
Definition LevelTextureManager.h:57
FORCEINLINE FRenderAssetInstanceAsyncView GetAsyncView()
Definition LevelTextureManager.h:49
FORCEINLINE const FRenderAssetInstanceView * GetRawAsyncView()
Definition LevelTextureManager.h:50
void SetReferencedToStreamedTextures()
Definition LevelTextureManager.h:58
void IncrementalUpdate(FDynamicRenderAssetInstanceManager &DynamicManager, FRemovedRenderAssetArray &RemovedRenderAssets, int64 &NumStepsLeftForIncrementalBuild, float Percentage, bool bUseDynamicStreaming)
Definition LevelTextureManager.cpp:362
uint32 GetAllocatedSize() const
Definition LevelTextureManager.cpp:410
ULevel * GetLevel() const
Definition LevelTextureManager.h:26
FORCEINLINE void RemoveActorReferences(const AActor *Actor)
Definition LevelTextureManager.h:35
Definition TextureInstanceView.h:267
Definition TextureInstanceView.h:109
Definition StaticTextureInstanceManager.h:19
void Remove(const UPrimitiveComponent *Component, FRemovedRenderAssetArray *RemovedRenderAssets) final override
Definition StaticTextureInstanceManager.cpp:109
const FRenderAssetInstanceView * GetAsyncView(bool bCreateIfNull) final override
Definition StaticTextureInstanceManager.cpp:123
FORCEINLINE bool HasRenderAssetReferences() const
Definition StaticTextureInstanceManager.h:33
Definition TextureStreamingTypes.h:223
Definition TextureInstanceTask.h:177
Definition Array.h:670
SizeType RemoveSingleSwap(const ElementType &Item, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:3211
Definition UnrealString.h.inl:34
Definition Mutex.h:18
Definition Level.h:423