r.ShaderPrint.MaxWidget

r.ShaderPrint.MaxWidget

#Overview

name: r.ShaderPrint.MaxWidget

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.ShaderPrint.MaxWidget is to set the maximum number of widgets that can be used for shader printing in Unreal Engine’s rendering system. This setting is part of the ShaderPrint functionality, which is likely used for debugging and visualizing shader-related information.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically within the ShaderPrint namespace. This can be seen from the file location and namespace information provided in the callsites.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 32, but can be changed at runtime using console commands or through code.

The associated variable CVarMaxWidgetCount interacts directly with r.ShaderPrint.MaxWidget. They share the same value and purpose. CVarMaxWidgetCount is used in the GetMaxWidgetCount() function to retrieve the current maximum widget count.

Developers must be aware that:

  1. This setting affects the performance and memory usage of the shader printing system.
  2. The value can be changed at runtime, which may impact ongoing rendering operations.
  3. The setting has the ECVF_Cheat and ECVF_RenderThreadSafe flags, indicating it’s intended for debugging/cheat purposes and is safe to modify from the render thread.

Best practices when using this variable include:

  1. Only modify it when necessary for debugging or optimization purposes.
  2. Be mindful of performance implications when increasing the value significantly.
  3. Use in conjunction with other ShaderPrint settings for comprehensive shader debugging.
  4. Reset to default values after debugging to avoid unintended performance impacts in production.

Regarding the associated variable CVarMaxWidgetCount:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:54

Scope (from outer to inner):

file
namespace    ShaderPrint

Source code excerpt:


	static TAutoConsoleVariable<int32> CVarMaxWidgetCount(
		TEXT("r.ShaderPrint.MaxWidget"),
		32,
		TEXT("ShaderPrint max widget count.\n"),
		ECVF_Cheat | ECVF_RenderThreadSafe);

	static TAutoConsoleVariable<int32> CVarMaxLineCount(
		TEXT("r.ShaderPrint.MaxLine"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:53

Scope (from outer to inner):

file
namespace    ShaderPrint

Source code excerpt:

		ECVF_Cheat | ECVF_RenderThreadSafe);

	static TAutoConsoleVariable<int32> CVarMaxWidgetCount(
		TEXT("r.ShaderPrint.MaxWidget"),
		32,
		TEXT("ShaderPrint max widget count.\n"),
		ECVF_Cheat | ECVF_RenderThreadSafe);

	static TAutoConsoleVariable<int32> CVarMaxLineCount(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:150

Scope (from outer to inner):

file
namespace    ShaderPrint
function     static uint32 GetMaxWidgetCount

Source code excerpt:

	static uint32 GetMaxWidgetCount()
	{
		return FMath::Max(CVarMaxWidgetCount.GetValueOnAnyThread() + int32(GCachedShaderPrintMaxRequest.WidgetCount), 0);
	}

	static uint32 GetMaxLineCount()
	{
		return FMath::Max(CVarMaxLineCount.GetValueOnAnyThread() + int32(GCachedShaderPrintMaxRequest.LineCount), 0);
	}