UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FXSystem.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 FXSystem.h: Interface to the effects system.
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
10#include "HAL/IConsoleManager.h"
11#include "RenderUtils.h"
13
14class FCanvas;
15class FGPUSortManager;
21class FScene;
22class FSceneInterface;
28class FViewInfo;
29template<typename TBufferStruct> class TUniformBufferRef;
30
31/*-----------------------------------------------------------------------------
32 Forward declarations.
33-----------------------------------------------------------------------------*/
34
44class UVectorField;
54class FSceneView;
56class FCanvas;
57
58/*------------------------------------------------------------------------------
59 FX Console variables.
60------------------------------------------------------------------------------*/
61
65namespace FXConsoleVariables
66{
72 extern int32 bAllowCulling;
80 extern float ParticleSlackGPU;
90 extern float GPUCollisionDepthBounds;
95}
96
101{
102 return true; // For editor mobile preview
103}
104
105/*
106 * Returns true if the current RHI supports GPU particles
107 */
108//@todo rename this function.
109// Unlike other RHI* functions which are static, it actually returns true if the
110// RHI on the current hardware is able to support GPU particles.
118
120class FGPUSortManager;
122
123/*-----------------------------------------------------------------------------
124 The interface to the FX system runtime.
125-----------------------------------------------------------------------------*/
126
130class FFXSystemInterface : public TSharedFromThis<FFXSystemInterface>
131{
132 struct FFXInterfaceDeletor
133 {
134 void operator()(FFXSystemInterface* ObjectToDelete) const;
135 };
136
137public:
142
148 ENGINE_API static void MarkPendingKill(FFXSystemInterface* FXSystem);
149
154
159
163 ENGINE_API static void UnregisterCustomFXSystem(const FName& InterfaceName);
164
168 virtual FFXSystemInterface* GetInterface(const FName& InName) { return nullptr; };
169
174 virtual void OnMarkPendingKill() { bIsPendingKill = true; }
175
179 virtual void DestroyGPUSimulation() { }
180
185 virtual void Tick(UWorld* World, float DeltaSeconds) = 0;
186
187 UE_DEPRECATED(5.7, "Destroy is no longer supported, please update your code call MarkPendingKill")
189
191 UE_DEPRECATED(5.7, "OnDestroy is no longer supported, please update your code call/implement OnMarkPendingKill")
192 virtual void OnDestroy() final {}
193public:
194
195#if WITH_EDITOR
200 virtual void Suspend() = 0;
201
206 virtual void Resume() = 0;
207#endif // #if WITH_EDITOR
208
213 virtual void DrawDebug(FCanvas* Canvas) = 0;
214
219 virtual bool ShouldDebugDraw_RenderThread() const { return false; }
220
228 virtual void DrawDebug_RenderThread(FRDGBuilder& GraphBuilder, const FSceneView& View, const struct FScreenPassRenderTarget& Output) {}
229
230 UE_DEPRECATED(5.3, "Passing FViewInfo is deprecated in favor of FSceneView. This function will do nothing.")
232
237
238 UE_DEPRECATED(5.3, "Passing FViewInfo is deprecated in favor of FSceneView. This function will do nothing.")
240
245 virtual void AddVectorField(UVectorFieldComponent* VectorFieldComponent) = 0;
246
251 virtual void RemoveVectorField(UVectorFieldComponent* VectorFieldComponent) = 0;
252
257 virtual void UpdateVectorField(UVectorFieldComponent* VectorFieldComponent) = 0;
258
264
266
267 UE_DEPRECATED(5.3, "Passing an array of FViewInfo is deprecated in favor of FSceneView. This function will do nothing.")
269
270 virtual bool UsesGlobalDistanceField() const = 0;
271
272 virtual bool UsesDepthBuffer() const = 0;
273
274 virtual bool RequiresEarlyViewUniformBuffer() const = 0;
275
276 virtual bool RequiresRayTracingScene() const = 0;
277
282 virtual void PreRender(FRDGBuilder& GraphBuilder, TConstStridedView<FSceneView> Views, FSceneUniformBuffer &SceneUniformBuffer, bool bAllowGPUParticleUpdate) = 0;
283
284 UE_DEPRECATED(5.3, "Passing an array of FViewInfo is deprecated in favor of FSceneView. This function will do nothing.")
286
290 virtual void PostRenderOpaque(FRDGBuilder& GraphBuilder, TConstStridedView<FSceneView> Views, FSceneUniformBuffer &SceneUniformBuffer, bool bAllowGPUParticleUpdate) = 0;
291
292 UE_DEPRECATED(5.3, "Passing an array of FViewInfo is deprecated in favor of FSceneView. This function will do nothing.")
294
295 bool IsPendingKill() const { return bIsPendingKill; }
296
298 virtual FGPUSortManager* GetGPUSortManager() const = 0;
299
301
302 inline FSceneInterface* GetSceneInterface() const { return SceneInterface; }
304
305 inline FScene* GetScene()const { return Scene; }
306 inline void SetScene(FScene* InScene) { Scene = InScene; }
307
308protected:
309
310 friend class FFXSystemSet;
311
314
315private:
316
317 bool bIsPendingKill = false;
318
319 FSceneInterface* SceneInterface = nullptr;
320 FScene* Scene = nullptr;
321
322 static TMap<FName, FCreateCustomFXSystemDelegate> CreateCustomFXDelegates;
323};
324
325/*-----------------------------------------------------------------------------
326 FX resource management.
327-----------------------------------------------------------------------------*/
328
336
343
350
351#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_6
352#include "SceneView.h"
353#endif
#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 DECLARE_DELEGATE_RetVal_ThreeParams(ReturnValueType, DelegateName, Param1Type, Param2Type, Param3Type)
Definition DelegateCombinations.h:72
void BeginReleaseGPUSpriteResources(FGPUSpriteResources *Resources)
Definition ParticleGpuSimulation.cpp:5434
bool SupportsGPUParticles(EShaderPlatform Platform)
Definition FXSystem.h:100
void BeginUpdateGPUSpriteResources(FGPUSpriteResources *Resources, const FGPUSpriteResourceData &InResourceData)
Definition ParticleGpuSimulation.cpp:5426
bool RHISupportsGPUParticles()
Definition FXSystem.h:111
FGPUSpriteResources * BeginCreateGPUSpriteResources(const FGPUSpriteResourceData &InResourceData)
Definition ParticleGpuSimulation.cpp:5409
FPixelFormatInfo GPixelFormats[PF_MAX]
Definition PixelFormat.cpp:31
@ PF_G32R32F
Definition PixelFormat.h:34
#define GSupportsTexture3D
Definition RHIGlobals.h:802
#define GSupportsWideMRT
Definition RHIGlobals.h:806
EShaderPlatform
Definition RHIShaderPlatform.h:11
Definition CanvasTypes.h:211
Definition FXSystem.h:131
virtual FGPUSortManager * GetGPUSortManager() const =0
virtual void PostInitViews(FRDGBuilder &GraphBuilder, TConstStridedView< FSceneView > Views, bool bAllowGPUParticleUpdate)=0
virtual void DrawSceneDebug_RenderThread(FRDGBuilder &GraphBuilder, const FSceneView &View, FRDGTextureRef SceneColor, FRDGTextureRef SceneDepth)
Definition FXSystem.h:236
static ENGINE_API void QueueDestroyGPUSimulation(FFXSystemInterface *FXSystem)
Definition FXSystem.cpp:97
virtual void OnDestroy() final
Definition FXSystem.h:192
void SetSceneInterface(FSceneInterface *InSceneInterface)
Definition FXSystem.h:303
virtual void Tick(UWorld *World, float DeltaSeconds)=0
virtual ~FFXSystemInterface()
Definition FXSystem.h:313
FSceneInterface * GetSceneInterface() const
Definition FXSystem.h:302
virtual void DrawDebug(FCanvas *Canvas)=0
bool IsPendingKill() const
Definition FXSystem.h:295
virtual void PreRender(FRDGBuilder &GraphBuilder, TConstStridedView< FSceneView > Views, FSceneUniformBuffer &SceneUniformBuffer, bool bAllowGPUParticleUpdate)=0
virtual bool ShouldDebugDraw_RenderThread() const
Definition FXSystem.h:219
virtual void DrawDebug_RenderThread(FRDGBuilder &GraphBuilder, const FSceneView &View, const struct FScreenPassRenderTarget &Output)
Definition FXSystem.h:228
virtual void PreInitViews(FRDGBuilder &GraphBuilder, bool bAllowGPUParticleUpdate, const TArrayView< const FSceneViewFamily * > &ViewFamilies, const FSceneViewFamily *CurrentFamily)=0
virtual void OnMarkPendingKill()
Definition FXSystem.h:174
virtual bool UsesDepthBuffer() const =0
virtual void PostRenderOpaque(FRDGBuilder &GraphBuilder, TConstStridedView< FSceneView > Views, FSceneUniformBuffer &SceneUniformBuffer, bool bAllowGPUParticleUpdate)=0
static ENGINE_API void MarkPendingKill(FFXSystemInterface *FXSystem)
Definition FXSystem.cpp:107
virtual bool RequiresRayTracingScene() const =0
void SetScene(FScene *InScene)
Definition FXSystem.h:306
virtual void AddVectorField(UVectorFieldComponent *VectorFieldComponent)=0
virtual bool RequiresEarlyViewUniformBuffer() const =0
virtual void UpdateVectorField(UVectorFieldComponent *VectorFieldComponent)=0
virtual void SetSceneTexturesUniformBuffer(const TUniformBufferRef< FSceneTextureUniformParameters > &InSceneTexturesUniformParams)
Definition FXSystem.h:300
static ENGINE_API void RegisterCustomFXSystem(const FName &InterfaceName, const FCreateCustomFXSystemDelegate &InCreateDelegate)
Definition FXSystem.cpp:118
virtual void RemoveVectorField(UVectorFieldComponent *VectorFieldComponent)=0
virtual void DestroyGPUSimulation()
Definition FXSystem.h:179
static ENGINE_API void UnregisterCustomFXSystem(const FName &InterfaceName)
Definition FXSystem.cpp:123
virtual FFXSystemInterface * GetInterface(const FName &InName)
Definition FXSystem.h:168
virtual bool UsesGlobalDistanceField() const =0
FScene * GetScene() const
Definition FXSystem.h:305
Definition FXSystemSet.h:20
Definition GPUSortManager.h:167
Definition ParticleGpuSimulation.cpp:2708
Definition GlobalDistanceFieldParameters.h:18
Definition NameTypes.h:617
Definition PrimitiveDrawInterface.h:19
Definition RenderGraphBuilder.h:49
Definition RenderGraphResources.h:571
Definition RHIResources.h:1232
Definition SceneInterface.h:106
Definition SceneUniformBuffer.h:137
Definition SceneView.h:2212
Definition SceneView.h:1425
Definition ScenePrivate.h:2875
Definition VectorField.h:102
Definition VectorField.h:38
Definition SceneRendering.h:1132
Definition ArrayView.h:139
Definition IConsoleManager.h:1792
Definition UnrealString.h.inl:34
Definition SharedPointer.h:1640
Definition ShaderParameterMacros.h:136
Definition VectorFieldComponent.h:19
Definition VectorField.h:16
Definition World.h:918
Type
Definition RHIFeatureLevel.h:20
Definition FXSystem.cpp:133
float ParticleSlackGPU
Definition FXSystem.cpp:140
int32 bFreezeParticleSimulation
Definition FXSystem.cpp:138
TAutoConsoleVariable< int32 > TestGPUSort(TEXT("FX.TestGPUSort"), 0, TEXT("Test GPU sort. 1: Small, 2: Large, 3: Exhaustive, 4: Random"), ECVF_Cheat)
Definition FXSystem.h:92
int32 MaxParticleTilePreAllocation
Definition FXSystem.cpp:141
float GPUCollisionDepthBounds
Definition FXSystem.cpp:145
int32 VisualizeGPUSimulation
Definition FXSystem.cpp:134
int32 GPUSpawnWarningThreshold
Definition FXSystem.cpp:144
int32 bAllowAsyncTick
Definition FXSystem.cpp:139
int32 MaxGPUParticlesSpawnedPerFrame
Definition FXSystem.cpp:143
int32 bAllowGPUSorting
Definition FXSystem.cpp:135
int32 bAllowCulling
Definition FXSystem.cpp:136
int32 bFreezeGPUSimulation
Definition FXSystem.cpp:137
int32 bAllowGPUParticles
Definition FXSystem.cpp:222
int32 MaxCPUParticlesPerEmitter
Definition FXSystem.cpp:142
Definition ParticleModuleTypeDataGpu.h:95
Definition ParticleModuleTypeDataGpu.h:251
Definition ParticleEmitterInstances.h:226
uint8 Supported
Definition PixelFormat.h:480
Definition ScreenPass.h:83