r.VT.RVT.StreamingMips

r.VT.RVT.StreamingMips

#Overview

name: r.VT.RVT.StreamingMips

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.VT.RVT.StreamingMips is to enable or disable streaming mips for Runtime Virtual Textures (RVT) in Unreal Engine’s rendering system. This setting variable is primarily used in the rendering subsystem, specifically for managing virtual textures.

Based on the callsites, this variable is utilized within the Renderer module of Unreal Engine, particularly in the RuntimeVirtualTextureSceneProxy component.

The value of this variable is set using a TAutoConsoleVariable, which means it can be adjusted at runtime through console commands. It is initialized with a default value of 1, indicating that streaming mips for RVT are enabled by default.

The associated variable CVarVTStreamingMips interacts directly with r.VT.RVT.StreamingMips, as they share the same value and purpose. This variable is used to check the current setting and determine whether to enable or disable streaming mips for RVT.

Developers must be aware that changing this variable’s value will trigger a recreation of the render state for affected components. This is evident from the FGlobalComponentRecreateRenderStateContext being created in the console variable delegate.

Best practices when using this variable include:

  1. Consider performance implications when enabling or disabling streaming mips for RVT.
  2. Be cautious when changing this value at runtime, as it will cause a render state recreation.
  3. Use this setting in conjunction with other virtual texturing settings for optimal performance.
  4. Monitor performance metrics when adjusting this setting to ensure it benefits your specific use case.

Regarding the associated variable CVarVTStreamingMips:

The purpose of CVarVTStreamingMips is to provide a programmatic interface to the r.VT.RVT.StreamingMips setting within the C++ code. It allows developers to check the current state of the streaming mips setting and react accordingly in the rendering code.

This variable is used within the Renderer module, specifically in the RuntimeVirtualTextureSceneProxy component.

The value of CVarVTStreamingMips is set indirectly through the r.VT.RVT.StreamingMips console variable.

CVarVTStreamingMips interacts directly with the r.VT.RVT.StreamingMips setting, as they share the same value.

Developers should be aware that this variable is used to control behavior in the rendering code, and changing its value can affect the streaming of mips for Runtime Virtual Textures.

Best practices for using CVarVTStreamingMips include:

  1. Use GetValueOnAnyThread() when accessing the value to ensure thread-safe operations.
  2. Consider the performance implications of frequently checking this variable’s value in performance-critical code paths.
  3. Use this variable in conjunction with other RVT-related settings for comprehensive control over virtual texturing behavior.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/RuntimeVirtualTextureSceneProxy.cpp:16

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarVTStreamingMips(
	TEXT("r.VT.RVT.StreamingMips"),
	1,
	TEXT("Enable streaming mips for RVT"),
	FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable)
	{
		FGlobalComponentRecreateRenderStateContext Context;
	}),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/RuntimeVirtualTextureSceneProxy.cpp:15

Scope: file

Source code excerpt:

#define LOCTEXT_NAMESPACE "VirtualTexture"

static TAutoConsoleVariable<int32> CVarVTStreamingMips(
	TEXT("r.VT.RVT.StreamingMips"),
	1,
	TEXT("Enable streaming mips for RVT"),
	FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable)
	{
		FGlobalComponentRecreateRenderStateContext Context;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/RuntimeVirtualTextureSceneProxy.cpp:78

Scope (from outer to inner):

file
function     FRuntimeVirtualTextureSceneProxy::FRuntimeVirtualTextureSceneProxy

Source code excerpt:

			if (InComponent->IsStreamingLowMips(ShadingPath))
			{
				if (CVarVTStreamingMips.GetValueOnAnyThread() == 0)
				{
#if !UE_BUILD_SHIPPING
					// Notify that streaming texture is turned off.
					OnScreenWarningDelegateHandle = FRendererOnScreenNotification::Get().AddLambda([](FCoreDelegates::FSeverityMessageMap& OutMessages)
					{
						OutMessages.Add(