r.VT.ValidateCompressionOnLoad
r.VT.ValidateCompressionOnLoad
#Overview
name: r.VT.ValidateCompressionOnLoad
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Validates that VT data contains no compression errors when loading from DDCThis is slow, but allows debugging corrupt VT data (and allows recovering from bad DDC)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VT.ValidateCompressionOnLoad is to validate that Virtual Texture (VT) data contains no compression errors when loading from the Derived Data Cache (DDC). This setting is primarily used for debugging and ensuring data integrity in the rendering system, specifically for virtual textures.
This setting variable is part of the Unreal Engine’s rendering system, particularly the virtual texturing subsystem. It is used within the Engine module, as evidenced by its location in the TextureDerivedDataTask.cpp file.
The value of this variable is set through a console variable (CVarVTValidateCompressionOnLoad) with a default value of 0, meaning it is disabled by default. Developers can enable it by setting it to 1 through console commands or configuration files.
The associated variable CVarVTValidateCompressionOnLoad interacts directly with r.VT.ValidateCompressionOnLoad, as they share the same value and purpose.
Developers must be aware that enabling this variable can significantly slow down the loading process of virtual textures. It should only be used when debugging issues related to corrupt virtual texture data or when there are suspicions of problems with the DDC.
Best practices for using this variable include:
- Only enable it when necessary for debugging purposes.
- Be prepared for increased loading times when it’s enabled.
- Use it in conjunction with other debugging tools to isolate issues with virtual texture compression.
- Remember to disable it in production builds to avoid performance impacts.
Regarding the associated variable CVarVTValidateCompressionOnLoad:
This is the actual console variable that controls the r.VT.ValidateCompressionOnLoad setting. It is defined as a TAutoConsoleVariable
The variable is used in the DDC1_FetchAndFillDerivedData function to determine whether to perform validation on the virtual texture data loaded from the DDC. If enabled, it calls the ValidateData function on the VTData object, which checks for compression errors.
Developers should be aware that this variable’s value is accessed using the GetValueOnAnyThread() method, which means it can be safely read from any thread. However, changing its value might not immediately affect ongoing texture loading operations.
When using this variable, developers should:
- Use it in conjunction with logging tools to capture any validation failures.
- Be prepared to handle cases where validation fails and decide on appropriate recovery actions (e.g., rebuilding the texture).
- Consider adding additional error handling or reporting mechanisms when validation fails to aid in debugging efforts.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TextureDerivedDataTask.cpp:37
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarVTValidateCompressionOnLoad(
TEXT("r.VT.ValidateCompressionOnLoad"),
0,
TEXT("Validates that VT data contains no compression errors when loading from DDC")
TEXT("This is slow, but allows debugging corrupt VT data (and allows recovering from bad DDC)")
);
static TAutoConsoleVariable<int32> CVarVTValidateCompressionOnSave(
#Associated Variable and Callsites
This variable is associated with another variable named CVarVTValidateCompressionOnLoad
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TextureDerivedDataTask.cpp:36
Scope: file
Source code excerpt:
#include "VT/VirtualTextureDataBuilder.h"
static TAutoConsoleVariable<int32> CVarVTValidateCompressionOnLoad(
TEXT("r.VT.ValidateCompressionOnLoad"),
0,
TEXT("Validates that VT data contains no compression errors when loading from DDC")
TEXT("This is slow, but allows debugging corrupt VT data (and allows recovering from bad DDC)")
);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TextureDerivedDataTask.cpp:1696
Scope (from outer to inner):
file
function static void DDC1_FetchAndFillDerivedData
Source code excerpt:
}
if (bSucceeded && bForVirtualTextureStreamingBuild && CVarVTValidateCompressionOnLoad.GetValueOnAnyThread())
{
check(DerivedData->VTData);
bSucceeded = DerivedData->VTData->ValidateData(TexturePathName, false);
if (!bSucceeded)
{
UE_LOG(LogTexture, Display, TEXT("Texture %s has invalid cached VT data. The texture will be rebuilt."), *TexturePathName);