r.TextureProfiler.EnableTextureCSV

r.TextureProfiler.EnableTextureCSV

#Overview

name: r.TextureProfiler.EnableTextureCSV

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.TextureProfiler.EnableTextureCSV is to enable CSV profiler output for all textures in Unreal Engine 5. This setting variable is specifically used for texture profiling and does not include render targets.

This setting variable is primarily used in the RHI (Rendering Hardware Interface) module of Unreal Engine 5, specifically within the texture profiling system. It’s part of the engine’s performance monitoring and optimization tools.

The value of this variable is set as a console variable (CVar) with a default value of true. It can be changed at runtime through the console or configuration files.

The associated variable CVarTextureProfilerEnableTextureCSV interacts directly with r.TextureProfiler.EnableTextureCSV. They share the same value and are used interchangeably in the code.

Developers should be aware that:

  1. This variable affects the output of texture profiling data to CSV files.
  2. It’s specifically for textures and doesn’t include render targets (a separate variable exists for render targets).
  3. Enabling this might have a small performance impact due to the additional profiling overhead.

Best practices when using this variable include:

  1. Enable it when you need to analyze texture usage and memory consumption in your project.
  2. Disable it in shipping builds to avoid unnecessary overhead.
  3. Use in conjunction with other profiling tools to get a comprehensive view of texture performance.

Regarding the associated variable CVarTextureProfilerEnableTextureCSV:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarTextureProfilerEnableTextureCSV(
	TEXT("r.TextureProfiler.EnableTextureCSV"),
	true,
	TEXT("True to enable csv profiler output for all textures.  Does not include render targets."));

static TAutoConsoleVariable<bool> CVarTextureProfilerEnableRenderTargetCSV(
	TEXT("r.TextureProfiler.EnableRenderTargetCSV"),
	true,

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	TEXT("The minimum combined size for render targets to be reported.  All combined sizes less than this threshold will be reported as Other."));

static TAutoConsoleVariable<bool> CVarTextureProfilerEnableTextureCSV(
	TEXT("r.TextureProfiler.EnableTextureCSV"),
	true,
	TEXT("True to enable csv profiler output for all textures.  Does not include render targets."));

static TAutoConsoleVariable<bool> CVarTextureProfilerEnableRenderTargetCSV(
	TEXT("r.TextureProfiler.EnableRenderTargetCSV"),

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

Scope (from outer to inner):

file
function     void FTextureProfiler::Update

Source code excerpt:

	check(IsInRenderingThread());

	if (FCsvProfiler::Get()->IsCapturing_Renderthread() && !CVarTextureProfilerEnableRenderTargetCSV.GetValueOnAnyThread() && !CVarTextureProfilerEnableTextureCSV.GetValueOnAnyThread())
	{
		return;
	}

	FScopeLock Lock(&TextureMapCS);
	

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

Scope (from outer to inner):

file
function     void FTextureProfiler::Update

Source code excerpt:

		}

		ReportTextureStat(CVarTextureProfilerEnableTextureCSV, Pair.Value.GetTextureNameString(), CSV_CATEGORY_INDEX(TextureProfiler), ToMB(Pair.Value.PeakSize), ECsvCustomStatOp::Set);
		ReportTextureStat(CVarTextureProfilerEnableTextureCSV, Pair.Value.GetTextureNameString(), CSV_CATEGORY_INDEX(TextureWasteProfiler), ToMB(Pair.Value.AllocationWaste), ECsvCustomStatOp::Set);

		Pair.Value.ResetPeakSize();
	}

	ReportTextureStat(CVarTextureProfilerEnableRenderTargetCSV, "Total", CSV_CATEGORY_INDEX(RenderTargetProfiler), ToMB(TotalRenderTargetSize.PeakSize), ECsvCustomStatOp::Set);
	ReportTextureStat(CVarTextureProfilerEnableRenderTargetCSV, "Total", CSV_CATEGORY_INDEX(RenderTargetWasteProfiler), ToMB(TotalRenderTargetSize.AllocationWaste), ECsvCustomStatOp::Set);

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

Scope (from outer to inner):

file
function     void FTextureProfiler::Update

Source code excerpt:

	ReportTextureStat(CVarTextureProfilerEnableRenderTargetCSV, "Other", CSV_CATEGORY_INDEX(RenderTargetWasteProfiler), ToMB(OtherRenderTargetSizes.AllocationWaste), ECsvCustomStatOp::Set);

	ReportTextureStat(CVarTextureProfilerEnableTextureCSV, "Total", CSV_CATEGORY_INDEX(TextureProfiler), ToMB(TotalTextureSize.PeakSize), ECsvCustomStatOp::Set);
	ReportTextureStat(CVarTextureProfilerEnableTextureCSV, "Total", CSV_CATEGORY_INDEX(TextureWasteProfiler), ToMB(TotalTextureSize.AllocationWaste), ECsvCustomStatOp::Set);
	ReportTextureStat(CVarTextureProfilerEnableTextureCSV, "Other", CSV_CATEGORY_INDEX(TextureProfiler), ToMB(OtherTextureSizes.PeakSize), ECsvCustomStatOp::Set);
	ReportTextureStat(CVarTextureProfilerEnableTextureCSV, "Other", CSV_CATEGORY_INDEX(TextureWasteProfiler), ToMB(OtherTextureSizes.AllocationWaste), ECsvCustomStatOp::Set);

	TotalRenderTargetSize.ResetPeakSize();
	TotalTextureSize.ResetPeakSize();

#endif //CSVPROFILERTRACE_ENABLED
}