r.RayTracing.AllowPipeline

r.RayTracing.AllowPipeline

#Overview

name: r.RayTracing.AllowPipeline

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.RayTracing.AllowPipeline is to control whether Ray Tracing pipelines are allowed to be used in the rendering system if they are supported by the hardware.

This setting variable is primarily used by the Unreal Engine’s rendering subsystem, specifically within the deferred shading renderer module. It’s an essential part of the ray tracing implementation in Unreal Engine 5.

The value of this variable is set through the console variable system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime using console commands.

The variable interacts closely with GRayTracingAllowPipeline, which is a static integer variable that shares the same value. It’s also used in conjunction with other ray tracing-related variables like CVarRayTracingAllowInline and GRHISupportsRayTracingShaders.

Developers must be aware that this variable affects the rendering pipeline’s behavior. When set to 0, it will prevent the use of ray tracing pipelines even if the hardware supports them. This can be useful for debugging or performance testing.

Best practices when using this variable include:

  1. Leaving it enabled (1) for production builds to take advantage of hardware-supported ray tracing.
  2. Using it in conjunction with other ray tracing settings for fine-tuned control over the rendering pipeline.
  3. Considering disabling it temporarily when debugging rendering issues to isolate problems.

Regarding the associated variable CVarRayTracingAllowPipeline:

The purpose of CVarRayTracingAllowPipeline is to provide a console-accessible way to control the r.RayTracing.AllowPipeline setting.

This variable is part of the console variable system in Unreal Engine, which allows for runtime configuration of engine parameters. It’s used by the rendering subsystem to determine whether ray tracing pipelines should be allowed.

The value of this variable is set through the console variable system, initialized with the value of GRayTracingAllowPipeline (which is 1 by default).

CVarRayTracingAllowPipeline interacts directly with GRayTracingAllowPipeline, effectively providing a console-accessible interface to the same setting.

Developers should be aware that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag.

Best practices for using this variable include:

  1. Using it for runtime tweaking and debugging of ray tracing behavior.
  2. Ensuring that changes to this variable are properly synchronized with the render thread.
  3. Considering the performance implications of enabling or disabling ray tracing pipelines at runtime.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:184

Scope: file

Source code excerpt:

static int32 GRayTracingAllowPipeline = 1;
static TAutoConsoleVariable<int32> CVarRayTracingAllowPipeline(
	TEXT("r.RayTracing.AllowPipeline"),
	GRayTracingAllowPipeline,
	TEXT("Allow use of Ray Tracing pipelines if supported (default=1)."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarRayTracingAsyncBuild(
	TEXT("r.RayTracing.AsyncBuild"),

#Associated Variable and Callsites

This variable is associated with another variable named CVarRayTracingAllowPipeline. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:183

Scope: file

Source code excerpt:


static int32 GRayTracingAllowPipeline = 1;
static TAutoConsoleVariable<int32> CVarRayTracingAllowPipeline(
	TEXT("r.RayTracing.AllowPipeline"),
	GRayTracingAllowPipeline,
	TEXT("Allow use of Ray Tracing pipelines if supported (default=1)."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarRayTracingAsyncBuild(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:3479

Scope (from outer to inner):

file
function     bool ShouldRenderRayTracingEffect

Source code excerpt:


	const bool bAllowPipeline = GRHISupportsRayTracingShaders && 
								CVarRayTracingAllowPipeline.GetValueOnRenderThread() &&
								EnumHasAnyFlags(CompatibilityFlags, ERayTracingPipelineCompatibilityFlags::FullPipeline);

	const bool bAllowInline = GRHISupportsInlineRayTracing && 
							  CVarRayTracingAllowInline.GetValueOnRenderThread() &&
							  EnumHasAnyFlags(CompatibilityFlags, ERayTracingPipelineCompatibilityFlags::Inline);