UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MeshElementCollector.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "MeshBatch.h"
6#include "RendererInterface.h"
7
17
19
20namespace RuntimeVirtualTexture { class FDynamicMeshCollector; }
21
26{
27public:
28
31
32#if UE_ENABLE_DEBUG_DRAWING
34#endif
35
41 {
42 const int32 Index = MeshBatchStorage.Add(1);
43 return MeshBatchStorage[Index];
44 }
45
52
59
66
73
74 // @return number of MeshBatches collected (so far) for a given view
76 {
77 return MeshBatches[ViewIndex]->Num();
78 }
79
80 // @return Number of elemenets collected so far for a given view.
82 {
83 return NumMeshBatchElementsPerView[ViewIndex];
84 }
85
90
93
96
98 template<typename T, typename... ARGS>
100 {
101 return *OneFrameResources.Create<T>(Forward<ARGS>(Args)...);
102 }
103
104 UE_DEPRECATED(5.3, "ShouldUseTasks has been deprecated.")
106 {
107 return false;
108 }
109
110 UE_DEPRECATED(5.3, "AddTask has been deprecated.")
111 inline void AddTask(TFunction<void()>&& Task) {}
112
113 UE_DEPRECATED(5.3, "AddTask has been deprecated.")
114 inline void AddTask(const TFunction<void()>& Task) {}
115
116 UE_DEPRECATED(5.3, "ProcessTasks has been deprecated.")
118
120 {
121 return FeatureLevel;
122 }
123
124protected:
125 enum class ECommitFlags
126 {
127 None = 0,
128
129 // Defers material uniform expression updates until Commit or Finish is called.
130 DeferMaterials = 1 << 0,
131
132 // Defers GPU scene updates until Commit or Finish is called.
133 DeferGPUScene = 1 << 1,
134
136 };
138
140
142
144
145 ENGINE_API void Start(
150
152 const FSceneView* InView,
155 FGPUScenePrimitiveCollector* DynamicPrimitiveCollector
158#endif
159 );
160
162
163 ENGINE_API void Commit();
164
165 ENGINE_API void Finish();
166
172
175
178
181
182#if UE_ENABLE_DEBUG_DRAWING
184#endif
185
188
191
194
197
200
203
206
209
214
216
219 const bool bUseGPUScene;
220
223
225 friend class FSceneRenderer;
229 friend class FViewFamilyInfo;
234};
235
237
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define check(expr)
Definition AssertionMacros.h:314
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
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
#define UE_ENABLE_DEBUG_DRAWING
Definition EngineDefines.h:15
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition LumenSceneCardCapture.h:35
Definition DeferredShadingRenderer.h:317
Definition SceneVisibilityPrivate.h:246
Definition GPUScene.h:80
Definition GlobalRenderResources.h:300
Definition DynamicBufferAllocator.h:56
Definition GlobalRenderResources.h:216
Definition HitProxies.h:86
Definition MaterialRenderProxy.h:102
Definition MeshElementCollector.h:26
ENGINE_API ~FMeshElementCollector()
Definition SceneManagement.cpp:423
ENGINE_API void Start(FRHICommandList &RHICmdList, FGlobalDynamicVertexBuffer &DynamicVertexBuffer, FGlobalDynamicIndexBuffer &DynamicIndexBuffer, FGlobalDynamicReadBuffer &DynamicReadBuffer)
Definition SceneManagement.cpp:477
FGlobalDynamicVertexBuffer & GetDynamicVertexBuffer()
Definition MeshElementCollector.h:54
TArray< FGPUScenePrimitiveCollector *, TInlineAllocator< 2, SceneRenderingAllocator > > DynamicPrimitiveCollectorPerView
Definition MeshElementCollector.h:222
FRHICommandList * RHICmdList
Definition MeshElementCollector.h:215
T & AllocateOneFrameResource(ARGS &&... Args)
Definition MeshElementCollector.h:99
void AddTask(TFunction< void()> &&Task)
Definition MeshElementCollector.h:111
TArray< uint16, TInlineAllocator< 2, SceneRenderingAllocator > > MeshIdInPrimitivePerView
Definition MeshElementCollector.h:190
TArray< FSimpleElementCollector *, TInlineAllocator< 2, SceneRenderingAllocator > > SimpleElementCollectors
Definition MeshElementCollector.h:180
ENGINE_API void AddViewMeshArrays(const FSceneView *InView, TArray< FMeshBatchAndRelevance, SceneRenderingAllocator > *ViewMeshes, FSimpleElementCollector *ViewSimpleElementCollector, FGPUScenePrimitiveCollector *DynamicPrimitiveCollector, FSimpleElementCollector *DebugSimpleElementCollector=nullptr)
Definition SceneManagement.cpp:490
friend FSceneRenderingBulkObjectAllocator
Definition MeshElementCollector.h:233
ENGINE_API FPrimitiveDrawInterface * GetDebugPDI(int32 ViewIndex)
ENGINE_API void RegisterOneFrameMaterialProxy(FMaterialRenderProxy *Proxy)
Definition SceneManagement.cpp:432
FGlobalDynamicIndexBuffer & GetDynamicIndexBuffer()
Definition MeshElementCollector.h:47
TArray< FMaterialRenderProxy *, SceneRenderingAllocator > MaterialProxiesToDelete
Definition MeshElementCollector.h:193
bool ShouldUseTasks() const
Definition MeshElementCollector.h:105
ECommitFlags
Definition MeshElementCollector.h:126
FMeshBatch & AllocateMesh()
Definition MeshElementCollector.h:40
FSceneRenderingBulkObjectAllocator & OneFrameResources
Definition MeshElementCollector.h:205
TArray< TPair< FMaterialRenderProxy *, bool >, SceneRenderingAllocator > MaterialProxiesToInvalidate
Definition MeshElementCollector.h:196
FGlobalDynamicReadBuffer & GetDynamicReadBuffer()
Definition MeshElementCollector.h:61
TArray< const FSceneView *, TInlineAllocator< 2, SceneRenderingAllocator > > Views
Definition MeshElementCollector.h:187
FRHICommandList & GetRHICommandList()
Definition MeshElementCollector.h:68
ENGINE_API void AddMesh(int32 ViewIndex, FMeshBatch &MeshBatch)
Definition SceneManagement.cpp:581
const ECommitFlags CommitFlags
Definition MeshElementCollector.h:218
FRIEND_ENUM_CLASS_FLAGS(ECommitFlags)
TArray< int32, TInlineAllocator< 2, SceneRenderingAllocator > > NumMeshBatchElementsPerView
Definition MeshElementCollector.h:177
const bool bUseGPUScene
Definition MeshElementCollector.h:219
TChunkedArray< FMeshBatch, 16384, FConcurrentLinearArrayAllocator > MeshBatchStorage
Definition MeshElementCollector.h:171
const ERHIFeatureLevel::Type FeatureLevel
Definition MeshElementCollector.h:217
FGlobalDynamicIndexBuffer * DynamicIndexBuffer
Definition MeshElementCollector.h:211
ENGINE_API void CacheUniformExpressions(FMaterialRenderProxy *Proxy, bool bRecreateUniformBuffer)
Definition SceneManagement.cpp:568
ENGINE_API void ClearViewMeshArrays()
Definition SceneManagement.cpp:518
ENGINE_API void SetPrimitive(const FPrimitiveSceneProxy *InPrimitiveSceneProxy, const FHitProxyId &DefaultHitProxyId)
Definition SceneManagement.cpp:451
uint32 GetMeshBatchCount(uint32 ViewIndex) const
Definition MeshElementCollector.h:75
TArray< TPair< FGPUScenePrimitiveCollector *, FMeshBatch * >, SceneRenderingAllocator > MeshBatchesForGPUScene
Definition MeshElementCollector.h:202
TArray< const FMaterialRenderProxy *, SceneRenderingAllocator > MaterialProxiesToUpdate
Definition MeshElementCollector.h:199
const FPrimitiveSceneProxy * PrimitiveSceneProxy
Definition MeshElementCollector.h:208
FGlobalDynamicVertexBuffer * DynamicVertexBuffer
Definition MeshElementCollector.h:212
FGlobalDynamicReadBuffer * DynamicReadBuffer
Definition MeshElementCollector.h:213
void ProcessTasks()
Definition MeshElementCollector.h:117
TArray< FSimpleElementCollector *, TInlineAllocator< 2, SceneRenderingAllocator > > DebugSimpleElementCollectors
Definition MeshElementCollector.h:183
ENGINE_API void Commit()
Definition SceneManagement.cpp:531
ERHIFeatureLevel::Type GetFeatureLevel() const
Definition MeshElementCollector.h:119
ENGINE_API FPrimitiveDrawInterface * GetPDI(int32 ViewIndex)
Definition SceneManagement.cpp:439
TArray< TArray< FMeshBatchAndRelevance, SceneRenderingAllocator > *, TInlineAllocator< 2, SceneRenderingAllocator > > MeshBatches
Definition MeshElementCollector.h:174
uint32 GetMeshElementCount(uint32 ViewIndex) const
Definition MeshElementCollector.h:81
ENGINE_API void Finish()
Definition SceneManagement.cpp:556
Definition PrimitiveDrawInterface.h:19
Definition PrimitiveSceneProxy.h:296
Definition ShadowRendering.h:279
Definition RHICommandList.h:3819
Definition SceneRendering.h:2080
Definition SceneView.h:1425
Definition ShadowSetup.cpp:1321
Definition SceneManagement.h:1313
Definition SceneRendering.h:1970
Definition SceneVisibilityPrivate.h:503
Definition RuntimeVirtualTextureRender.cpp:1562
Definition Array.h:670
Definition ChunkedArray.h:56
T * Create(TArgs &&... Args)
Definition ConcurrentLinearAllocator.h:864
Definition AndroidPlatformMisc.h:14
Definition ConcurrentLinearAllocator.h:624
Definition ContainerAllocationPolicies.h:894
Type
Definition RHIFeatureLevel.h:20
Definition RuntimeVirtualTexture.h:231
U16 Index
Definition radfft.cpp:71
Definition SceneManagement.h:1462
Definition MeshBatch.h:371