r.WarpCulling
r.WarpCulling
#Overview
name: r.WarpCulling
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable Warp Culling optimization for platforms that support it.\n 0: Disable (default)\n 1: Enable
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.WarpCulling is to enable or disable the Warp Culling optimization for platforms that support it. This setting is related to the shader compilation and rendering system in Unreal Engine 5.
The Unreal Engine subsystem that primarily relies on this setting variable is the shader compiler, as evident from its usage in ShaderCompiler.cpp and Shader.cpp files.
The value of this variable is set through a console variable (CVar) system, which allows it to be changed at runtime or through configuration files. It is defined as a read-only console variable with default value 0 (disabled).
This variable interacts with the shader compilation process and affects the compiler flags and shader map key generation. When enabled, it adds the CFLAG_WarpCulling flag to the shader compilation environment and appends “_WC” to the shader map key string.
Developers must be aware that this optimization is platform-dependent and may not be supported on all platforms. They should also consider the performance implications of enabling or disabling this feature.
Best practices when using this variable include:
- Only enable it for platforms that support Warp Culling optimization.
- Test the performance impact thoroughly before enabling it in production.
- Consider making it configurable per-project or per-platform rather than using a global setting.
- Document the use of this optimization in project-specific rendering documentation.
- Monitor for any visual artifacts or inconsistencies when enabled, as culling optimizations can sometimes lead to unexpected results.
#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:2273
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarWarpCulling(
TEXT("r.WarpCulling"),
0,
TEXT("Enable Warp Culling optimization for platforms that support it.\n")
TEXT(" 0: Disable (default)\n")
TEXT(" 1: Enable"),
ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:7992
Scope (from outer to inner):
file
function void GlobalBeginCompileShader
Source code excerpt:
}
static FShaderPlatformCachedIniValue<bool> EnableWarpCullingIniValue(TEXT("r.WarpCulling"));
if (EnableWarpCullingIniValue.Get((EShaderPlatform)Target.Platform) == 1)
{
Input.Environment.CompilerFlags.Add(CFLAG_WarpCulling);
}
}
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:1750
Scope (from outer to inner):
file
function void ShaderMapAppendKeyString
Source code excerpt:
KeyString += TEXT("_CBF");
}
static FShaderPlatformCachedIniValue<bool> EnableWarpCullingIniValue(TEXT("r.WarpCulling"));
if (EnableWarpCullingIniValue.Get(Platform) == 1)
{
KeyString += TEXT("_WC");
}
}