r.ShaderPrint.Zoom.Corner
r.ShaderPrint.Zoom.Corner
#Overview
name: r.ShaderPrint.Zoom.Corner
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Select in which corner the zoom magnifer is displayed (0:top-left, 1:top-right, 2:bottom-right, 3:bottom-left).\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ShaderPrint.Zoom.Corner is to control the position of the zoom magnifier in the shader print debugging feature of Unreal Engine 5’s rendering system.
This setting variable is primarily used by the rendering system, specifically within the ShaderPrint namespace. It’s part of the shader debugging and visualization tools that Unreal Engine provides for developers.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with an initial value of 3, which corresponds to the bottom-left corner.
The associated variable CVarDrawZoomCorner directly interacts with r.ShaderPrint.Zoom.Corner. They share the same value and purpose.
Developers must be aware that:
- The variable accepts integer values from 0 to 3, each representing a different corner of the screen.
- The values correspond to: 0 (top-left), 1 (top-right), 2 (bottom-right), 3 (bottom-left).
- This setting affects the render thread, so changes will be reflected in real-time.
Best practices when using this variable include:
- Use it in conjunction with other shader print debugging tools for comprehensive analysis.
- Be mindful of the corner selection to avoid obscuring important parts of the screen during debugging.
- Remember to reset or disable the zoom feature when not actively debugging to maintain normal performance.
Regarding the associated variable CVarDrawZoomCorner:
- Its purpose is identical to r.ShaderPrint.Zoom.Corner, serving as the actual console variable that stores and provides the corner value.
- It’s used within the ShaderPrint namespace, specifically in the InternalDrawZoom function.
- The value is retrieved using GetValueOnRenderThread() and clamped between 0 and 3 before use.
- Developers should be aware that changes to this variable will directly affect the zoom magnifier’s position in real-time.
- Best practices include using this variable in combination with other shader print settings for effective debugging and ensuring it’s properly reset after debugging sessions.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:102
Scope (from outer to inner):
file
namespace ShaderPrint
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDrawZoomCorner(
TEXT("r.ShaderPrint.Zoom.Corner"),
3,
TEXT("Select in which corner the zoom magnifer is displayed (0:top-left, 1:top-right, 2:bottom-right, 3:bottom-left).\n"),
ECVF_Cheat | ECVF_RenderThreadSafe);
//////////////////////////////////////////////////////////////////////////////////////////////////
// Global states
#Associated Variable and Callsites
This variable is associated with another variable named CVarDrawZoomCorner
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:101
Scope (from outer to inner):
file
namespace ShaderPrint
Source code excerpt:
ECVF_Cheat | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDrawZoomCorner(
TEXT("r.ShaderPrint.Zoom.Corner"),
3,
TEXT("Select in which corner the zoom magnifer is displayed (0:top-left, 1:top-right, 2:bottom-right, 3:bottom-left).\n"),
ECVF_Cheat | ECVF_RenderThreadSafe);
//////////////////////////////////////////////////////////////////////////////////////////////////
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:1193
Scope (from outer to inner):
file
namespace ShaderPrint
function static void InternalDrawZoom
Source code excerpt:
PassParameters->ZoomFactor = FMath::Clamp(CVarDrawZoomFactor.GetValueOnRenderThread(), 1, 10);
PassParameters->Resolution = OutputTexture.Texture->Desc.Extent;
PassParameters->Corner = FMath::Clamp(CVarDrawZoomCorner.GetValueOnRenderThread(), 0, 3);
PassParameters->Common = ShaderPrintData.UniformBuffer;
PassParameters->InTexture = OutputTexture.Texture;
PassParameters->OutTexture = GraphBuilder.CreateUAV(OutZoomTexture);
const uint32 SrcPixelCount = PassParameters->PixelExtent * 2 + 1;
const uint32 OutPixelCount = PassParameters->ZoomFactor * SrcPixelCount;