GeometryCache.PrefetchSeconds

GeometryCache.PrefetchSeconds

#Overview

name: GeometryCache.PrefetchSeconds

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 GeometryCache.PrefetchSeconds is to control the amount of geometry cache data to preload, expressed in seconds of animation. This setting is used in the Geometry Cache system, which is part of Unreal Engine’s runtime plugins for handling animated geometry.

This setting variable is primarily used in the GeometryCache plugin, specifically in the StreamingGeometryCacheData module. It’s referenced in the StreamingGeometryCacheData.cpp file, which suggests it’s crucial for managing the streaming and prefetching of geometry cache data.

The value of this variable is set as a console variable with a default value of 0.5 seconds. It can be modified at runtime through the console or configuration files.

The associated variable CVarPrefetchSeconds directly interacts with GeometryCache.PrefetchSeconds. They share the same value and purpose.

Developers must be aware that this variable affects the amount of data that is blockingly loaded at component spawn time. A higher value will preload more data, potentially improving performance during playback but increasing initial load times and memory usage. Conversely, a lower value will reduce initial load times but might lead to potential hitches during playback if data isn’t streamed fast enough.

Best practices when using this variable include:

  1. Balancing between smooth playback and initial load times based on your project’s requirements.
  2. Considering the size and complexity of your geometry caches when setting this value.
  3. Profiling your game to find the optimal setting for your specific use case.
  4. Being aware that this setting can affect scalability, as indicated by the ECVF_Scalability flag.

Regarding the associated variable CVarPrefetchSeconds:

The purpose of CVarPrefetchSeconds is identical to GeometryCache.PrefetchSeconds. It’s the actual console variable implementation that controls the prefetch time for geometry caches.

This variable is used directly in the code to determine the amount of data to preload. It’s accessed using the GetValueOnGameThread() method, which suggests it’s designed to be safely read from the game thread.

The value of CVarPrefetchSeconds is set when the console variable is created, with a default of 0.5 seconds. It can be modified at runtime through console commands.

Developers should be aware that changes to this variable will take effect immediately, potentially affecting ongoing geometry cache loads.

Best practices for CVarPrefetchSeconds are the same as for GeometryCache.PrefetchSeconds, as they are essentially the same setting. Additionally, developers should consider using this variable for runtime adjustments and performance tuning, as it’s designed to be modifiable during gameplay.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/GeometryCache/Source/GeometryCache/Private/StreamingGeometryCacheData.cpp:10

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarPrefetchSeconds(
	TEXT("GeometryCache.PrefetchSeconds"),
	0.5,
	TEXT("The amount of data (expressed in seconds of animation) to preload of geometry caches. This is the data blockingly loaded at component spawn time."),
	ECVF_Scalability);

DECLARE_CYCLE_STAT(TEXT("Prefetch Data"), STAT_PrefetchData, STATGROUP_GeometryCache);
DECLARE_DWORD_COUNTER_STAT(TEXT("Outstanding Requests"), STAT_OutstandingRequests, STATGROUP_GeometryCache);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/GeometryCache/Source/GeometryCache/Private/StreamingGeometryCacheData.cpp:9

Scope: file

Source code excerpt:

#include "RenderingThread.h"

static TAutoConsoleVariable<float> CVarPrefetchSeconds(
	TEXT("GeometryCache.PrefetchSeconds"),
	0.5,
	TEXT("The amount of data (expressed in seconds of animation) to preload of geometry caches. This is the data blockingly loaded at component spawn time."),
	ECVF_Scalability);

DECLARE_CYCLE_STAT(TEXT("Prefetch Data"), STAT_PrefetchData, STATGROUP_GeometryCache);

#Loc: <Workspace>/Engine/Plugins/Runtime/GeometryCache/Source/GeometryCache/Private/StreamingGeometryCacheData.cpp:118

Scope (from outer to inner):

file
function     void FStreamingGeometryCacheData::PrefetchData

Source code excerpt:


	// Blocking load half a second of data
	float RequestEndTime = RequestStartTime + Component->GetPlaybackDirection() * CVarPrefetchSeconds.GetValueOnGameThread();
	if (RequestStartTime > RequestEndTime)
	{
		float tmp = RequestEndTime;
		RequestEndTime = RequestStartTime;
		RequestStartTime = tmp;
	}