landscape.SupportGPUCulling

landscape.SupportGPUCulling

#Overview

name: landscape.SupportGPUCulling

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of landscape.SupportGPUCulling is to control whether GPU-based culling is supported for landscape rendering in Unreal Engine 5. This setting is primarily used in the landscape rendering system to optimize performance by potentially reducing the number of landscape components that need to be processed and rendered.

This setting variable is primarily utilized by the Landscape module of Unreal Engine 5, specifically within the landscape culling subsystem. The references are found in the LandscapeCulling.cpp file, which is part of the Landscape runtime.

The value of this variable is set as a console variable (CVar) with a default value of 1, indicating that GPU culling for landscapes is supported by default. It can be modified through the console or configuration files.

This variable interacts with other landscape-related variables, particularly “landscape.EnableGPUCulling”, which is defined right after it in the source code. While “SupportGPUCulling” determines if the feature is available, “EnableGPUCulling” likely controls whether it’s actually used.

Developers should be aware that this variable is marked as read-only and render thread safe (ECVF_ReadOnly | ECVF_RenderThreadSafe). This means it cannot be changed at runtime and is designed to be set before the engine initializes.

Best practices when using this variable include:

  1. Ensure it’s set appropriately for your target platforms, as GPU culling support may vary.
  2. Consider the impact on shader compilation, as it affects vertex factory permutations.
  3. Be aware of its interaction with other rendering features like Virtual Shadow Maps and Lumen, which may not be compatible with landscape GPU culling.
  4. Test performance with and without GPU culling enabled to determine the optimal setting for your specific use case.
  5. Remember that changing this setting may require engine recompilation due to its impact on shader permutations.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Android/AndroidEngine.ini:104, section: [/Script/Engine.RendererSettings]

Location: <Workspace>/Engine/Config/IOS/BaseIOSEngine.ini:22, section: [/Script/Engine.RendererSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:10

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLandscapeSupportCulling(
	TEXT("landscape.SupportGPUCulling"),
	1,
	TEXT("Whether to support landscape GPU culling"),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarLandscapeEnableGPUCulling(
	TEXT("landscape.EnableGPUCulling"),

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:114

Scope (from outer to inner):

file
function     bool FLandscapeTileVertexFactory::ShouldCompilePermutation

Source code excerpt:

bool FLandscapeTileVertexFactory::ShouldCompilePermutation(const FVertexFactoryShaderPermutationParameters& Parameters)
{
	static FShaderPlatformCachedIniValue<int32> LandscapeSupportCullingIniValue(TEXT("landscape.SupportGPUCulling"));
	return FLandscapeVertexFactory::ShouldCompilePermutation(Parameters) && LandscapeSupportCullingIniValue.Get(Parameters.Platform) != 0;
}

void FLandscapeTileVertexFactory::ModifyCompilationEnvironment(const FVertexFactoryShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
{
	FLandscapeVertexFactory::ModifyCompilationEnvironment(Parameters, OutEnvironment);

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:181

Scope (from outer to inner):

file
namespace    UE::Landscape::Culling
function     bool UseCulling

Source code excerpt:

{
	static FLumenCVarsState LumenCVarsState;
	static FShaderPlatformCachedIniValue<int32> LandscapeSupportCullingIniValue(TEXT("landscape.SupportGPUCulling"));
	
	return 
		LandscapeSupportCullingIniValue.Get(Platform) != 0 &&
		// These features require VF PrimitiveID support which is not possible with culling VF atm
		// Note that VSM and Lumen test includes runtime logic, so this function can't be used in cook time decisions
		!UseVirtualShadowMaps(Platform, GMaxRHIFeatureLevel) &&

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:357

Scope (from outer to inner):

file
namespace    UE::Landscape::Culling
function     static bool ShouldCompilePermutation

Source code excerpt:

	static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
	{
		static FShaderPlatformCachedIniValue<int32> LandscapeSupportCullingIniValue(TEXT("landscape.SupportGPUCulling"));
		return LandscapeSupportCullingIniValue.Get(Parameters.Platform) != 0;
	}

	static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
	{
		FGlobalShader::ModifyCompilationEnvironment(Parameters, OutEnvironment);