UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
StaticMeshUpdate.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4StaticMeshUpdate.h: Helpers to stream in and out static mesh LODs.
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
10#include "Engine/StaticMesh.h"
12#include "IO/IoDispatcher.h"
13#include "RenderAssetUpdate.h"
14#include "RayTracingGeometry.h"
15
44
45// Declare that TRenderAssetUpdate is instantiated for FStaticMeshUpdateContext
47
54{
55public:
57
62
63protected:
64
65 virtual ~FStaticMeshUpdate() {}
66};
67
69{
70public:
71 FStaticMeshStreamIn(const UStaticMesh* InMesh, EThreadType CreateResourcesThread);
72
73 virtual ~FStaticMeshStreamIn();
74
75protected:
94
95#if RHI_RAYTRACING
97 {
98 private:
101 bool bRequiresBuild = false;
102
103 public:
104 void CreateFromCPUData(FRHICommandListBase& RHICmdList, FRayTracingGeometry& RayTracingGeometry);
105
106 void SafeRelease();
107
109 };
110#endif
111
113 void CreateBuffers(const FContext& Context);
114
116 void DiscardNewLODs(const FContext& Context);
117
119 void DoFinishUpdate(const FContext& Context);
120
122 void DoCancel(const FContext& Context);
123
125 FIntermediateBuffers IntermediateBuffersArray[MAX_MESH_LOD_COUNT];
126
127#if RHI_RAYTRACING
129#endif
130
132 FRHICommandList* StreamingRHICmdList = nullptr;
133
136};
137
140{
141public:
143
144private:
145
146 void CheckReferencesAndDiscardCPUData(const FContext& Context);
147 void ReleaseRHIBuffers(const FContext& Context);
149 void Cancel(const FContext& Context);
150
151 bool bDiscardCPUData = false;
152 int32 NumReferenceChecks = 0;
153 uint32 PreviousNumberOfExternalReferences = 0;
154};
155
157{
158public:
159 FStaticMeshStreamIn_IO(const UStaticMesh* InMesh, bool bHighPrio, EThreadType CreateResourcesThread);
160
162
163 virtual void Abort() override;
164
165protected:
183
186
188 void SetIORequest(const FContext& Context);
189
191 void ClearIORequest(const FContext& Context);
192
194 void ReportIOError(const FContext& Context);
195
197 void SerializeLODData(const FContext& Context);
198
200 void Cancel(const FContext& Context);
201
203 void CancelIORequest();
204
;
207
210
212
213 // Whether an IO error was detected (when files do not exists).
214 bool bFailedOnIOError = false;
215
216 void DoInitiateIO(const FContext& Context);
217
218 void DoSerializeLODData(const FContext& Context);
219
220 void DoCreateBuffers(const FContext& Context);
221
222 void DoCancelIO(const FContext& Context);
223};
224
225#if WITH_EDITOR
227{
228public:
229 FStaticMeshStreamIn_DDC(const UStaticMesh* InMesh, EThreadType CreateResourcesThread);
230
231 virtual ~FStaticMeshStreamIn_DDC() {}
232
233protected:
234 void LoadNewLODsFromDDC(const FContext& Context);
235
236private:
238 void DoLoadNewLODsFromDDC(const FContext& Context);
239
241 void DoCreateBuffers(const FContext& Context);
242};
243#endif
#define FORCEINLINE
Definition AndroidPlatform.h:140
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define RETURN_QUICK_DECLARE_CYCLE_STAT(StatId, GroupId)
Definition Stats.h:655
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
@ MAX_MESH_LOD_COUNT
Definition RHIDefinitions.h:271
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition AsyncWork.h:63
Definition BulkData.h:1295
Definition IoBuffer.h:15
Definition AsyncWork.h:663
Definition RHICommandList.h:455
Definition RHICommandList.h:3819
Definition RHIResourceReplace.h:55
Definition RayTracingGeometry.h:31
virtual void Abort()
Definition RenderAssetUpdate.h:81
EThreadType
Definition RenderAssetUpdate.h:43
Definition StaticMeshResources.h:774
Definition StaticMeshUpdate.h:167
FORCEINLINE TStatId GetStatId() const
Definition StaticMeshUpdate.h:175
FCancelIORequestsTask(FStaticMeshStreamIn_IO *InPendingUpdate)
Definition StaticMeshUpdate.h:169
Definition StaticMeshUpdate.h:157
FBulkDataBatchRequest BulkDataRequest
Definition StaticMeshUpdate.h:206
FIoBuffer BulkData
Definition StaticMeshUpdate.h:209
friend class FCancelIORequestsTask
Definition StaticMeshUpdate.h:185
virtual ~FStaticMeshStreamIn_IO()
Definition StaticMeshUpdate.h:161
bool bHighPrioIORequest
Definition StaticMeshUpdate.h:211
FAutoDeleteAsyncTask< FCancelIORequestsTask > FAsyncCancelIORequestsTask
Definition StaticMeshUpdate.h:184
Definition StaticMeshUpdate.h:69
const EThreadType CreateResourcesThread
Definition StaticMeshUpdate.h:135
Definition StaticMeshUpdate.h:140
Definition StaticMeshUpdate.h:54
virtual void Abort()
Definition StaticMeshUpdate.h:58
virtual ~FStaticMeshUpdate()
Definition StaticMeshUpdate.h:65
Definition ArrayView.h:139
Definition RenderAssetUpdate.h:243
Definition StaticMesh.h:593
Definition StreamableRenderAsset.h:37
Definition RHIResources.h:3496
Definition StaticMeshResources.h:426
Definition StaticMeshUpdate.h:78
FBufferRHIRef WireframeIndexBuffer
Definition StaticMeshUpdate.h:87
FBufferRHIRef ReversedIndexBuffer
Definition StaticMeshUpdate.h:84
FBufferRHIRef DepthOnlyIndexBuffer
Definition StaticMeshUpdate.h:85
FBufferRHIRef ReversedDepthOnlyIndexBuffer
Definition StaticMeshUpdate.h:86
FBufferRHIRef TexCoordVertexBuffer
Definition StaticMeshUpdate.h:80
FBufferRHIRef ColorVertexBuffer
Definition StaticMeshUpdate.h:82
FBufferRHIRef IndexBuffer
Definition StaticMeshUpdate.h:83
FBufferRHIRef TangentsVertexBuffer
Definition StaticMeshUpdate.h:79
FBufferRHIRef PositionVertexBuffer
Definition StaticMeshUpdate.h:81
Definition StaticMeshUpdate.h:22
TArrayView< FStaticMeshLODResources * > LODResourcesView
Definition StaticMeshUpdate.h:39
EThreadType GetCurrentThread() const
Definition StaticMeshUpdate.h:29
EThreadType CurrentThread
Definition StaticMeshUpdate.h:42
const UStaticMesh * Mesh
Definition StaticMeshUpdate.h:35
int32 EThreadType
Definition StaticMeshUpdate.h:23
FStaticMeshRenderData * RenderData
Definition StaticMeshUpdate.h:37
Definition LightweightStats.h:416