r.D3D.CheckedForTypedUAVs

r.D3D.CheckedForTypedUAVs

#Overview

name: r.D3D.CheckedForTypedUAVs

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 r.D3D.CheckedForTypedUAVs is to control whether typed UAV (Unordered Access View) loads are allowed in Direct3D shaders. This setting is primarily related to the rendering system and shader compilation process in Unreal Engine.

This setting variable is used by the shader compiler subsystem in Unreal Engine. It affects how shaders are compiled for Direct3D platforms, particularly for Windows and Xbox.

The value of this variable is set through the console variable system in Unreal Engine. It can be modified at runtime or set in configuration files.

The associated variable CVarD3DCheckedForTypedUAVs interacts with r.D3D.CheckedForTypedUAVs. They share the same value and purpose.

Developers must be aware that:

  1. This setting affects shader compilation and may impact performance and compatibility.
  2. It’s specifically for Direct3D platforms and may not affect other rendering APIs.
  3. Changing this setting may require shader recompilation to take effect.

Best practices when using this variable include:

  1. Only modify it if you understand the implications for shader compatibility and performance.
  2. Test thoroughly on target platforms after changing this setting.
  3. Consider leaving it at the default value (1) unless there’s a specific need to enable typed UAV loads.

Regarding the associated variable CVarD3DCheckedForTypedUAVs:

  1. It’s used in the same context as r.D3D.CheckedForTypedUAVs.
  2. It’s checked during shader compilation to determine whether to add the CFLAG_AllowTypedUAVLoads compiler flag.
  3. If its value is 0, typed UAV loads will be allowed in shaders.
  4. This variable provides a programmatic way to control the same behavior as the console variable.

When using CVarD3DCheckedForTypedUAVs, developers should follow the same best practices and be aware of the same considerations as with r.D3D.CheckedForTypedUAVs.

#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:2249

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarD3DCheckedForTypedUAVs(
	TEXT("r.D3D.CheckedForTypedUAVs"),
	1,
	TEXT("Whether to disallow usage of typed UAV loads, as they are unavailable in Windows 7 D3D 11.0.\n")
	TEXT(" 0: Allow usage of typed UAV loads.\n")
	TEXT(" 1: Disallow usage of typed UAV loads. (default)"),
	ECVF_ReadOnly);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8186

Scope (from outer to inner):

file
function     void GlobalBeginCompileShader

Source code excerpt:


		{
			static const auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.D3D.CheckedForTypedUAVs"));
			if (CVar && CVar->GetInt() == 0)
			{
				Input.Environment.CompilerFlags.Add(CFLAG_AllowTypedUAVLoads);
			}
		}
	}

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:2248

Scope: file

Source code excerpt:

	ECVF_ReadOnly);

static TAutoConsoleVariable<int32> CVarD3DCheckedForTypedUAVs(
	TEXT("r.D3D.CheckedForTypedUAVs"),
	1,
	TEXT("Whether to disallow usage of typed UAV loads, as they are unavailable in Windows 7 D3D 11.0.\n")
	TEXT(" 0: Allow usage of typed UAV loads.\n")
	TEXT(" 1: Disallow usage of typed UAV loads. (default)"),
	ECVF_ReadOnly);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8180

Scope (from outer to inner):

file
function     void GlobalBeginCompileShader

Source code excerpt:



		if (CVarD3DCheckedForTypedUAVs.GetValueOnAnyThread() == 0)
		{
			Input.Environment.CompilerFlags.Add(CFLAG_AllowTypedUAVLoads);
		}

		{
			static const auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.D3D.CheckedForTypedUAVs"));