r.VolumetricCloud.DisableCompute
r.VolumetricCloud.DisableCompute
#Overview
name: r.VolumetricCloud.DisableCompute
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Do not use compute shader for cloud tracing.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricCloud.DisableCompute is to control whether compute shaders are used for cloud tracing in Unreal Engine’s volumetric cloud rendering system. This setting is part of the rendering system, specifically the volumetric cloud rendering subsystem.
This variable is primarily used in the Renderer module of Unreal Engine, as evidenced by its references in VolumetricCloudRendering.cpp and VolumetricRenderTarget.cpp files.
The value of this variable is set through the console variable system, initialized with a default value of 0. It can be modified at runtime using console commands or through engine configuration files.
This variable interacts with other rendering-related variables and systems:
- It’s used in conjunction with GSupportsEfficientAsyncCompute and CVarVolumetricRenderTargetPreferAsyncCompute to determine if async compute should be used for volumetric render targets.
- It’s checked alongside other conditions like MSAA status and pixel format capabilities to decide whether to use compute shaders for cloud tracing.
Developers should be aware of the following when using this variable:
- Setting it to a non-zero value will disable the use of compute shaders for cloud tracing, potentially affecting performance and visual quality.
- It’s marked with ECVF_Scalability, indicating it’s intended to be used as a scalability option.
- The variable affects both the main cloud rendering and the empty space skipping optimization.
Best practices when using this variable include:
- Only disable compute shaders if there are specific compatibility or performance issues on certain hardware.
- Consider the impact on visual quality and performance when disabling compute shaders for cloud tracing.
- Use in conjunction with other volumetric cloud settings for fine-tuning rendering quality and performance.
Regarding the associated variable CVarVolumetricCloudDisableCompute:
This is the actual console variable object that controls the r.VolumetricCloud.DisableCompute setting. It’s defined as a TAutoConsoleVariable
The purpose of CVarVolumetricCloudDisableCompute is to provide a programmatic interface to the r.VolumetricCloud.DisableCompute setting within the engine’s C++ code. It’s used directly in rendering code to check whether compute shaders should be disabled for cloud tracing.
This variable is primarily used in the VolumetricCloudRendering.cpp file, which is part of the Renderer module.
The value of CVarVolumetricCloudDisableCompute is set when the console variable is registered, and it can be modified at runtime through the console system.
Developers should be aware that this variable is accessed using GetValueOnRenderThread(), ensuring thread-safe access in rendering code.
Best practices for using CVarVolumetricCloudDisableCompute include:
- Always access it using GetValueOnRenderThread() in rendering code to ensure thread safety.
- Consider caching its value if it’s accessed frequently in performance-critical sections of code.
- Use it in conjunction with other rendering conditions to make informed decisions about cloud rendering techniques.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:70
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarVolumetricCloudDisableCompute(
TEXT("r.VolumetricCloud.DisableCompute"), 0,
TEXT("Do not use compute shader for cloud tracing."),
ECVF_Scalability);
////////////////////////////////////////////////////////////////////////// Shadow tracing
static TAutoConsoleVariable<float> CVarVolumetricCloudShadowViewRaySampleMaxCount(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:75
Scope (from outer to inner):
file
function bool IsVolumetricRenderTargetAsyncCompute
Source code excerpt:
{
// TODO remove that when we remove the pixel shading path in 5.0
static auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.VolumetricCloud.DisableCompute"));
const bool bCloudComputePathDisabled = CVar && CVar->GetInt() > 1;
return GSupportsEfficientAsyncCompute && CVarVolumetricRenderTargetPreferAsyncCompute.GetValueOnRenderThread() > 0 && !bCloudComputePathDisabled;
}
static bool ShouldViewComposeVolumetricRenderTarget(const FViewInfo& ViewInfo)
#Associated Variable and Callsites
This variable is associated with another variable named CVarVolumetricCloudDisableCompute
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:69
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarVolumetricCloudDisableCompute(
TEXT("r.VolumetricCloud.DisableCompute"), 0,
TEXT("Do not use compute shader for cloud tracing."),
ECVF_Scalability);
////////////////////////////////////////////////////////////////////////// Shadow tracing
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:237
Scope (from outer to inner):
file
function static bool ShouldUseComputeForCloudTracing
Source code excerpt:
const bool bMSAAEnabled = GetDefaultMSAACount(InFeatureLevel) > 1;
return !CVarVolumetricCloudDisableCompute.GetValueOnRenderThread()
&& UE::PixelFormat::HasCapabilities(PF_FloatRGBA, EPixelFormatCapabilities::TypedUAVLoad)
&& UE::PixelFormat::HasCapabilities(PF_G16R16F, EPixelFormatCapabilities::TypedUAVLoad)
&& !bMSAAEnabled;
}
static bool ShouldUseComputeCloudEmptySpaceSkipping()
{
return !CVarVolumetricCloudDisableCompute.GetValueOnRenderThread() && RHIIsTypedUAVLoadSupported(PF_R16F) && CVarVolumetricCloudEmptySpaceSkipping.GetValueOnRenderThread() > 0;
}
bool ShouldRenderVolumetricCloud(const FScene* Scene, const FEngineShowFlags& EngineShowFlags)
{
if (Scene && Scene->HasVolumetricCloud() && EngineShowFlags.Atmosphere && EngineShowFlags.Cloud)
{