UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VirtualShadowMapCacheManager.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "SceneManagement.h"
9#include "GPUScene.h"
10#include "GPUMessaging.h"
12#include "SceneExtensions.h"
13#include "ScenePrivate.h"
15
17class FGPUScene;
20
21namespace Nanite { struct FPackedViewParams; }
22
30
32{
33 // See UpdatePrevHZBMetadata if you modify fields here
37 bool bMatricesDirty = true;
38};
39
40#define VSM_LOG_INVALIDATIONS 0
41
43{
44public:
45 // Generic version used for local lights but also inactive lights
47
48 // Specific version of the above for clipmap levels, which have additional constraints
51 FInt64Point PageSpaceLocation,
52 double LevelRadius,
53 double ViewCenterZ,
54 double ViewRadiusZ,
56
58
59 void UpdateHZBMetadata(const FViewMatrices& ViewMatrices, const FIntRect& ViewRect, uint32 TargetLayerIndex);
60
70
73
74 // Tracks mapping to any previously cached data
76
77 // Stores the projection shader data. This is needed for cached entries that may be inactive in the current frame/render
78 // and also avoids recomputing it every frame.
80
81 // Clipmap-specific information for panning and tracking of cached z-ranges in a given level
90};
91
93{
94public:
100
101 void OnPrimitiveRendered(const FPrimitiveSceneInfo* PrimitiveSceneInfo, bool bPrimitiveRevealed);
102
107 inline bool IsFullyCached() const
108 {
110 }
111
112 inline bool IsUncached() const { return bIsUncached; }
113
114 inline bool ShouldUseReceiverMask() const { return bUseReceiverMask; }
115
116 void MarkRendered(int32 FrameIndex) { RenderedFrameNumber = FrameIndex; }
118 bool IsInvalidated() const { return RenderedFrameNumber < 0; }
119
120 void MarkScheduled(int32 FrameIndex) { ScheduledFrameNumber = FrameIndex; }
122
126
127 void UpdateClipmap(
128 const FVector& LightDirection,
129 int FirstLevel,
130 bool bForceInvalidate,
131 bool bInUseReceiverMask);
132
133 void UpdateLocal(
135 const FVector& NewLightOrigin,
136 const float NewLightRadius,
138 bool bForceInvalidate,
140 bool bInUseReceiverMask);
141
142 bool AffectsBounds(const FBoxSphereBounds& Bounds) const
143 {
144 return (LightRadius <= 0.0f) || // Infinite extent light (directional, etc)
145 ((Bounds.Origin - LightOrigin).SizeSquared() <= FMath::Square(LightRadius + Bounds.SphereRadius));
146 }
147
148 // Last frame numbers that we rendered/scheduled this light
151
154
155 bool bIsUncached = false;
156 bool bIsDistantLight = false;
157 bool bUseReceiverMask = false;
158
159 // Tracks if this cache entry is being used "this render", i.e. "active". Note that there may be multiple renders per frame in the case of
160 // scene captures or similar, so unlike the RenderedFrameNumber we don't use the scene frame number, but instead mark this
161 // when a light is set up, and clear it when extracting frame data.
163
164 // This tracks the last "rendered frame" the light was active
166
167 // Primitives that have been rendered (not culled) the previous frame, when a primitive transitions from being culled to not it must be rendered into the VSM
168 // Key culling reasons are small size or distance cutoff.
170
171 // One entry represents the cached state of a given shadow map in the set of either a clipmap(N), one cube map(6) or a regular VSM (1)
173
175
176private:
177 struct FLocalLightCacheKey
178 {
179 FMatrix WorldToLight;
180 FVector PreShadowTranslation;
181 };
182 FLocalLightCacheKey LocalCacheKey;
183
184 struct FClipmapCacheKey
185 {
186 FVector LightDirection;
187 int FirstLevel;
188 int LevelCount;
189 };
190 FClipmapCacheKey ClipmapCacheKey;
191
192 // Rough bounds for invalidation culling
193 FVector LightOrigin = FVector(0, 0, 0);
194 float LightRadius = -1.0f; // Negative means infinite
195};
196
198{
199public:
202
204 {
207 };
208
209 void SubmitFeedbackBuffer(FRDGBuilder& GraphBuilder, FRDGBufferRef FeedbackBuffer);
211
212private:
213 static const int32 MaxBuffers = 3;
214 int32 WriteIndex = 0;
215 int32 NumPending = 0;
216 FReadbackInfo Buffers[MaxBuffers];
217};
218
219// Persistent buffers that we ping pong frame by frame
234
243
245{
249
250 inline bool operator==(const FVirtualShadowMapCacheKey& Other) const { return ViewUniqueID == Other.ViewUniqueID && Other.LightSceneId == LightSceneId && Other.ShadowTypeId == ShadowTypeId; }
251};
252
254{
255 return HashCombineFast(GetTypeHash(Key.LightSceneId), HashCombineFast(GetTypeHash(Key.ViewUniqueID), GetTypeHash(Key.ShadowTypeId)));
256}
257
259{
262
263public:
265
266 // Enough for er lots...
267 static constexpr uint32 MaxStatFrames = 512 * 1024U;
268
271
272 // ISceneExtension
274 virtual void InitExtension(FScene& InScene) override;
275 virtual ISceneExtensionUpdater* CreateUpdater() override;
277
278 // Called by VirtualShadowMapArray to potentially resize the physical pool
279 // If the requested size is not already the size, all cache data is dropped and the pool is resized.
280 void SetPhysicalPoolSize(FRDGBuilder& GraphBuilder, FIntPoint RequestedSize, int RequestedArraySize, uint32 MaxPhysicalPages);
281 void FreePhysicalPool(FRDGBuilder& GraphBuilder);
282 TRefCountPtr<IPooledRenderTarget> GetPhysicalPagePool() const { return PhysicalPagePool; }
283 TRefCountPtr<FRDGPooledBuffer> GetPhysicalPageMetaData() const { return PhysicalPageMetaData; }
284
285 // Called by VirtualShadowMapArray to potentially resize the HZB physical pool
287 void FreeHZBPhysicalPool(FRDGBuilder& GraphBuilder);
288
289 // Invalidate the cache for all shadows, causing any pages to be rerendered
290 void Invalidate(FRDGBuilder& GraphBuilder);
291
298 void UpdateUnreferencedCacheEntries(FVirtualShadowMapArray& VirtualShadowMapArray);
299
307 void ExtractFrameData(FRDGBuilder& GraphBuilder,
308 FVirtualShadowMapArray &VirtualShadowMapArray,
309 const FSceneRenderer& SceneRenderer,
311
317
318 bool IsCacheEnabled();
320 bool IsHZBDataAvailable();
321
323 {
324#if WITH_MGPU
325 return CacheValidGPUMask;
326#else
327 return FRHIGPUMask::GPU0();
328#endif
329 }
330
332 {
333#if WITH_MGPU
334 if (bMergeMask)
335 {
336 CacheValidGPUMask |= GPUMask;
337 }
338 else
339 {
340 // To handle initialization when first allocating cache resources, we overwrite the mask. This is necessary because the FRHIGPUMask doesn't
341 // support empty masks. Also, this deals with cases where the cache is cleared -- the cache resources will be missing, and it can use this
342 // code path to set the mask to a known state when they get re-created.
343 CacheValidGPUMask = GPUMask;
344 }
345#endif
346 }
347
348 bool IsAccumulatingStats();
349 bool IsVisualizePassEnabled(const FViewInfo& View, int32 ViewIndex, EVSMVisualizationPostPass Pass) const;
351
353
358 {
359 public:
362
364
365 // Primitive was removed from the scene
366 void Removed(FPrimitiveSceneInfo* PrimitiveSceneInfo)
367 {
368 AddInvalidation(PrimitiveSceneInfo, EInvalidationCause::Removed);
369 }
370
371 // Primitive moved/transform was updated
372 // NOTE: Cache flags should not be cleared in the pre-pass if there is going to be a post-pass
373 void UpdatedTransform(FPrimitiveSceneInfo* PrimitiveSceneInfo)
374 {
375 AddInvalidation(PrimitiveSceneInfo, EInvalidationCause::Updated);
376 }
377
378 void Added(FPrimitiveSceneInfo* PrimitiveSceneInfo)
379 {
380 AddInvalidation(PrimitiveSceneInfo, EInvalidationCause::Added);
381 }
382
386
387 // Temp filtered array of any cache entries that may need invalidation
389
390 private:
391 enum class EInvalidationCause
392 {
393 Added,
394 Removed,
395 Updated,
396 };
397
398 void AddInvalidation(FPrimitiveSceneInfo* PrimitiveSceneInfo, EInvalidationCause InvalidationCause);
399
400 void AddInvalidation(
401 const FVirtualShadowMapPerLightCacheEntry& CacheEntry,
402 int32 InstanceSceneDataOffset,
403 int32 NumInstanceSceneDataEntries,
405 bool bLightRadiusCulling = false,
406 const FBoxSphereBounds& PrimitiveBounds = FBoxSphereBounds());
407
408 FScene& Scene;
410 };
411
413 FRDGBuilder& GraphBuilder,
414 FSceneUniformBuffer &SceneUniformBuffer,
415 FInvalidatingPrimitiveCollector& InvalidatingPrimitiveCollector);
416
417 uint64 GetGPUSizeBytes(bool bLogSizes) const;
418
419 const FVirtualShadowMapArrayFrameData& GetPrevBuffers() const { return PrevBuffers; }
420
421 uint32 GetStatusFeedbackMessageId() const { return StatusFeedbackSocket.GetMessageId().GetIndex(); }
422
423#if !UE_BUILD_SHIPPING
424 uint32 GetStatsFeedbackMessageId() const { return StatsFeedbackSocket.GetMessageId().IsValid() ? StatsFeedbackSocket.GetMessageId().GetIndex() : INDEX_NONE; }
425#endif
426
427 float GetGlobalResolutionLodBias() const { return GlobalResolutionLodBias; }
428
429 inline FEntryMap::TIterator CreateEntryIterator()
430 {
431 return CacheEntries.CreateIterator();
432 }
433
434 inline FEntryMap::TConstIterator CreateConstEntryIterator() const
435 {
436 return CacheEntries.CreateConstIterator();
437 }
438
439 UE::Renderer::Private::IShadowInvalidatingInstances *GetInvalidatingInstancesInterface() { return &ShadowInvalidatingInstancesImplementation; }
441
442 // NOTE: Can move to private after we remove old invalidations path
444
446private:
447
451 void ProcessRemovedLights(const TBitArray<SceneRenderingAllocator>& RemovedLightMask);
452
455
458 class FShadowInvalidatingInstancesImplementation : public UE::Renderer::Private::IShadowInvalidatingInstances
459 {
460 public:
461 FShadowInvalidatingInstancesImplementation(FVirtualShadowMapArrayCacheManager &InCacheManager) : CacheManager(InCacheManager) {}
462 virtual void AddPrimitive(const FPrimitiveSceneInfo *PrimitiveSceneInfo);
463 virtual void AddInstanceRange(FPersistentPrimitiveIndex PersistentPrimitiveIndex, uint32 InstanceSceneDataOffset, uint32 NumInstanceSceneDataEntries);
464
466 TArray<FVirtualShadowMapInstanceRange> PrimitiveInstancesToInvalidate;
467 };
468
469 struct FInvalidationPassCommon
470 {
471 FVirtualShadowMapUniformParameters* UniformParameters;
474 FRDGBufferRef AllocatedPageRectBounds;
475 };
476
477 FInvalidationPassCommon GetUniformParametersForInvalidation(FRDGBuilder& GraphBuilder, FSceneUniformBuffer &SceneUniformBuffer) const;
478
479 void SetInvalidateInstancePagesParameters(
480 FRDGBuilder& GraphBuilder,
481 const FInvalidationPassCommon& InvalidationPassCommon,
483
484 void UpdateCachePrimitiveAsDynamic(FInvalidatingPrimitiveCollector& InvalidatingPrimitiveCollector);
485
486 // Invalidate instances based on CPU instance ranges. This is used for CPU-based updates like object transform changes, etc.
487 void ProcessInvalidations(FRDGBuilder& GraphBuilder, const FInvalidationPassCommon& InvalidationPassCommon, const FInstanceGPULoadBalancer& Instances) const;
488
489 void ExtractStats(FRDGBuilder& GraphBuilder, FVirtualShadowMapArray &VirtualShadowMapArray);
490
491 // Remove old info used to track logging.
492 void TrimLoggingInfo();
493
495 FVirtualShadowMapUniformParameters PrevUniformParameters;
496
497 // The actual physical texture data is stored here rather than in VirtualShadowMapArray (which is recreated each frame)
498 // This allows us to (optionally) persist cached pages between frames. Regardless of whether caching is enabled,
499 // we store the physical pool here.
500 TRefCountPtr<IPooledRenderTarget> PhysicalPagePool;
501 TRefCountPtr<IPooledRenderTarget> HZBPhysicalPagePoolArray;
502 ETextureCreateFlags PhysicalPagePoolCreateFlags = TexCreate_None;
503 TRefCountPtr<FRDGPooledBuffer> PhysicalPageMetaData;
504 uint32 MaxPhysicalPages = 0;
505
506 // Index the Cache entries by the light ID
507 FEntryMap CacheEntries;
508
509 // Store the last time a primitive caused an invalidation for dynamic/static caching purposes
510 // NOTE: Set bits as dynamic since the container makes it easier to iterate those
511 TBitArray<> CachePrimitiveAsDynamic;
512 // Indexed by PersistentPrimitiveIndex
513 TArray<uint32> LastPrimitiveInvalidatedFrame;
514
515 // Stores stats over frames when activated.
516 TRefCountPtr<FRDGPooledBuffer> AccumulatedStatsBuffer;
517 bool bAccumulatingStats = false;
518 FRHIGPUBufferReadback* GPUBufferReadback = nullptr;
519
520 GPUMessage::FSocket StatusFeedbackSocket;
521
522 // Current global resolution bias (when enabled) based on feedback from page pressure, etc.
523 float GlobalResolutionLodBias = 0.0f;
524 uint32 LastFrameOverPageAllocationBudget = 0;
525
526 // Debug stuff
527#if !UE_BUILD_SHIPPING
528 FDelegateHandle ScreenMessageDelegate;
529 uint32 LoggedOverflowFlags = 0;
531
532 FText GetOverflowMessage(uint32 OverflowTypeIndex) const;
533
534 // Socket for optional stats that are only sent back if enabled
535 GPUMessage::FSocket StatsFeedbackSocket;
536
537 // Stores the last time (wall-clock seconds since app-start) that an non-nanite page area message was logged,
538 TArray<float> LastLoggedPageOverlapAppTime;
539
540 // Map to track non-nanite page area items that are shown on screen
541 struct FLargePageAreaItem
542 {
543 uint32 PageArea;
544 float LastTimeSeen;
545 };
546 TMap<uint32, FLargePageAreaItem> LargePageAreaItems;
547
548 TArray<FString> NPFDiagnosticMessages {};
549 TMap<uint32, uint8> NPFDiagnosticTimer {};
550
551#endif // UE_BUILD_SHIPPING
552
553 FShadowInvalidatingInstancesImplementation ShadowInvalidatingInstancesImplementation;
554
555#if WITH_MGPU
557#endif
558
559 struct FViewData
560 {
561 // For each instance we need to store information over time whether:
562 // Bit vector 0: CacheAsDynamic
563 // Bit vector 1: IsTracked
564 static constexpr int32 NumBitsPerInstance = 2;
565
566 FViewData();
567
568 // Buffer that stores NumBitsPerInstance bits per instance indicating whether it is dynamic of static.
570 };
571 // Indexed by persistent view ID
573 // per instance bit array X NumBitsPerInstance to store the state bits
574 int32 InstanceStateMaskWordStride = 0;
575
576 // Retains a reference to a dummy (single page with mips) such that we don't need to re-clear it every frame when the feature is disabled.
577 // Used to bind as UAV for passes to not have to use permutations.
579};
580
581
583{
585
586public:
588
589 virtual void PreLightsUpdate(FRDGBuilder& GraphBuilder, const FLightSceneChangeSet& LightSceneChangeSet);
590 virtual void PreSceneUpdate(FRDGBuilder& GraphBuilder, const FScenePreUpdateChangeSet& ChangeSet, FSceneUniformBuffer& SceneUniforms) override;
591 virtual void PostSceneUpdate(FRDGBuilder& GraphBuilder, const FScenePostUpdateChangeSet& ChangeSet) override;
592 virtual void PostGPUSceneUpdate(FRDGBuilder& GraphBuilder, FSceneUniformBuffer& SceneUniforms) override;
593
594private:
596
597 const FScenePostUpdateChangeSet* PostUpdateChangeSet = nullptr;
598};
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define FVector
Definition IOSSystemIncludes.h:8
FBoxSphereBounds3d FBoxSphereBounds
Definition MathFwd.h:142
UE::Math::TIntPoint< int64 > FInt64Point
Definition MathFwd.h:120
EPixelFormat
Definition PixelFormat.h:16
#define TexCreate_None
Definition RHIDefinitions.h:1191
ETextureCreateFlags
Definition RHIDefinitions.h:1091
#define DECLARE_SCENE_EXTENSION_UPDATER(ClassName, SceneExtensionClassName)
Definition SceneExtensions.h:390
#define DECLARE_SCENE_EXTENSION(ModuleExport, ClassName)
Definition SceneExtensions.h:384
constexpr uint32 HashCombineFast(uint32 A, uint32 B)
Definition TypeHash.h:74
EVSMVisualizationPostPass
Definition VirtualShadowMapArray.h:285
uint32 GetTypeHash(FVirtualShadowMapCacheKey Key)
Definition VirtualShadowMapCacheManager.h:253
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition IDelegateInstance.h:14
Definition GPUScene.h:217
Definition PrimitiveSceneInfo.h:266
Definition SceneManagement.h:1005
Definition RenderGraphResources.h:1321
Definition RenderGraphBuilder.h:49
Definition RHIGPUReadback.h:116
Definition ScenePrimitiveUpdates.h:129
Definition ScenePrimitiveUpdates.h:116
Definition SceneRendering.h:2023
Definition SceneRendering.h:2080
Definition SceneUniformBuffer.h:137
Definition ScenePrivate.h:2875
Definition Text.h:385
Definition SceneRendering.h:1132
Definition VirtualShadowMapCacheManager.h:358
FInstanceGPULoadBalancer Instances
Definition VirtualShadowMapCacheManager.h:383
TArray< const FVirtualShadowMapPerLightCacheEntry *, SceneRenderingAllocator > CacheEntriesForInvalidation
Definition VirtualShadowMapCacheManager.h:388
void Removed(FPrimitiveSceneInfo *PrimitiveSceneInfo)
Definition VirtualShadowMapCacheManager.h:366
void AddPrimitivesToInvalidate()
Definition VirtualShadowMapCacheManager.cpp:477
void UpdatedTransform(FPrimitiveSceneInfo *PrimitiveSceneInfo)
Definition VirtualShadowMapCacheManager.h:373
TBitArray< SceneRenderingAllocator > RemovedPrimitives
Definition VirtualShadowMapCacheManager.h:385
void Added(FPrimitiveSceneInfo *PrimitiveSceneInfo)
Definition VirtualShadowMapCacheManager.h:378
TBitArray< SceneRenderingAllocator > InvalidatedPrimitives
Definition VirtualShadowMapCacheManager.h:384
Definition VirtualShadowMapCacheManager.h:259
void UpdateCacheValidGPUMask(FRHIGPUMask GPUMask, bool bMergeMask)
Definition VirtualShadowMapCacheManager.h:331
float GetGlobalResolutionLodBias() const
Definition VirtualShadowMapCacheManager.h:427
virtual ISceneExtensionRenderer * CreateRenderer(FSceneRendererBase &InSceneRenderer, const FEngineShowFlags &EngineShowFlags) override
Definition VirtualShadowMapCacheManager.cpp:2397
FRHIGPUMask GetCacheValidGPUMask() const
Definition VirtualShadowMapCacheManager.h:322
void ExtractFrameData(FRDGBuilder &GraphBuilder, FVirtualShadowMapArray &VirtualShadowMapArray, const FSceneRenderer &SceneRenderer, bool bAllowPersistentData)
Definition VirtualShadowMapCacheManager.cpp:1456
void ReallocatePersistentPrimitiveIndices()
Definition VirtualShadowMapCacheManager.cpp:1682
FEntryMap::TConstIterator CreateConstEntryIterator() const
Definition VirtualShadowMapCacheManager.h:434
TInstanceCullingLoadBalancer< SceneRenderingAllocator > FInstanceGPULoadBalancer
Definition VirtualShadowMapCacheManager.h:352
void FreePhysicalPool(FRDGBuilder &GraphBuilder)
Definition VirtualShadowMapCacheManager.cpp:1192
virtual ~FVirtualShadowMapArrayCacheManager()
Definition VirtualShadowMapCacheManager.cpp:1027
static constexpr uint32 MaxStatFrames
Definition VirtualShadowMapCacheManager.h:267
FEntryMap::TIterator CreateEntryIterator()
Definition VirtualShadowMapCacheManager.h:429
TRefCountPtr< FRDGPooledBuffer > GetPhysicalPageMetaData() const
Definition VirtualShadowMapCacheManager.h:283
void ProcessInvalidations(FRDGBuilder &GraphBuilder, FSceneUniformBuffer &SceneUniformBuffer, FInvalidatingPrimitiveCollector &InvalidatingPrimitiveCollector)
Definition VirtualShadowMapCacheManager.cpp:1883
bool IsAccumulatingStats()
Definition VirtualShadowMapCacheManager.cpp:1672
bool IsHZBDataAvailable()
Definition VirtualShadowMapCacheManager.cpp:1275
virtual void InitExtension(FScene &InScene) override
Definition VirtualShadowMapCacheManager.cpp:724
TRefCountPtr< IPooledRenderTarget > GetPhysicalPagePool() const
Definition VirtualShadowMapCacheManager.h:282
void FreeHZBPhysicalPool(FRDGBuilder &GraphBuilder)
Definition VirtualShadowMapCacheManager.cpp:1229
uint32 GetPhysicalMaxWidth()
Definition VirtualShadowMapCacheManager.cpp:1707
TRefCountPtr< IPooledRenderTarget > SetHZBPhysicalPoolSize(FRDGBuilder &GraphBuilder, FIntPoint RequestedSize, int32 RequestedArraySize, const EPixelFormat Format)
Definition VirtualShadowMapCacheManager.cpp:1202
uint64 GetGPUSizeBytes(bool bLogSizes) const
Definition SceneViewState.cpp:417
virtual ISceneExtensionUpdater * CreateUpdater() override
Definition VirtualShadowMapCacheManager.cpp:703
uint32 GetStatsFeedbackMessageId() const
Definition VirtualShadowMapCacheManager.h:424
FRDGBufferRef UploadCachePrimitiveAsDynamic(FRDGBuilder &GraphBuilder) const
Definition VirtualShadowMapCacheManager.cpp:1281
TSharedPtr< FVirtualShadowMapPerLightCacheEntry > FindCreateLightCacheEntry(int32 LightSceneId, uint32 ViewUniqueID, uint32 NumShadowMaps, uint32 TypeIdTag=0u)
Definition VirtualShadowMapCacheManager.cpp:1298
FScreenPassTexture AddVisualizePass(FRDGBuilder &GraphBuilder, const FViewInfo &View, int32 ViewIndex, EVSMVisualizationPostPass Pass, FScreenPassTexture &SceneColor, FScreenPassRenderTarget &Output)
Definition VirtualShadowMapCacheManager.cpp:1043
uint32 GetStatusFeedbackMessageId() const
Definition VirtualShadowMapCacheManager.h:421
static bool ShouldCreateExtension(FScene &InScene)
Definition VirtualShadowMapCacheManager.cpp:698
void SetPhysicalPoolSize(FRDGBuilder &GraphBuilder, FIntPoint RequestedSize, int RequestedArraySize, uint32 MaxPhysicalPages)
Definition VirtualShadowMapCacheManager.cpp:1137
const FVirtualShadowMapArrayFrameData & GetPrevBuffers() const
Definition VirtualShadowMapCacheManager.h:419
bool IsCacheEnabled()
Definition VirtualShadowMapCacheManager.cpp:1256
bool IsCacheDataAvailable()
Definition VirtualShadowMapCacheManager.cpp:1261
UE::Renderer::Private::IShadowInvalidatingInstances * GetInvalidatingInstancesInterface()
Definition VirtualShadowMapCacheManager.h:439
bool IsVisualizePassEnabled(const FViewInfo &View, int32 ViewIndex, EVSMVisualizationPostPass Pass) const
Definition VirtualShadowMapCacheManager.cpp:1034
TMap< FVirtualShadowMapCacheKey, TSharedPtr< FVirtualShadowMapPerLightCacheEntry > > FEntryMap
Definition VirtualShadowMapCacheManager.h:264
void UpdateUnreferencedCacheEntries(FVirtualShadowMapArray &VirtualShadowMapArray)
Definition VirtualShadowMapCacheManager.cpp:1366
Definition VirtualShadowMapArray.h:291
Definition VirtualShadowMapCacheManager.h:43
void UpdateClipmapLevel(const FVirtualShadowMapPerLightCacheEntry &PerLightEntry, FInt64Point PageSpaceLocation, double LevelRadius, double ViewCenterZ, double ViewRadiusZ, double WPODistanceDisabledThreshold)
Definition VirtualShadowMapCacheManager.cpp:202
FVirtualShadowMapHZBMetadata PrevHZBMetadata
Definition VirtualShadowMapCacheManager.h:71
void UpdatePrevHZBMetadata()
Definition VirtualShadowMapCacheManager.h:61
FNextVirtualShadowMapData NextData
Definition VirtualShadowMapCacheManager.h:75
FVirtualShadowMapHZBMetadata CurrentHZBMetadata
Definition VirtualShadowMapCacheManager.h:72
void UpdateHZBMetadata(const FViewMatrices &ViewMatrices, const FIntRect &ViewRect, uint32 TargetLayerIndex)
Definition VirtualShadowMapCacheManager.cpp:286
void SetHZBViewParams(Nanite::FPackedViewParams &OutParams)
Definition VirtualShadowMapCacheManager.cpp:279
FClipmapInfo Clipmap
Definition VirtualShadowMapCacheManager.h:89
FVirtualShadowMapProjectionShaderData ProjectionData
Definition VirtualShadowMapCacheManager.h:79
Definition VirtualShadowMapCacheManager.h:198
void SubmitFeedbackBuffer(FRDGBuilder &GraphBuilder, FRDGBufferRef FeedbackBuffer)
Definition VirtualShadowMapCacheManager.cpp:648
FVirtualShadowMapFeedback()
Definition VirtualShadowMapCacheManager.cpp:629
~FVirtualShadowMapFeedback()
Definition VirtualShadowMapCacheManager.cpp:638
FReadbackInfo GetLatestReadbackBuffer()
Definition VirtualShadowMapCacheManager.cpp:673
Definition VirtualShadowMapCacheManager.cpp:2274
Definition VirtualShadowMapCacheManager.h:583
virtual void PreLightsUpdate(FRDGBuilder &GraphBuilder, const FLightSceneChangeSet &LightSceneChangeSet)
Definition VirtualShadowMapCacheManager.cpp:2047
virtual void PostSceneUpdate(FRDGBuilder &GraphBuilder, const FScenePostUpdateChangeSet &ChangeSet) override
Definition VirtualShadowMapCacheManager.cpp:2142
virtual void PreSceneUpdate(FRDGBuilder &GraphBuilder, const FScenePreUpdateChangeSet &ChangeSet, FSceneUniformBuffer &SceneUniforms) override
Definition VirtualShadowMapCacheManager.cpp:2055
virtual void PostGPUSceneUpdate(FRDGBuilder &GraphBuilder, FSceneUniformBuffer &SceneUniforms) override
Definition VirtualShadowMapCacheManager.cpp:2160
Definition VirtualShadowMapCacheManager.h:93
TArray< FVirtualShadowMapInstanceRange > PrimitiveInstancesToInvalidate
Definition VirtualShadowMapCacheManager.h:174
bool IsInvalidated() const
Definition VirtualShadowMapCacheManager.h:118
FVirtualShadowMapPerLightCacheEntry(int32 MaxPersistentScenePrimitiveIndex, uint32 NumShadowMaps)
Definition VirtualShadowMapCacheManager.h:95
int32 PrevVirtualShadowMapId
Definition VirtualShadowMapCacheManager.h:152
bool IsFullyCached() const
Definition VirtualShadowMapCacheManager.h:107
int32 ScheduledFrameNumber
Definition VirtualShadowMapCacheManager.h:150
void OnPrimitiveRendered(const FPrimitiveSceneInfo *PrimitiveSceneInfo, bool bPrimitiveRevealed)
Definition VirtualShadowMapCacheManager.cpp:1333
void MarkRendered(int32 FrameIndex)
Definition VirtualShadowMapCacheManager.h:116
TArray< FVirtualShadowMapCacheEntry > ShadowMapEntries
Definition VirtualShadowMapCacheManager.h:172
bool IsUncached() const
Definition VirtualShadowMapCacheManager.h:112
int32 RenderedFrameNumber
Definition VirtualShadowMapCacheManager.h:149
bool bReferencedThisRender
Definition VirtualShadowMapCacheManager.h:162
bool bIsDistantLight
Definition VirtualShadowMapCacheManager.h:156
TBitArray RenderedPrimitives
Definition VirtualShadowMapCacheManager.h:169
void UpdateLocal(const FProjectedShadowInitializer &InCacheKey, const FVector &NewLightOrigin, const float NewLightRadius, bool bNewIsDistantLight, bool bForceInvalidate, bool bAllowInvalidation, bool bInUseReceiverMask)
Definition VirtualShadowMapCacheManager.cpp:353
void UpdateClipmap(const FVector &LightDirection, int FirstLevel, bool bForceInvalidate, bool bInUseReceiverMask)
Definition VirtualShadowMapCacheManager.cpp:304
bool bUseReceiverMask
Definition VirtualShadowMapCacheManager.h:157
void MarkScheduled(int32 FrameIndex)
Definition VirtualShadowMapCacheManager.h:120
int32 GetVirtualShadowMapId() const
Definition VirtualShadowMapCacheManager.h:124
void Invalidate()
Definition VirtualShadowMapCacheManager.h:117
void UpdateVirtualShadowMapId(int32 NextVirtualShadowMapId)
Definition VirtualShadowMapCacheManager.cpp:410
uint32 LastReferencedFrameNumber
Definition VirtualShadowMapCacheManager.h:165
bool bIsUncached
Definition VirtualShadowMapCacheManager.h:155
bool ShouldUseReceiverMask() const
Definition VirtualShadowMapCacheManager.h:114
int32 GetLastScheduledFrameNumber() const
Definition VirtualShadowMapCacheManager.h:121
bool AffectsBounds(const FBoxSphereBounds &Bounds) const
Definition VirtualShadowMapCacheManager.h:142
int32 GetPrevVirtualShadowMapId() const
Definition VirtualShadowMapCacheManager.h:125
int32 VirtualShadowMapId
Definition VirtualShadowMapCacheManager.h:153
Definition GPUMessaging.h:40
const FMessageId GetMessageId() const
Definition GPUMessaging.h:62
Definition SceneExtensions.h:69
Definition SceneExtensions.h:45
Definition SceneExtensions.h:24
Definition Array.h:670
void SetNum(SizeType NewNum, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:2308
bool IsValid() const
Definition RenderGraphDefinitions.h:361
IndexType GetIndex() const
Definition RenderGraphDefinitions.h:358
Definition RenderGraphResources.h:251
Definition RefCounting.h:454
Definition SharedPointer.h:692
Definition SparseArray.h:524
Definition SceneRendererInterface.h:24
Definition SkinnedMeshComponent.h:50
@ false
Definition radaudio_common.h:23
Definition ShowFlags.h:56
Definition ScenePrivate.h:2850
static constexpr UE_FORCEINLINE_HINT T Square(const T A)
Definition UnrealMathUtility.h:578
Definition MeshPassProcessor.h:1559
Definition VirtualShadowMapCacheManager.h:236
uint32 Flags
Definition VirtualShadowMapCacheManager.h:237
uint32 MipLevel
Definition VirtualShadowMapCacheManager.h:240
uint32 VirtualShadowMapId
Definition VirtualShadowMapCacheManager.h:239
FUintPoint PageAddress
Definition VirtualShadowMapCacheManager.h:241
uint32 LastRequestedSceneFrameNumber
Definition VirtualShadowMapCacheManager.h:238
Definition MultiGPU.h:33
static GPUMASK_CONSTEXPR FRHIGPUMask GPU0()
Definition MultiGPU.h:186
Definition ScreenPass.h:83
Definition ScreenPass.h:41
Definition SceneView.h:317
Definition VirtualShadowMapCacheManager.h:221
TRefCountPtr< FRDGPooledBuffer > UncachedPageRectBounds
Definition VirtualShadowMapCacheManager.h:225
uint64 GetGPUSizeBytes(bool bLogSizes) const
Definition SceneViewState.cpp:407
TRefCountPtr< IPooledRenderTarget > PageRequestFlags
Definition VirtualShadowMapCacheManager.h:229
TRefCountPtr< FRDGPooledBuffer > ThrottleBuffer
Definition VirtualShadowMapCacheManager.h:231
TRefCountPtr< IPooledRenderTarget > PageTable
Definition VirtualShadowMapCacheManager.h:222
TRefCountPtr< FRDGPooledBuffer > AllocatedPageRectBounds
Definition VirtualShadowMapCacheManager.h:226
TRefCountPtr< FRDGPooledBuffer > ProjectionData
Definition VirtualShadowMapCacheManager.h:227
TRefCountPtr< FRDGPooledBuffer > PhysicalPageLists
Definition VirtualShadowMapCacheManager.h:228
TRefCountPtr< IPooledRenderTarget > PageFlags
Definition VirtualShadowMapCacheManager.h:223
TRefCountPtr< FRDGPooledBuffer > NanitePerformanceFeedback
Definition VirtualShadowMapCacheManager.h:230
Definition VirtualShadowMapCacheManager.h:83
double WPODistanceDisableThresholdSquared
Definition VirtualShadowMapCacheManager.h:87
double ViewCenterZ
Definition VirtualShadowMapCacheManager.h:85
FInt64Point PageSpaceLocation
Definition VirtualShadowMapCacheManager.h:84
double ViewRadiusZ
Definition VirtualShadowMapCacheManager.h:86
Definition VirtualShadowMapCacheManager.h:245
uint32 ShadowTypeId
Definition VirtualShadowMapCacheManager.h:248
bool operator==(const FVirtualShadowMapCacheKey &Other) const
Definition VirtualShadowMapCacheManager.h:250
uint32 LightSceneId
Definition VirtualShadowMapCacheManager.h:247
uint32 ViewUniqueID
Definition VirtualShadowMapCacheManager.h:246
Definition VirtualShadowMapCacheManager.h:204
uint32 Size
Definition VirtualShadowMapCacheManager.h:206
FRHIGPUBufferReadback * Buffer
Definition VirtualShadowMapCacheManager.h:205
Definition VirtualShadowMapCacheManager.h:32
uint32 TargetLayerIndex
Definition VirtualShadowMapCacheManager.h:36
FIntRect ViewRect
Definition VirtualShadowMapCacheManager.h:35
bool bMatricesDirty
Definition VirtualShadowMapCacheManager.h:37
FViewMatrices ViewMatrices
Definition VirtualShadowMapCacheManager.h:34
Definition VirtualShadowMapCacheManager.h:24
FPersistentPrimitiveIndex PersistentPrimitiveIndex
Definition VirtualShadowMapCacheManager.h:25
int32 InstanceSceneDataOffset
Definition VirtualShadowMapCacheManager.h:26
bool bMarkAsDynamic
Definition VirtualShadowMapCacheManager.h:28
int32 NumInstanceSceneDataEntries
Definition VirtualShadowMapCacheManager.h:27
Definition VirtualShadowMapArray.h:100
Definition NaniteShared.h:143
Definition BoxSphereBounds.h:25
TExtent SphereRadius
Definition BoxSphereBounds.h:35
TVector< T > Origin
Definition BoxSphereBounds.h:29