r.DumpGPU.MaxStagingSize

r.DumpGPU.MaxStagingSize

#Overview

name: r.DumpGPU.MaxStagingSize

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.MaxStagingSize is to control the maximum size of the staging resource used for GPU dumping operations in Unreal Engine 5. This setting is part of the rendering system, specifically the GPU debugging and profiling subsystem.

This setting variable is primarily used in the RenderCore module of Unreal Engine 5, as evidenced by its location in the DumpGPU.cpp file within the Runtime/RenderCore/Private directory.

The value of this variable is set using a TAutoConsoleVariable, which means it can be modified at runtime through the console or configuration files. The default value is set to 64 (MB).

The associated variable GDumpMaxStagingSize directly interacts with r.DumpGPU.MaxStagingSize. They share the same value and purpose.

Developers must be aware that this variable affects the memory usage during GPU dumping operations. Setting it too high might lead to excessive memory consumption, while setting it too low might result in incomplete or truncated dumps for large resources.

Best practices when using this variable include:

  1. Adjusting the value based on the available system memory and the size of resources being dumped.
  2. Monitoring memory usage when performing GPU dumps, especially for large scenes or complex shaders.
  3. Considering the trade-off between dump completeness and memory usage when modifying this value.

Regarding the associated variable GDumpMaxStagingSize:

The purpose of GDumpMaxStagingSize is to provide programmatic access to the r.DumpGPU.MaxStagingSize setting within the C++ code.

It is used in the RenderCore module, specifically in the GPU dumping functionality.

The value of GDumpMaxStagingSize is set by the r.DumpGPU.MaxStagingSize console variable.

GDumpMaxStagingSize interacts directly with r.DumpGPU.MaxStagingSize, serving as its in-code representation.

Developers should be aware that changes to r.DumpGPU.MaxStagingSize will be reflected in GDumpMaxStagingSize, and vice versa.

Best practices for using GDumpMaxStagingSize include:

  1. Accessing its value using the GetValueOnRenderThread() method to ensure thread-safe operations.
  2. Using it to determine the appropriate size for staging resources in GPU dumping operations.
  3. Considering its value when allocating memory for dumping operations to prevent out-of-memory issues.

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


static TAutoConsoleVariable<int32> GDumpMaxStagingSize(
	TEXT("r.DumpGPU.MaxStagingSize"), 64,
	TEXT("Maximum size of stating resource in MB (default=64)."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> GDumpGPUPassParameters(
	TEXT("r.DumpGPU.PassParameters"), 1,
	TEXT("Whether to dump the pass parameters."),

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> GDumpMaxStagingSize(
	TEXT("r.DumpGPU.MaxStagingSize"), 64,
	TEXT("Maximum size of stating resource in MB (default=64)."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> GDumpGPUPassParameters(
	TEXT("r.DumpGPU.PassParameters"), 1,

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

Scope (from outer to inner):

file
function     void AddDumpBufferPass

Source code excerpt:

		if (bDumpResourceBinary && DumpBufferMode == 2)
		{
			const int32 StagingResourceByteSize = bStream ? ByteSize : FMath::Min(ByteSize, GDumpMaxStagingSize.GetValueOnRenderThread() * 1024 * 1024);

			FString DumpFilePath = kResourcesDir / FString::Printf(TEXT("%s.v%s.bin"), *UniqueResourceName, *PtrToString(bIsOutputResource ? Pass : nullptr));

			if (IsUnsafeToDumpResource(StagingResourceByteSize, 1.2f))
			{
				UE_LOG(LogDumpGPU, Warning, TEXT("Not dumping %s because of insuficient memory available for staging buffer."), *DumpFilePath);