r.ViewHasTileOffsetData
r.ViewHasTileOffsetData
#Overview
name: r.ViewHasTileOffsetData
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
1 to upload lower-precision tileoffset view data to gpu, 0 to use only higher-precision double float.\n
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:
- This setting affects shader compilation and rendering performance.
- It’s marked as read-only and render thread safe, meaning it shouldn’t be changed frequently during runtime.
- Changing this value may require shader recompilation.
Best practices when using this variable include:
- Only modify it if you understand the implications on rendering performance and precision.
- Consider the target hardware capabilities when deciding whether to use lower or higher precision.
- Test thoroughly after changing this setting to ensure it doesn’t negatively impact visual quality or performance.
Regarding the associated variable CVarViewHasTileOffsetData:
- It’s used to access the value of r.ViewHasTileOffsetData throughout the codebase.
- It’s typically used in conditional statements to determine whether to include certain code in shader compilation or to set specific shader defines.
- When working with this variable, always use the GetValueOnAnyThread() method to retrieve its current value, as shown in the code examples.
- Be aware that this variable is often used in conjunction with other rendering-related variables, such as CVarPrimitiveHasTileOffsetData, to configure the overall rendering behavior.
#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(