r.ViewHasTileOffsetData

r.ViewHasTileOffsetData

#Overview

name: r.ViewHasTileOffsetData

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

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.ViewHasTileOffsetData is to control the precision of tile offset view data uploaded to the GPU in Unreal Engine’s rendering system. It determines whether to use lower-precision tile offset data or only higher-precision double float values.

This setting variable is primarily used by the rendering system in Unreal Engine. Based on the callsites, it’s utilized in the Renderer module and the shader compilation process within the Engine module.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 in the SceneRendering.cpp file.

The associated variable CVarViewHasTileOffsetData interacts directly with r.ViewHasTileOffsetData. It’s used to retrieve the current value of the setting and determine the behavior in various parts of the code.

Developers must be aware that:

  1. This setting affects shader compilation and rendering performance.
  2. It’s marked as read-only and render thread safe, meaning it shouldn’t be changed frequently during runtime.
  3. Changing this value may require shader recompilation.

Best practices when using this variable include:

  1. Only modify it if you understand the implications on rendering performance and precision.
  2. Consider the target hardware capabilities when deciding whether to use lower or higher precision.
  3. Test thoroughly after changing this setting to ensure it doesn’t negatively impact visual quality or performance.

Regarding the associated variable CVarViewHasTileOffsetData:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:267

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarViewHasTileOffsetData(
	TEXT("r.ViewHasTileOffsetData"),
	1,
	TEXT("1 to upload lower-precision tileoffset view data to gpu, 0 to use only higher-precision double float.\n"),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarPrimitiveHasTileOffsetData(
	TEXT("r.PrimitiveHasTileOffsetData"),

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

Scope (from outer to inner):

file
function     void GenerateInstancedStereoCode

Source code excerpt:

	const TArray<FShaderParametersMetadata::FMember>& StructMembersInstanced = InstancedView->GetMembers();

	static const auto CVarViewHasTileOffsetData = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.ViewHasTileOffsetData"));
	const bool bViewHasTileOffsetData = CVarViewHasTileOffsetData ? (CVarViewHasTileOffsetData->GetValueOnAnyThread() != 0) : false;

	Result = "";
	if (bViewHasTileOffsetData)
	{
		Result +=  "struct ViewStateTileOffsetData\r\n";

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

Scope (from outer to inner):

file
function     void GlobalBeginCompileShader

Source code excerpt:

	}

	static const auto CVarViewHasTileOffsetData = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.ViewHasTileOffsetData"));
	const bool bViewHasTileOffsetData = CVarViewHasTileOffsetData->GetValueOnAnyThread() != 0;
	SET_SHADER_DEFINE_AND_COMPILE_ARGUMENT(Input.Environment, VIEW_HAS_TILEOFFSET_DATA, bViewHasTileOffsetData);

	static const auto CVarPrimitiveHasTileOffsetData = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.PrimitiveHasTileOffsetData"));
	const bool bPrimitiveHasTileOffsetData = CVarPrimitiveHasTileOffsetData->GetValueOnAnyThread() != 0;
	SET_SHADER_DEFINE_AND_COMPILE_ARGUMENT(Input.Environment, PRIMITIVE_HAS_TILEOFFSET_DATA, bPrimitiveHasTileOffsetData);

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
function     void GenerateInstancedStereoCode

Source code excerpt:

	const TArray<FShaderParametersMetadata::FMember>& StructMembersInstanced = InstancedView->GetMembers();

	static const auto CVarViewHasTileOffsetData = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.ViewHasTileOffsetData"));
	const bool bViewHasTileOffsetData = CVarViewHasTileOffsetData ? (CVarViewHasTileOffsetData->GetValueOnAnyThread() != 0) : false;

	Result = "";
	if (bViewHasTileOffsetData)
	{
		Result +=  "struct ViewStateTileOffsetData\r\n";
		Result += "{\r\n";

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

Scope (from outer to inner):

file
function     void GlobalBeginCompileShader

Source code excerpt:

	}

	static const auto CVarViewHasTileOffsetData = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.ViewHasTileOffsetData"));
	const bool bViewHasTileOffsetData = CVarViewHasTileOffsetData->GetValueOnAnyThread() != 0;
	SET_SHADER_DEFINE_AND_COMPILE_ARGUMENT(Input.Environment, VIEW_HAS_TILEOFFSET_DATA, bViewHasTileOffsetData);

	static const auto CVarPrimitiveHasTileOffsetData = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.PrimitiveHasTileOffsetData"));
	const bool bPrimitiveHasTileOffsetData = CVarPrimitiveHasTileOffsetData->GetValueOnAnyThread() != 0;
	SET_SHADER_DEFINE_AND_COMPILE_ARGUMENT(Input.Environment, PRIMITIVE_HAS_TILEOFFSET_DATA, bPrimitiveHasTileOffsetData);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:266

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarViewHasTileOffsetData(
	TEXT("r.ViewHasTileOffsetData"),
	1,
	TEXT("1 to upload lower-precision tileoffset view data to gpu, 0 to use only higher-precision double float.\n"),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarPrimitiveHasTileOffsetData(