UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ReadOnlyCVARCache.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 ReadOnlyCVarCache.h: Cache of read-only console variables used by the renderer
5=============================================================================*/
6
7#pragma once
8#include "RHIShaderPlatform.h"
11
12
14{
15 static void Initialize();
16
17 static inline bool AllowStaticLighting()
18 {
19 checkSlow(bInitialized);
20 #ifdef PROJECT_CVAR_ALLOW_STATIC_LIGHTING
22 #else
23 return bAllowStaticLighting;
24 #endif
25 }
26
28 {
30 {
31 return bEnablePointLightShadows;
32 }
33 else
34 {
35 static FShaderPlatformCachedIniValue<bool> MobileMovablePointLightShadowsIniValue(TEXT("r.Mobile.EnableMovablePointLightsShadows"));
37 }
38 }
39
40 static inline bool EnableStationarySkylight()
41 {
42 return bEnableStationarySkylight;
43 }
44
45 static inline bool EnableLowQualityLightmaps()
46 {
47 return bEnableLowQualityLightmaps;
48 }
49
50 static inline bool SupportSkyAtmosphere()
51 {
52 return bSupportSkyAtmosphere;
53 }
54
55 // Mobile specific
56 static inline bool MobileHDR()
57 {
58 checkSlow(bInitialized);
59 #ifdef PROJECT_CVAR_MOBILE_HDR
61 #else
62 return bMobileHDR;
63 #endif
64 }
65
66 static inline bool MobileSupportsGPUScene()
67 {
68 checkSlow(bInitialized);
69 #ifdef PROJECT_CVAR_MOBILE_SUPPORTS_GPUSCENE
71 #else
72 return bMobileSupportsGPUScene;
73 #endif
74 }
75
77 {
78 return bMobileAllowDistanceFieldShadows;
79 }
80
82 {
83 return bMobileEnableStaticAndCSMShadowReceivers;
84 }
85
87 {
88 return bMobileEnableMovableLightCSMShaderCulling;
89 }
90
92 {
93 return MobileForwardDecalLightingValue;
94 }
95
97 {
98 #if WITH_EDITOR
99 return MobileEarlyZPassIniValue(Platform);
100 #else
101 return MobileEarlyZPassValue;
102 #endif
103 }
104
106 {
107 #if WITH_EDITOR
108 return MobileForwardLocalLightsIniValue(Platform);
109 #elif defined PROJECT_CVAR_MOBILE_FORWARD_LOCALLIGHTS
111 #else
112 return MobileForwardLocalLightsValue;
113 #endif
114 }
115
117 {
118 #if WITH_EDITOR
119 return MobileForwardParticleLightsIniValue(Platform);
120 #elif defined PROJECT_CVAR_MOBILE_FORWARD_PARTICLELIGHTS
122 #else
123 return bMobileForwardParticleLights;
124 #endif
125 }
126
128 {
129 #if WITH_EDITOR
130 return MobileDeferredShadingIniValue(Platform);
131 #elif defined PROJECT_CVAR_MOBILE_DEFERRED_SHADING
133 #else
134 return bMobileDeferredShadingValue;
135 #endif
136 }
137
139 {
140 #if WITH_EDITOR
141 return MobileEnableMovableSpotlightsShadowIniValue(Platform);
142 #else
143 return bMobileEnableMovableSpotlightsShadowValue;
144 #endif
145 }
146
148 {
149 #if WITH_EDITOR
150 return MobileAllowDitheredLODTransitionValueIniValue(Platform);
151 #else
152 return bMobileAllowDitheredLODTransitionValue;
153 #endif
154 }
155
157 {
158 #if WITH_EDITOR
159 return MobileAllowFramebufferFetchIniValue(Platform);
160 #else
161 return bMobileAllowFramebufferFetchValue;
162 #endif
163 }
164
165private:
166 RENDERCORE_API static bool bInitialized;
167
168 RENDERCORE_API static bool bAllowStaticLighting;
169 RENDERCORE_API static bool bEnablePointLightShadows;
170 RENDERCORE_API static bool bEnableStationarySkylight;
171 RENDERCORE_API static bool bEnableLowQualityLightmaps;
172 RENDERCORE_API static bool bSupportSkyAtmosphere;
173
174 // Mobile specific
175 RENDERCORE_API static bool bMobileHDR;
176 RENDERCORE_API static bool bMobileAllowDistanceFieldShadows;
177 RENDERCORE_API static bool bMobileEnableStaticAndCSMShadowReceivers;
178 RENDERCORE_API static bool bMobileEnableMovableLightCSMShaderCulling;
179 RENDERCORE_API static bool bMobileSupportsGPUScene;
180 RENDERCORE_API static int32 MobileEarlyZPassValue;
181 RENDERCORE_API static int32 MobileForwardLocalLightsValue;
182 RENDERCORE_API static bool bMobileForwardParticleLights;
183 RENDERCORE_API static int32 MobileForwardDecalLightingValue;
184 RENDERCORE_API static bool bMobileDeferredShadingValue;
185 RENDERCORE_API static bool bMobileEnableMovableSpotlightsShadowValue;
186 RENDERCORE_API static bool bMobileAllowDitheredLODTransitionValue;
187 RENDERCORE_API static bool bMobileAllowFramebufferFetchValue;
188
189private:
190 RENDERCORE_API static int32 MobileEarlyZPassIniValue(EShaderPlatform Platform);
191 RENDERCORE_API static int32 MobileForwardLocalLightsIniValue(EShaderPlatform Platform);
192 RENDERCORE_API static bool MobileForwardParticleLightsIniValue(EShaderPlatform Platform);
193 RENDERCORE_API static bool MobileDeferredShadingIniValue(EShaderPlatform Platform);
194 RENDERCORE_API static bool MobileEnableMovableSpotlightsShadowIniValue(EShaderPlatform Platform);
195 RENDERCORE_API static bool MobileAllowDitheredLODTransitionValueIniValue(EShaderPlatform Platform);
196 RENDERCORE_API static bool MobileAllowFramebufferFetchIniValue(EShaderPlatform Platform);
197};
198
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define TEXT(x)
Definition Platform.h:1272
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
bool IsMobilePlatform(const FStaticShaderPlatform Platform)
Definition DataDrivenShaderPlatformInfo.h:928
EShaderPlatform
Definition RHIShaderPlatform.h:11
Definition ReadOnlyCVARCache.h:14
static bool MobileDeferredShading(EShaderPlatform Platform)
Definition ReadOnlyCVARCache.h:127
static bool SupportSkyAtmosphere()
Definition ReadOnlyCVARCache.h:50
static int32 MobileForwardLocalLights(EShaderPlatform Platform)
Definition ReadOnlyCVARCache.h:105
static int32 MobileEarlyZPass(EShaderPlatform Platform)
Definition ReadOnlyCVARCache.h:96
static void Initialize()
Definition ReadOnlyCVARCache.cpp:98
static int32 MobileForwardDecalLighting()
Definition ReadOnlyCVARCache.h:91
static bool EnableStationarySkylight()
Definition ReadOnlyCVARCache.h:40
static bool EnableLowQualityLightmaps()
Definition ReadOnlyCVARCache.h:45
static bool MobileAllowFramebufferFetch(EShaderPlatform Platform)
Definition ReadOnlyCVARCache.h:156
static bool MobileEnableStaticAndCSMShadowReceivers()
Definition ReadOnlyCVARCache.h:81
static bool MobileAllowDistanceFieldShadows()
Definition ReadOnlyCVARCache.h:76
static bool MobileAllowDitheredLODTransition(EShaderPlatform Platform)
Definition ReadOnlyCVARCache.h:147
static bool MobileEnableMovableSpotlightsShadow(EShaderPlatform Platform)
Definition ReadOnlyCVARCache.h:138
static bool AllowStaticLighting()
Definition ReadOnlyCVARCache.h:17
static int32 MobileForwardParticleLights(EShaderPlatform Platform)
Definition ReadOnlyCVARCache.h:116
static bool MobileSupportsGPUScene()
Definition ReadOnlyCVARCache.h:66
static bool MobileHDR()
Definition ReadOnlyCVARCache.h:56
static bool MobileEnableMovableLightCSMShaderCulling()
Definition ReadOnlyCVARCache.h:86
static bool EnablePointLightShadows(const FStaticShaderPlatform Platform)
Definition ReadOnlyCVARCache.h:27
Definition ShaderPlatformCachedIniValue.h:14
Definition AndroidStaticShaderPlatform.inl:18