UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DynamicShadowMapChannelBindingHelper.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 DynamicShadowMapChannelBindingHelper.h:
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
10#include "LightSceneInfo.h"
11
12class FLightSceneInfo;
14
15// This is used in forward only
17{
18public:
19
20 // The number of valid dynamic shadowmap channels
21 static const int32 CHANNEL_COUNT = 4;
22 // This is used in GetPriority().
24
26
28 {
29 check(ChannelIndex >= 0 && ChannelIndex < CHANNEL_COUNT);
30 return Channels[ChannelIndex].bIsAvailable;
31 }
32
34 {
35 return AvailableChannelCount > 0;
36 }
37
39 {
40 check(ChannelIndex >= 0 && ChannelIndex < CHANNEL_COUNT);
41 return Channels[ChannelIndex].Lights;
42 }
43
44 void DisableChannel(int32 ChannelIndex);
46
47 // Update channel usage based on the current enabled channels. Channels with light of MaxPriority or more will be disabled.
49
51
52 void SortLightByPriority(int32 ChannelIndex);
53
54private:
55
56 struct FChannelInfo
57 {
58 FChannelInfo() : bIsAvailable(true) {}
59 // Lights currently bound at that channel.
61 // Whether this channel is available for analysis.
62 bool bIsAvailable;
63 };
64
65 FChannelInfo Channels[CHANNEL_COUNT];
66 int32 AvailableChannelCount;
67
68 FORCEINLINE void AddLight(int32 ChannelIndex, FLightSceneInfo* Light)
69 {
70 check(IsChannelEnabled(ChannelIndex) && Light);
71 Channels[ChannelIndex].Lights.Add(Light);
72 }
73
79 static int32 GetPriority(const FLightSceneInfo* Light);
80};
#define FORCEINLINE
Definition AndroidPlatform.h:140
#define check(expr)
Definition AssertionMacros.h:314
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
return true
Definition ExternalRpcRegistry.cpp:601
Definition DynamicShadowMapChannelBindingHelper.h:17
void SortLightByPriority(int32 ChannelIndex)
Definition DynamicShadowMapChannelBindingHelper.cpp:99
static const int32 STATIC_SHADOWING_PRIORITY
Definition DynamicShadowMapChannelBindingHelper.h:23
int32 GetBestAvailableChannel() const
Definition DynamicShadowMapChannelBindingHelper.cpp:73
void UpdateAvailableChannels(const TSparseArray< FLightSceneInfoCompact, TAlignedSparseArrayAllocator< alignof(FLightSceneInfoCompact)> > &Lights, FLightSceneInfo *LightInfo)
Definition DynamicShadowMapChannelBindingHelper.cpp:31
FORCEINLINE bool HasAnyChannelEnabled() const
Definition DynamicShadowMapChannelBindingHelper.h:33
FORCEINLINE bool IsChannelEnabled(int32 ChannelIndex)
Definition DynamicShadowMapChannelBindingHelper.h:27
void DisableChannel(int32 ChannelIndex)
Definition DynamicShadowMapChannelBindingHelper.cpp:8
static const int32 CHANNEL_COUNT
Definition DynamicShadowMapChannelBindingHelper.h:21
FORCEINLINE const TArray< FLightSceneInfo *, TInlineAllocator< 8 > > & GetLights(int32 ChannelIndex) const
Definition DynamicShadowMapChannelBindingHelper.h:38
FDynamicShadowMapChannelBindingHelper()
Definition DynamicShadowMapChannelBindingHelper.h:25
void DisableAllOtherChannels(int32 EnabledChannelIndex)
Definition DynamicShadowMapChannelBindingHelper.cpp:19
Definition LightSceneInfo.h:36
Definition LightSceneInfo.h:208
Definition ContainerAllocationPolicies.h:1392
Definition Array.h:670
Definition SparseArray.h:524
const FName Channels("Channels")
Definition NetworkMetricsDefs.h:64