r.ShaderPrint.FontSize
r.ShaderPrint.FontSize
#Overview
name: r.ShaderPrint.FontSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
ShaderPrint font size.\n
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ShaderPrint.FontSize is to control the font size used in the ShaderPrint system, which is part of Unreal Engine’s rendering subsystem. This setting variable is specifically designed for debugging and visualization purposes within shaders.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically the ShaderPrint functionality. This can be seen from the file location (Renderer/Private/ShaderPrint.cpp) where the variable is defined and used.
The value of this variable is set as a console variable using TAutoConsoleVariable. It is initialized with a default value of 8 and can be changed at runtime through console commands or programmatically.
This variable interacts with several other variables in the ShaderPrint system, such as CVarFontSpacingX and CVarFontSpacingY, which together define the appearance of the debug text rendered by ShaderPrint.
Developers must be aware that this variable affects the readability and performance of shader debugging output. A larger font size may improve readability but could potentially impact performance or obscure more of the rendered scene.
Best practices when using this variable include:
- Adjusting it in conjunction with font spacing for optimal readability
- Keeping the value reasonable to avoid excessive performance impact
- Considering the target resolution when setting the font size
Regarding the associated variable CVarFontSize:
The purpose of CVarFontSize is to provide a programmatic interface to the r.ShaderPrint.FontSize console variable. It allows C++ code to read and potentially modify the font size setting.
CVarFontSize is used within the Renderer module, specifically in the ShaderPrint namespace, to initialize and update the font size used for shader debugging output.
The value of CVarFontSize is set when the r.ShaderPrint.FontSize console variable is modified, either through console commands or other means of changing console variables.
CVarFontSize interacts directly with the r.ShaderPrint.FontSize console variable, effectively serving as its C++ representation.
Developers should be aware that changes to CVarFontSize will affect all instances of ShaderPrint output. It’s also important to note that the value is clamped to a minimum of 1 when used, as seen in the FShaderPrintSetup constructor.
Best practices for using CVarFontSize include:
- Accessing it through GetValueOnAnyThread() when reading the value
- Avoiding frequent changes to the value, as it may affect performance
- Considering thread safety when modifying the value, as it’s marked with ECVF_RenderThreadSafe
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:30
Scope (from outer to inner):
file
namespace ShaderPrint
Source code excerpt:
static TAutoConsoleVariable<int32> CVarFontSize(
TEXT("r.ShaderPrint.FontSize"),
8,
TEXT("ShaderPrint font size.\n"),
ECVF_Cheat | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarFontSpacingX(
TEXT("r.ShaderPrint.FontSpacingX"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarFontSize
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:29
Scope (from outer to inner):
file
namespace ShaderPrint
Source code excerpt:
ECVF_Cheat | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarFontSize(
TEXT("r.ShaderPrint.FontSize"),
8,
TEXT("ShaderPrint font size.\n"),
ECVF_Cheat | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarFontSpacingX(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:728
Scope (from outer to inner):
file
namespace ShaderPrint
function FShaderPrintSetup::FShaderPrintSetup
Source code excerpt:
ViewRect = InViewRect;
FontSize = FIntPoint(FMath::Max(CVarFontSize.GetValueOnAnyThread(), 1), FMath::Max(CVarFontSize.GetValueOnAnyThread(), 1));
FontSpacing = FIntPoint(FMath::Max(CVarFontSpacingX.GetValueOnAnyThread(), 1), FMath::Max(CVarFontSpacingY.GetValueOnAnyThread(), 1));
MaxCharacterCount = bEnabled ? GetMaxCharacterCount() : 0;
MaxStateCount = bEnabled ? GetMaxWidgetCount() : 0;
MaxLineCount = bEnabled ? GetMaxLineCount() : 0;
MaxTriangleCount = bEnabled ? GetMaxTriangleCount(): 0;
bIsDrawLocked = false;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:746
Scope (from outer to inner):
file
namespace ShaderPrint
function FShaderPrintSetup::FShaderPrintSetup
Source code excerpt:
DPIScale = View.Family->DebugDPIScale;
FontSize = FIntPoint(FMath::Max(CVarFontSize.GetValueOnAnyThread(), 1), FMath::Max(CVarFontSize.GetValueOnAnyThread(), 1));
FontSpacing = FIntPoint(FMath::Max(CVarFontSpacingX.GetValueOnAnyThread(), 1), FMath::Max(CVarFontSpacingY.GetValueOnAnyThread(), 1));
MaxCharacterCount = bEnabled ? GetMaxCharacterCount() : 0;
MaxStateCount = bEnabled ? GetMaxWidgetCount() : 0;
MaxLineCount = bEnabled ? GetMaxLineCount() : 0;
MaxTriangleCount = bEnabled ? GetMaxTriangleCount() : 0;
bIsDrawLocked = View.State ? ((const FSceneViewState*)View.State)->ShaderPrintStateData.bIsLocked : false;