r.ShaderPrint.Zoom
r.ShaderPrint.Zoom
#Overview
name: r.ShaderPrint.Zoom
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable zoom magnification around the mouse cursor.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ShaderPrint.Zoom is to enable zoom magnification around the mouse cursor in the shader print system of Unreal Engine 5. This setting is part of the rendering system, specifically the shader debugging and visualization tools.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, as evidenced by its location in the ShaderPrint.cpp file within the Runtime/Renderer/Private directory.
The value of this variable is set through a console variable (CVarDrawZoomEnable) with an initial value of 0 (disabled). It can be changed at runtime through console commands or programmatically.
The associated variable CVarDrawZoomEnable interacts directly with r.ShaderPrint.Zoom, as they share the same value and purpose. This variable is used to check the current state of the zoom feature in the rendering code.
Developers should be aware that this variable is marked with ECVF_Cheat and ECVF_RenderThreadSafe flags. The ECVF_Cheat flag indicates that it’s intended for debugging or development purposes and should not be exposed to end-users. The ECVF_RenderThreadSafe flag means it can be safely accessed from the render thread.
Best practices when using this variable include:
- Only enabling it during development or debugging sessions, not in production builds.
- Being aware of potential performance impacts when enabled, as it adds additional rendering operations.
- Using it in conjunction with other shader print tools for comprehensive shader debugging.
Regarding the associated variable CVarDrawZoomEnable:
The purpose of CVarDrawZoomEnable is to provide a programmatic way to check and control the state of the shader print zoom feature. It’s used internally by the rendering system to determine whether to apply the zoom magnification effect.
This variable is used in the InternalDrawView function within the ShaderPrint namespace, which is part of the rendering pipeline. It’s checked to determine whether to call the InternalDrawZoom function, which presumably applies the zoom effect.
The value of CVarDrawZoomEnable is set through the console variable system and can be changed at runtime.
Developers should be aware that this variable is accessed on the render thread (GetValueOnRenderThread()), which means changes to it will be reflected in the next frame render.
Best practices for using CVarDrawZoomEnable include:
- Ensuring that any modifications to this variable are thread-safe, as it’s accessed on the render thread.
- Using it in conjunction with other shader print settings for a cohesive debugging experience.
- Remembering to disable it when not actively debugging to avoid any unnecessary performance overhead.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:84
Scope (from outer to inner):
file
namespace ShaderPrint
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDrawZoomEnable(
TEXT("r.ShaderPrint.Zoom"),
0,
TEXT("Enable zoom magnification around the mouse cursor.\n"),
ECVF_Cheat | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDrawZoomPixel(
TEXT("r.ShaderPrint.Zoom.Pixel"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarDrawZoomEnable
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:83
Scope (from outer to inner):
file
namespace ShaderPrint
Source code excerpt:
ECVF_Cheat | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDrawZoomEnable(
TEXT("r.ShaderPrint.Zoom"),
0,
TEXT("Enable zoom magnification around the mouse cursor.\n"),
ECVF_Cheat | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDrawZoomPixel(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:1269
Scope (from outer to inner):
file
namespace ShaderPrint
function static void InternalDrawView
Source code excerpt:
// Zoom
const bool bZoom = CVarDrawZoomEnable.GetValueOnRenderThread() > 0;
if (bZoom)
{
InternalDrawZoom(GraphBuilder, ShaderPrintData, OutputTexture);
}
}