landscape.EnableGPUCulling
landscape.EnableGPUCulling
#Overview
name: landscape.EnableGPUCulling
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to use landscape GPU culling when it\'s supported. Allows to toggle culling at runtime
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of landscape.EnableGPUCulling is to control whether GPU-based culling is used for landscapes when it’s supported. This setting variable is part of the landscape rendering system in Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the Landscape module, specifically the culling system for landscapes. This can be seen from the file location (LandscapeCulling.cpp) and the namespace (UE::Landscape::Culling) where the variable is used.
The value of this variable is set as a console variable (CVar) with an initial value of 1 (enabled). It can be changed at runtime, as indicated by the comment in the code.
The associated variable CVarLandscapeEnableGPUCulling interacts directly with landscape.EnableGPUCulling. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the performance and rendering of landscapes. Enabling GPU culling can improve performance by reducing the number of landscape components that need to be processed, but it may not be suitable for all hardware or scenarios.
Best practices when using this variable include:
- Testing performance with both enabled and disabled states to determine the optimal setting for your specific project and target hardware.
- Consider disabling it for debugging purposes if you encounter rendering issues with landscapes.
- Be aware that changing this value at runtime may affect performance and visual results.
Regarding the associated variable CVarLandscapeEnableGPUCulling:
The purpose of CVarLandscapeEnableGPUCulling is to provide programmatic access to the landscape.EnableGPUCulling setting within the C++ code.
It is used in the Landscape module, specifically in the culling system for landscapes.
The value of this variable is set when the console variable landscape.EnableGPUCulling is set, as they share the same value.
This variable interacts directly with landscape.EnableGPUCulling and is used in conditional statements to determine whether GPU culling should be performed for landscapes.
Developers should be aware that this variable is accessed using GetValueOnRenderThread(), indicating that it’s designed to be safely read from the render thread.
Best practices for using CVarLandscapeEnableGPUCulling include:
- Always access it using GetValueOnRenderThread() when in render thread code.
- Use it in conjunction with other checks, such as the number of landscapes or other culling-related variables, as seen in the provided code snippets.
- Be cautious when modifying its value, as it can have significant impacts on rendering performance and behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:16
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLandscapeEnableGPUCulling(
TEXT("landscape.EnableGPUCulling"),
1,
TEXT("Whether to use landscape GPU culling when it's supported. Allows to toggle culling at runtime"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarLandscapeEnableGPUCullingShadows(
TEXT("landscape.EnableGPUCullingShadows"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarLandscapeEnableGPUCulling
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:15
Scope: file
Source code excerpt:
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarLandscapeEnableGPUCulling(
TEXT("landscape.EnableGPUCulling"),
1,
TEXT("Whether to use landscape GPU culling when it's supported. Allows to toggle culling at runtime"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarLandscapeEnableGPUCullingShadows(
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:786
Scope (from outer to inner):
file
namespace UE::Landscape::Culling
function void InitMainViews
Source code excerpt:
{
if (GCullingSystem.Landscapes.Num() == 0 ||
CVarLandscapeEnableGPUCulling.GetValueOnRenderThread() == 0)
{
return;
}
QUICK_SCOPE_CYCLE_COUNTER(STAT_LandscapeCulling_InitMainViews);
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:808
Scope (from outer to inner):
file
namespace UE::Landscape::Culling
function void InitShadowViews
Source code excerpt:
{
if (GCullingSystem.Landscapes.Num() == 0 ||
CVarLandscapeEnableGPUCulling.GetValueOnRenderThread() == 0 ||
CVarLandscapeEnableGPUCullingShadows.GetValueOnRenderThread() == 0)
{
return;
}
QUICK_SCOPE_CYCLE_COUNTER(STAT_LandscapeCulling_InitShadowViews);
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:823
Scope (from outer to inner):
file
namespace UE::Landscape::Culling
function bool GetViewArguments
Source code excerpt:
if (LODIndex != 0 ||
GCullingSystem.Landscapes.Num() == 0 ||
CVarLandscapeEnableGPUCulling.GetValueOnRenderThread() == 0)
{
return false;
}
const FCullingEntry* CullingEntryPtr = GCullingSystem.Landscapes.FindByPredicate([LandscapeKey](const FCullingEntry& Other) {
return Other.LandscapeKey == LandscapeKey;