ForceFloats
ForceFloats
#Overview
name: ForceFloats
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ForceFloats is to control the floating-point precision used in shaders for iOS devices. It is a rendering setting that affects shader compilation and execution on iOS platforms.
This setting variable is primarily used by the iOS-specific rendering system in Unreal Engine. It is part of the IOSRuntimeSettings module, which contains various configuration options for iOS development.
The value of this variable is set in the project settings, specifically under the iOS platform settings in the Unreal Engine editor. It can be accessed and modified through the Project Settings > Platforms > iOS section.
ForceFloats interacts with other iOS-specific rendering settings such as UseFastIntrinsics, EnableMathOptimisations, and IndirectArgumentTier. These settings collectively determine how shaders are compiled and optimized for iOS devices.
Developers must be aware that enabling ForceFloats forces the use of 32-bit floating-point precision in shaders. This can affect both performance and rendering accuracy on iOS devices. It may be necessary for certain visual effects or calculations that require higher precision, but it can also impact performance.
Best practices when using this variable include:
- Only enable it when necessary for specific rendering requirements.
- Test thoroughly on target iOS devices to ensure performance is not significantly impacted.
- Consider the trade-off between precision and performance for your specific use case.
- Use in conjunction with other iOS rendering settings to achieve the desired balance of visual quality and performance.
- Be aware that changing this setting requires a project restart to take effect.
Remember that forcing 32-bit floating-point precision can have implications for shader performance and power consumption on mobile devices, so it should be used judiciously.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:3026, section: [/Script/IOSRuntimeSettings.IOSRuntimeSettings]
- INI Section:
/Script/IOSRuntimeSettings.IOSRuntimeSettings
- Raw value:
True
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8246
Scope (from outer to inner):
file
function void GlobalBeginCompileShader
Source code excerpt:
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("UseFastIntrinsics"), bAllowFastIntrinsics, GEngineIni);
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("EnableMathOptimisations"), bEnableMathOptimisations, GEngineIni);
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("ForceFloats"), bForceFloats, GEngineIni);
GConfig->GetInt(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("IndirectArgumentTier"), IndirectArgumentTier, GEngineIni);
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportAppleA8"), bSupportAppleA8, GEngineIni);
// Force no development shaders on iOS
bAllowDevelopmentShaderCompile = false;
}
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Classes/IOSRuntimeSettings.h:478
Scope (from outer to inner):
file
class class UIOSRuntimeSettings : public UObject
Source code excerpt:
*/
UPROPERTY(EditAnywhere, config, Category=Rendering, meta = (DisplayName = "Force 32bit Floating Point Precision", ConfigRestartRequired = true))
bool ForceFloats;
/**
* Whether to use of Metal shader-compiler's -ffast-math optimisations.
* Fast-Math performs algebraic-equivalent & reassociative optimisations not permitted by the floating point arithmetic standard (IEEE-754).
* These can improve shader performance at some cost to precision and can lead to NaN/INF propagation as they rely on
* shader inputs or variables not containing NaN/INF values. By default fast-math is enabled for performance.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:1821
Scope (from outer to inner):
file
function void ShaderMapAppendKeyString
Source code excerpt:
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("UseFastIntrinsics"), bAllowFastIntrinsics, GEngineIni);
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("EnableMathOptimisations"), bEnableMathOptimisations, GEngineIni);
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("ForceFloats"), bForceFloats, GEngineIni);
GConfig->GetInt(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("IndirectArgumentTier"), IndirectArgumentTier, GEngineIni);
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportAppleA8"), bSupportAppleA8, GEngineIni);
}
if (bAllowFastIntrinsics)
{