r.VT.ValidateCompressionOnSave
r.VT.ValidateCompressionOnSave
#Overview
name: r.VT.ValidateCompressionOnSave
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Validates that VT data contains no compression errors before saving to DDCThis is slow, but allows debugging corrupt VT data
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VT.ValidateCompressionOnSave is to validate that Virtual Texture (VT) data contains no compression errors before saving it to the Derived Data Cache (DDC). This setting is primarily used for debugging and quality assurance in the texture rendering system of Unreal Engine 5.
This setting variable is relied upon by the texture processing subsystem, specifically in the context of derived data generation for textures. It’s part of the Engine module, as evidenced by its location in the Engine/Source/Runtime/Engine directory.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, meaning the validation is off by default. Developers can change this value at runtime or in configuration files.
The associated variable CVarVTValidateCompressionOnSave directly interacts with r.VT.ValidateCompressionOnSave. They share the same value and purpose.
Developers must be aware that enabling this validation (by setting the value to 1) will significantly slow down the texture saving process. As stated in the comment, “This is slow, but allows debugging corrupt VT data”. Therefore, it should primarily be used during development and debugging phases, not in production builds.
Best practices when using this variable include:
- Only enable it when investigating potential issues with Virtual Texture compression.
- Be prepared for longer build times when this validation is enabled.
- Use it in conjunction with other debugging tools to isolate and fix VT compression issues.
- Remember to disable it before creating release builds to avoid unnecessary performance overhead.
Regarding CVarVTValidateCompressionOnSave, it’s the actual C++ variable that controls this functionality. It’s used in the DDC1_BuildTexture function to determine whether to perform the validation. If enabled, it calls the ValidateData method on the VTData object, passing in the texture path name and a boolean flag (true in this case). The result of this validation is then used to ensure the data is not corrupt before storing it in the DDC.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TextureDerivedDataTask.cpp:44
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarVTValidateCompressionOnSave(
TEXT("r.VT.ValidateCompressionOnSave"),
0,
TEXT("Validates that VT data contains no compression errors before saving to DDC")
TEXT("This is slow, but allows debugging corrupt VT data")
);
static TAutoConsoleVariable<int32> CVarForceRetileTextures(
#Associated Variable and Callsites
This variable is associated with another variable named CVarVTValidateCompressionOnSave
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TextureDerivedDataTask.cpp:43
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarVTValidateCompressionOnSave(
TEXT("r.VT.ValidateCompressionOnSave"),
0,
TEXT("Validates that VT data contains no compression errors before saving to DDC")
TEXT("This is slow, but allows debugging corrupt VT data")
);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TextureDerivedDataTask.cpp:772
Scope (from outer to inner):
file
function static void DDC1_BuildTexture
Source code excerpt:
bool bCompressionValid = true;
if (CVarVTValidateCompressionOnSave.GetValueOnAnyThread())
{
bCompressionValid = DerivedData->VTData->ValidateData(TexturePathName, true);
}
if (ensureMsgf(bCompressionValid, TEXT("Corrupt Virtual Texture compression for %s, can't store to DDC"), *TexturePathName))
{