r.ShaderPrint.Zoom.Pixel
r.ShaderPrint.Zoom.Pixel
#Overview
name: r.ShaderPrint.Zoom.Pixel
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of pixels magnified 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.Pixel is to control the number of pixels magnified around the mouse cursor in the ShaderPrint system of Unreal Engine 5. This setting is part of the rendering system, specifically the shader debugging and visualization features.
This setting variable is primarily used within 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 (CVar) system, allowing it to be changed at runtime. It’s initialized with a default value of 16 pixels.
The associated variable CVarDrawZoomPixel interacts directly with r.ShaderPrint.Zoom.Pixel, as they share the same value. This variable is used in the InternalDrawZoom function to set the PixelExtent parameter for the shader zoom functionality.
Developers should be aware that this variable affects the magnification of shader output around the mouse cursor. It’s important to note that the value is clamped between 2 and 128 pixels when used, ensuring it stays within a reasonable range.
Best practices when using this variable include:
- Adjusting it in small increments to find the optimal zoom level for debugging.
- Being mindful of performance implications when setting very large values.
- Using it in conjunction with other ShaderPrint settings for comprehensive shader debugging.
Regarding the associated variable CVarDrawZoomPixel:
The purpose of CVarDrawZoomPixel is to provide a programmatic interface to the r.ShaderPrint.Zoom.Pixel setting within the C++ code of Unreal Engine.
This variable is used directly in the Renderer module, specifically in the ShaderPrint namespace. It’s primarily accessed in the InternalDrawZoom function to set shader parameters.
The value of CVarDrawZoomPixel is set through the CVar system, mirroring the value of r.ShaderPrint.Zoom.Pixel.
CVarDrawZoomPixel interacts with other zoom-related variables like CVarDrawZoomFactor and CVarDrawZoomCorner to control the shader zoom functionality.
Developers should be aware that changes to CVarDrawZoomPixel will directly affect the shader zoom feature. The value is clamped when used, so extremely large or small values will be adjusted to fit within the allowed range.
Best practices for using CVarDrawZoomPixel include:
- Accessing it through the GetValueOnRenderThread() method to ensure thread-safe operations.
- Considering its impact on performance and visual output when modifying its value.
- Using it in conjunction with other shader debugging tools for comprehensive analysis.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:90
Scope (from outer to inner):
file
namespace ShaderPrint
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDrawZoomPixel(
TEXT("r.ShaderPrint.Zoom.Pixel"),
16,
TEXT("Number of pixels magnified around the mouse cursor.\n"),
ECVF_Cheat | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDrawZoomFactor(
TEXT("r.ShaderPrint.Zoom.Factor"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarDrawZoomPixel
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:89
Scope (from outer to inner):
file
namespace ShaderPrint
Source code excerpt:
ECVF_Cheat | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDrawZoomPixel(
TEXT("r.ShaderPrint.Zoom.Pixel"),
16,
TEXT("Number of pixels magnified around the mouse cursor.\n"),
ECVF_Cheat | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDrawZoomFactor(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:1190
Scope (from outer to inner):
file
namespace ShaderPrint
function static void InternalDrawZoom
Source code excerpt:
FShaderZoomCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FShaderZoomCS::FParameters>();
PassParameters->PixelExtent = FMath::Clamp(CVarDrawZoomPixel.GetValueOnRenderThread(), 2, 128);
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);