r.SupportDepthOnlyIndexBuffers

r.SupportDepthOnlyIndexBuffers

#Overview

name: r.SupportDepthOnlyIndexBuffers

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.SupportDepthOnlyIndexBuffers is to enable or disable the use of depth-only index buffers in Unreal Engine’s rendering system. This setting is primarily related to the rendering optimization for static meshes.

Regarding the associated variable CVarSupportDepthOnlyIndexBuffers:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp:131

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarSupportDepthOnlyIndexBuffers(
	TEXT("r.SupportDepthOnlyIndexBuffers"),
	1,
	TEXT("Enables depth-only index buffers. Saves a little time at the expense of doubling the size of index buffers."),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarSupportReversedIndexBuffers(
	TEXT("r.SupportReversedIndexBuffers"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp:130

Scope: file

Source code excerpt:

	TEXT("If non-zero, mobile setting for MinLOD will be stored in the cooked data for desktop platforms"));

static TAutoConsoleVariable<int32> CVarSupportDepthOnlyIndexBuffers(
	TEXT("r.SupportDepthOnlyIndexBuffers"),
	1,
	TEXT("Enables depth-only index buffers. Saves a little time at the expense of doubling the size of index buffers."),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarSupportReversedIndexBuffers(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp:460

Scope (from outer to inner):

file
function     uint32 FStaticMeshLODResources::FStaticMeshBuffersSize::CalcBuffersSize

Source code excerpt:

{
	// Assumes these two cvars don't change at runtime
	const bool bEnableDepthOnlyIndexBuffer = !!CVarSupportDepthOnlyIndexBuffers.GetValueOnAnyThread();
	const bool bEnableReversedIndexBuffer = !!CVarSupportReversedIndexBuffers.GetValueOnAnyThread();
	return SerializedBuffersSize
		- (bEnableDepthOnlyIndexBuffer ? 0 : DepthOnlyIBSize)
		- (bEnableReversedIndexBuffer ? 0 : ReversedIBsSize);
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp:472

Scope (from outer to inner):

file
function     void FStaticMeshLODResources::SerializeBuffers

Source code excerpt:


	// If the index buffers have already been initialized, do not change the behavior since the RHI resource pointer may have been cached somewhere already.
	const bool bEnableDepthOnlyIndexBuffer = bHasDepthOnlyIndices || (CVarSupportDepthOnlyIndexBuffers.GetValueOnAnyThread() == 1);
	const bool bEnableReversedIndexBuffer = bHasReversedIndices || bHasReversedDepthOnlyIndices || (CVarSupportReversedIndexBuffers.GetValueOnAnyThread() == 1);

	// See if the mesh wants to keep resources CPU accessible
	bool bMeshCPUAcces = OwnerStaticMesh ? OwnerStaticMesh->bAllowCPUAccess : false;

	// Note: this is all derived data, native versioning is not needed, but be sure to bump STATICMESH_DERIVEDDATA_VER when modifying!

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp:598

Scope (from outer to inner):

file
function     void FStaticMeshLODResources::SerializeAvailabilityInfo

Source code excerpt:

	Ar.UsingCustomVersion(FUE5ReleaseStreamObjectVersion::GUID);
	bool bHasAdjacencyInfo = false;
	const bool bEnableDepthOnlyIndexBuffer = !!CVarSupportDepthOnlyIndexBuffers.GetValueOnAnyThread();
	const bool bEnableReversedIndexBuffer = !!CVarSupportReversedIndexBuffers.GetValueOnAnyThread();

	Ar << DepthOnlyNumTriangles;
	uint32 Packed;
#if WITH_EDITOR
	if (Ar.IsSaving())