r.GPUCrashDebugging.Aftermath.Markers

r.GPUCrashDebugging.Aftermath.Markers

#Overview

name: r.GPUCrashDebugging.Aftermath.Markers

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.GPUCrashDebugging.Aftermath.Markers is to enable draw event markers in NVIDIA Aftermath dumps for GPU crash debugging. This setting variable is primarily used in the rendering system, specifically for GPU crash debugging when using NVIDIA GPUs.

This setting variable is relied upon by the D3D11RHI and D3D12RHI modules of Unreal Engine, which are responsible for interfacing with DirectX 11 and DirectX 12 respectively. It’s particularly used when initializing the NVIDIA Aftermath GPU crash debugging features.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a read-only console variable, which means it can be set at startup but not changed during runtime.

This variable interacts with other GPU crash debugging variables, such as:

Developers must be aware that this variable is only relevant when using NVIDIA GPUs and when NVIDIA Aftermath is available. It’s specifically used for enhancing GPU crash dumps with draw event markers, which can be crucial for diagnosing rendering issues.

Best practices when using this variable include:

  1. Enable it when investigating GPU crashes or performance issues on NVIDIA hardware.
  2. Use it in conjunction with other Aftermath-related variables for comprehensive crash debugging.
  3. Be aware that enabling this feature may have a slight performance impact, so it’s best used during development and debugging rather than in shipping builds.
  4. Consider enabling it by default in editor builds for easier debugging, as seen in the D3D11 implementation.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/RHI.cpp:1137

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarGPUCrashDebuggingAftermathMarkers(
	TEXT("r.GPUCrashDebugging.Aftermath.Markers"),
	0,
	TEXT("Enable draw event markers in Aftermath dumps"),
	ECVF_ReadOnly
);

static TAutoConsoleVariable<int32> CVarGPUCrashDebuggingAftermathCallstack(

#Loc: <Workspace>/Engine/Source/Runtime/D3D12RHI/Private/D3D12Adapter.cpp:666

Scope (from outer to inner):

file
function     void FD3D12Adapter::CreateRootDevice

Source code excerpt:

		if (IsRHIDeviceNVIDIA() && bAllowVendorDevice)
		{
			static IConsoleVariable* MarkersCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.GPUCrashDebugging.Aftermath.Markers"));
			static IConsoleVariable* CallstackCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.GPUCrashDebugging.Aftermath.Callstack"));
			static IConsoleVariable* ResourcesCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.GPUCrashDebugging.Aftermath.ResourceTracking"));
			static IConsoleVariable* TrackAllCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.GPUCrashDebugging.Aftermath.TrackAll"));

			const bool bEnableMarkers = FParse::Param(FCommandLine::Get(), TEXT("aftermathmarkers")) || (MarkersCVar && MarkersCVar->GetInt());
			const bool bEnableCallstack = FParse::Param(FCommandLine::Get(), TEXT("aftermathcallstack")) || (CallstackCVar && CallstackCVar->GetInt());

#Loc: <Workspace>/Engine/Source/Runtime/Windows/D3D11RHI/Private/Windows/WindowsD3D11Device.cpp:1340

Scope (from outer to inner):

file
function     void FD3D11DynamicRHI::StartNVAftermath

Source code excerpt:

	if (bShouldStart)
	{
		static IConsoleVariable* MarkersCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.GPUCrashDebugging.Aftermath.Markers"));
		static IConsoleVariable* CallstackCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.GPUCrashDebugging.Aftermath.Callstack"));
		static IConsoleVariable* ResourcesCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.GPUCrashDebugging.Aftermath.ResourceTracking"));
		static IConsoleVariable* TrackAllCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.GPUCrashDebugging.Aftermath.TrackAll"));
		
		const bool bEnableInEditor = GIsEditor && !FParse::Param(FCommandLine::Get(), TEXT("nogpucrashdebugging"));
		const bool bEnableMarkers = FParse::Param(FCommandLine::Get(), TEXT("aftermathmarkers")) || (MarkersCVar && MarkersCVar->GetInt()) || bEnableInEditor;