r.DumpGPU.Test.PrettifyResourceFileNames

r.DumpGPU.Test.PrettifyResourceFileNames

#Overview

name: r.DumpGPU.Test.PrettifyResourceFileNames

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.DumpGPU.Test.PrettifyResourceFileNames is to control the formatting of resource file names when dumping GPU information. It is primarily used for debugging and testing purposes within the rendering system of Unreal Engine 5.

This setting variable is utilized by the RenderCore module, specifically in the DumpGPU functionality. It affects how resource names are formatted when dumping GPU-related information to files.

The value of this variable is set through the Unreal Engine console variable system. It is defined as a TAutoConsoleVariable with an initial value of 0, which means it’s disabled by default.

The associated variable GDumpTestPrettifyResourceFileNames directly interacts with r.DumpGPU.Test.PrettifyResourceFileNames. They share the same value and purpose.

Developers must be aware that enabling this variable (setting it to 1) may increase the likelihood of encountering Windows’ filepath length limitations. This is because it includes the resource name in the file names, potentially making them longer.

Best practices when using this variable include:

  1. Only enable it when necessary for debugging or testing purposes.
  2. Be cautious of potential filepath length issues on Windows systems.
  3. Consider the impact on performance and file size when enabled, as it may generate more detailed file names.

Regarding the associated variable GDumpTestPrettifyResourceFileNames:

The purpose of GDumpTestPrettifyResourceFileNames is identical to r.DumpGPU.Test.PrettifyResourceFileNames. It’s an internal representation of the console variable within the C++ code.

This variable is used directly in the GetUniqueResourceName function within the DumpGPU.cpp file. When enabled, it modifies the resource name formatting to include both the resource name and a unique identifier.

The value of GDumpTestPrettifyResourceFileNames is set and accessed using the GetValueOnRenderThread() method, ensuring thread-safe access in the render thread.

Developers should be aware that this variable’s state affects the behavior of the GetUniqueResourceName function, which is likely used throughout the GPU dumping process.

Best practices for using GDumpTestPrettifyResourceFileNames include:

  1. Access its value using GetValueOnRenderThread() when in render thread context.
  2. Consider the performance implications of calling this function frequently in performance-critical code paths.
  3. Be prepared to handle potentially longer file names in code that processes the dumped GPU information.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/DumpGPU.cpp:145

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


static TAutoConsoleVariable<int32> GDumpTestPrettifyResourceFileNames(
	TEXT("r.DumpGPU.Test.PrettifyResourceFileNames"), 0,
	TEXT("Whether the resource file names should include resource name. May increase the likelyness of running into Windows' filepath limit."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<FString> GDumpGPUDirectoryCVar(
	TEXT("r.DumpGPU.Directory"), TEXT(""),
	TEXT("Directory to dump to."),

#Associated Variable and Callsites

This variable is associated with another variable named GDumpTestPrettifyResourceFileNames. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/DumpGPU.cpp:144

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	ECVF_Default);

static TAutoConsoleVariable<int32> GDumpTestPrettifyResourceFileNames(
	TEXT("r.DumpGPU.Test.PrettifyResourceFileNames"), 0,
	TEXT("Whether the resource file names should include resource name. May increase the likelyness of running into Windows' filepath limit."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<FString> GDumpGPUDirectoryCVar(
	TEXT("r.DumpGPU.Directory"), TEXT(""),

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/DumpGPU.cpp:489

Scope (from outer to inner):

file
function     FString GetUniqueResourceName

Source code excerpt:

	FString GetUniqueResourceName(const FRDGResource* Resource)
	{
		if (GDumpTestPrettifyResourceFileNames.GetValueOnRenderThread())
		{
			FString UniqueResourceName = FString::Printf(TEXT("%s.%s"), Resource->Name, *PtrToString(Resource));
			UniqueResourceName.ReplaceInline(TEXT("/"), TEXT(""));
			UniqueResourceName.ReplaceInline(TEXT("\\"), TEXT(""));
			return UniqueResourceName;
		}