DumpPrimitives

DumpPrimitives

#Overview

name: DumpPrimitives

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of DumpPrimitives is to provide a debugging tool for developers to write out all scene primitive names to a CSV file. This functionality is primarily used for analyzing and troubleshooting scene composition in Unreal Engine’s rendering system.

The DumpPrimitives functionality is part of the Renderer module in Unreal Engine, as evidenced by its presence in the ViewDebug.cpp and ViewDebug.h files within the Runtime/Renderer directory.

The value of this variable is set through a console command. The CVarDumpPrimitives console command is defined to trigger the dumping process by setting the bDumpPrimitivesNextFrame flag to true.

This variable interacts with bDumpPrimitivesNextFrame, which is likely a boolean flag that controls whether the primitive dumping should occur on the next frame.

Developers should be aware that using this feature may have performance implications, as it involves writing potentially large amounts of data to a file. It should primarily be used for debugging purposes and not in production builds.

Best practices when using this variable include:

  1. Use it sparingly and only when necessary for debugging scene composition issues.
  2. Be mindful of the performance impact, especially in complex scenes with many primitives.
  3. Analyze the generated CSV file to gain insights into the scene structure and optimize if needed.
  4. Remember to disable the dumping after debugging to avoid unnecessary performance overhead.
  5. Consider using this in conjunction with other debugging tools and methods for a comprehensive analysis of rendering issues.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ViewDebug.cpp:22

Scope: file

Source code excerpt:


static FAutoConsoleCommand CVarDumpPrimitives(
	TEXT("DumpPrimitives"),
	TEXT("Writes out all scene primitive names to a CSV file"),
	FConsoleCommandDelegate::CreateStatic([] { bDumpPrimitivesNextFrame = true; }),
	ECVF_Default);

static FAutoConsoleCommand CVarDrawPrimitiveDebugData(
	TEXT("DumpDetailedPrimitives"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ViewDebug.cpp:188

Scope (from outer to inner):

file
function     void FViewDebugInfo::ProcessPrimitives

Source code excerpt:

void FViewDebugInfo::ProcessPrimitives(FScene* Scene, const FViewInfo& View, const FViewCommands& ViewCommands)
{
	DumpPrimitives(Scene, ViewCommands);

	{
		FRWScopeLock ScopeLock(Lock, SLT_Write);
		bIsOutdated = true;

		if (!bShouldUpdate && !bDumpDetailedPrimitivesNextFrame)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ViewDebug.cpp:237

Scope (from outer to inner):

file
function     void FViewDebugInfo::DumpPrimitives

Source code excerpt:

}

void FViewDebugInfo::DumpPrimitives(FScene* Scene, const FViewCommands& ViewCommands)
{
	if (!bDumpPrimitivesNextFrame)
	{
		return;
	}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Public/ViewDebug.h:88

Scope: file

Source code excerpt:

	RENDERER_API void DisableLiveCapture();

	static RENDERER_API void DumpPrimitives(FScene* Scene, const FViewCommands& ViewCommands);

public:
	RENDERER_API void ProcessPrimitives(FScene* Scene, const FViewInfo& View, const FViewCommands& ViewCommands);

	/**
	 * Writes the currently stored information out to a CSV file.