GameFeaturePlugin.AllowForceMonolithicShaderLibrary
GameFeaturePlugin.AllowForceMonolithicShaderLibrary
#Overview
name: GameFeaturePlugin.AllowForceMonolithicShaderLibrary
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable to force only searching for monolithic shader libs when possible
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of GameFeaturePlugin.AllowForceMonolithicShaderLibrary is to control the loading behavior of shader libraries in the Game Features system of Unreal Engine 5. Specifically, it allows forcing the engine to search for and use monolithic shader libraries when possible.
This setting variable is primarily used within the Game Features plugin, which is part of Unreal Engine’s runtime module system. It’s referenced in the GameFeaturePluginStateMachine.cpp file, indicating its relevance to the state management of game feature plugins.
The value of this variable is set as a console variable (CVar) with a default value of true. It can be modified at runtime through the console or configuration files.
The associated variable CVarAllowForceMonolithicShaderLibrary directly interacts with this setting. It’s defined as a TAutoConsoleVariable
Developers should be aware that enabling this variable will force the engine to prioritize searching for monolithic shader libraries. This can have implications for shader loading performance and memory usage, especially in projects with complex shader setups or those targeting multiple platforms.
Best practices when using this variable include:
- Understanding the trade-offs between monolithic and non-monolithic shader libraries for your specific project.
- Testing performance with this setting both enabled and disabled to determine the optimal configuration for your game.
- Considering platform-specific implications, as shader compilation and loading can vary across different hardware.
Regarding the associated variable CVarAllowForceMonolithicShaderLibrary:
The purpose of CVarAllowForceMonolithicShaderLibrary is to provide a runtime-configurable way to control the GameFeaturePlugin.AllowForceMonolithicShaderLibrary setting.
This variable is used within the Game Features plugin, specifically in the state machine that manages game feature plugins.
The value of this variable is set when the console variable is initialized, but it can be changed at runtime through console commands or configuration files.
It directly interacts with the bForceMonolithicShaderLibrary flag in the BeginState function of the state machine, determining whether monolithic shader libraries should be forced.
Developers should be aware that this variable provides a way to dynamically control shader library loading behavior, which can be useful for debugging or performance tuning.
Best practices for using this variable include:
- Using it in conjunction with profiling tools to understand its impact on shader loading times and memory usage.
- Documenting any changes to this setting in project configuration to ensure consistency across the development team.
- Considering how changes to this setting might affect different platforms or build configurations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Private/GameFeaturePluginStateMachine.cpp:75
Scope (from outer to inner):
file
namespace UE::GameFeatures
Source code excerpt:
TEXT("Enable to force use of aysnc loading even if normally not allowed"));
static TAutoConsoleVariable<bool> CVarAllowForceMonolithicShaderLibrary(TEXT("GameFeaturePlugin.AllowForceMonolithicShaderLibrary"),
true,
TEXT("Enable to force only searching for monolithic shader libs when possible"));
static TAutoConsoleVariable<bool> CVarForceSyncLoadShaderLibrary(TEXT("GameFeaturePlugin.ForceSyncLoadShaderLibrary"),
true,
TEXT("Enable to force shaderlibs to be opened on the game thread"));
#Associated Variable and Callsites
This variable is associated with another variable named CVarAllowForceMonolithicShaderLibrary
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Private/GameFeaturePluginStateMachine.cpp:75
Scope (from outer to inner):
file
namespace UE::GameFeatures
Source code excerpt:
TEXT("Enable to force use of aysnc loading even if normally not allowed"));
static TAutoConsoleVariable<bool> CVarAllowForceMonolithicShaderLibrary(TEXT("GameFeaturePlugin.AllowForceMonolithicShaderLibrary"),
true,
TEXT("Enable to force only searching for monolithic shader libs when possible"));
static TAutoConsoleVariable<bool> CVarForceSyncLoadShaderLibrary(TEXT("GameFeaturePlugin.ForceSyncLoadShaderLibrary"),
true,
TEXT("Enable to force shaderlibs to be opened on the game thread"));
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Private/GameFeaturePluginStateMachine.cpp:1879
Scope (from outer to inner):
file
function virtual void BeginState
Source code excerpt:
// Assume monolithic shader, will be set to false if chunks are detected
bForceMonolithicShaderLibrary = UE::GameFeatures::CVarAllowForceMonolithicShaderLibrary.GetValueOnGameThread();
TSharedPtr<IInstallBundleManager> BundleManager = IInstallBundleManager::GetPlatformInstallBundleManager();
const FInstallBundlePluginProtocolMetaData& MetaData = StateProperties.ProtocolMetadata.GetSubtype<FInstallBundlePluginProtocolMetaData>();
const TArray<FName>& InstallBundles = MetaData.InstallBundles;