r.ShaderPrint.Zoom.Corner

r.ShaderPrint.Zoom.Corner

#Overview

name: r.ShaderPrint.Zoom.Corner

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.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:

  1. The variable accepts integer values from 0 to 3, each representing a different corner of the screen.
  2. The values correspond to: 0 (top-left), 1 (top-right), 2 (bottom-right), 3 (bottom-left).
  3. This setting affects the render thread, so changes will be reflected in real-time.

Best practices when using this variable include:

  1. Use it in conjunction with other shader print debugging tools for comprehensive analysis.
  2. Be mindful of the corner selection to avoid obscuring important parts of the screen during debugging.
  3. Remember to reset or disable the zoom feature when not actively debugging to maintain normal performance.

Regarding the associated variable CVarDrawZoomCorner:

#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;