r.VisualizeTexture.AllowBlinking

r.VisualizeTexture.AllowBlinking

#Overview

name: r.VisualizeTexture.AllowBlinking

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.VisualizeTexture.AllowBlinking is to control whether blinking is allowed when visualizing NaN (Not a Number) or inf (infinity) values in textures. This setting is part of Unreal Engine’s rendering system, specifically the texture visualization feature.

This setting variable is primarily used in the RenderCore module of Unreal Engine, as evidenced by its location in the VisualizeTexture.cpp file within the Runtime/RenderCore directory.

The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It is initialized with a default value of 1 (enabled) but can be changed during runtime.

The associated variable CVarAllowBlinking directly interacts with r.VisualizeTexture.AllowBlinking. They share the same value and purpose.

Developers should be aware that this variable affects the visual feedback when debugging or inspecting textures with abnormal values (NaN or inf). When enabled, it allows for a blinking effect that can help highlight these problematic areas in textures.

Best practices when using this variable include:

  1. Keep it enabled (default value of 1) during development and debugging phases to easily spot texture issues.
  2. Consider disabling it (set to 0) if the blinking becomes distracting or irritating during extended debugging sessions.
  3. Be aware that disabling this might make it harder to notice certain texture issues at a glance.

Regarding the associated variable CVarAllowBlinking:

The purpose of CVarAllowBlinking is to provide a programmatic way to access and modify the r.VisualizeTexture.AllowBlinking setting within the C++ code.

It is used in the RenderCore module, specifically in the FVisualizeTexture class, to determine whether to apply the blinking effect when rendering visualized textures.

The value of CVarAllowBlinking is set through the console variable system and can be accessed in the code using GetValueOnRenderThread() method.

CVarAllowBlinking directly interacts with the shader parameters used for texture visualization. Its value is passed to the shader to control the blinking behavior.

Developers should be aware that changes to CVarAllowBlinking will take effect on the render thread, which may not be immediate depending on the current state of the rendering pipeline.

Best practices for using CVarAllowBlinking include:

  1. Access its value using GetValueOnRenderThread() when used in render thread operations.
  2. Consider caching the value if used frequently to avoid repeated calls to GetValueOnRenderThread().
  3. Be mindful of potential performance impacts if querying this value excessively in performance-critical code paths.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/VisualizeTexture.cpp:517

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarAllowBlinking(
	TEXT("r.VisualizeTexture.AllowBlinking"), 1,
	TEXT("Whether to allow blinking when visualizing NaN or inf that can become irritating over time.\n"),
	ECVF_RenderThreadSafe);

enum class EVisualisePSType
{
	Cube = 0,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/VisualizeTexture.cpp:516

Scope: file

Source code excerpt:

}

static TAutoConsoleVariable<int32> CVarAllowBlinking(
	TEXT("r.VisualizeTexture.AllowBlinking"), 1,
	TEXT("Whether to allow blinking when visualizing NaN or inf that can become irritating over time.\n"),
	ECVF_RenderThreadSafe);

enum class EVisualisePSType
{

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/VisualizeTexture.cpp:675

Scope (from outer to inner):

file
function     FRDGTextureRef FVisualizeTexture::AddVisualizeTexturePass

Source code excerpt:

				// w * almost_1 to avoid frac(1) => 0
				PassParameters->VisualizeParam[0] = FVector4f(VisualizeConfig.RGBMul, VisualizeConfig.SingleChannelMul, Add, FracScale * 0.9999f);
				PassParameters->VisualizeParam[1] = FVector4f(CVarAllowBlinking.GetValueOnRenderThread() ? BlinkState : 0.0f, (VisualizeConfig.ShaderOp == EShaderOp::Saturate) ? 1.0f : 0.0f, VisualizeConfig.ArrayIndex, VisualizeConfig.MipIndex);
				PassParameters->VisualizeParam[2] = FVector4f((float)InputValueMapping, 0.0f, VisualizeConfig.SingleChannel);
			}

			FRDGTextureSRV* InputSRV = nullptr;
			FRHISamplerState* PointSampler = TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
			if (InputTexture->Desc.Dimension == ETextureDimension::Texture2DArray)