r.GpuProfilerMaxEventBufferSizeKB
r.GpuProfilerMaxEventBufferSizeKB
#Overview
name: r.GpuProfilerMaxEventBufferSizeKB
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Size of the scratch buffer in kB.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.GpuProfilerMaxEventBufferSizeKB is to control the size of the scratch buffer used by the GPU profiler in Unreal Engine 5. This setting is primarily related to the rendering system, specifically the GPU profiling functionality.
This setting variable is used within the RHI (Rendering Hardware Interface) module of Unreal Engine. It’s referenced in the GpuProfilerTrace.cpp file, which suggests it’s part of the GPU profiling and tracing system.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 32 KB, but can be changed at runtime through console commands or configuration files.
The associated variable CVarGpuProfilerMaxEventBufferSizeKB directly interacts with r.GpuProfilerMaxEventBufferSizeKB. They share the same value and purpose.
Developers should be aware that this variable affects memory allocation for the GPU profiler. Changing this value will impact the amount of memory allocated for the event buffer used in GPU profiling.
Best practices when using this variable include:
- Only increase the value if you’re experiencing buffer overflow issues during GPU profiling.
- Be cautious about setting very large values, as it directly affects memory consumption.
- Monitor performance impact when changing this value, especially on memory-constrained platforms.
Regarding the associated variable CVarGpuProfilerMaxEventBufferSizeKB:
The purpose of CVarGpuProfilerMaxEventBufferSizeKB is to provide a programmatic way to access and modify the r.GpuProfilerMaxEventBufferSizeKB setting within the C++ code.
This variable is used in the RHI module, specifically in the GPU profiling system. It’s defined and used in the GpuProfilerTrace.cpp file.
The value of CVarGpuProfilerMaxEventBufferSizeKB is set when the console variable r.GpuProfilerMaxEventBufferSizeKB is modified. It’s accessed using the GetValueOnRenderThread() method.
CVarGpuProfilerMaxEventBufferSizeKB directly interacts with the memory allocation for the GPU profiler’s event buffer. It’s used to determine the size of the buffer that needs to be allocated.
Developers should be aware that changes to this variable will take effect on the render thread, which may not be immediate depending on the current state of rendering.
Best practices for using CVarGpuProfilerMaxEventBufferSizeKB include:
- Use GetValueOnRenderThread() when accessing the value to ensure thread-safety.
- Be cautious about frequent changes to this value, as it triggers memory reallocation.
- Consider the performance implications of changing this value, especially on platforms with limited memory.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GpuProfilerTrace.cpp:16
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarGpuProfilerMaxEventBufferSizeKB(
TEXT("r.GpuProfilerMaxEventBufferSizeKB"),
32,
TEXT("Size of the scratch buffer in kB."),
ECVF_Default);
struct
#Associated Variable and Callsites
This variable is associated with another variable named CVarGpuProfilerMaxEventBufferSizeKB
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GpuProfilerTrace.cpp:15
Scope: file
Source code excerpt:
{
static TAutoConsoleVariable<int32> CVarGpuProfilerMaxEventBufferSizeKB(
TEXT("r.GpuProfilerMaxEventBufferSizeKB"),
32,
TEXT("Size of the scratch buffer in kB."),
ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GpuProfilerTrace.cpp:78
Scope: file
Source code excerpt:
GCurrentFrame.bActive = true;
int32 NeededSize = CVarGpuProfilerMaxEventBufferSizeKB.GetValueOnRenderThread() * 1024;
if ((GCurrentFrame.MaxEventBufferSize != NeededSize) && (NeededSize > 0))
{
FMemory::Free(GCurrentFrame.EventBuffer);
GCurrentFrame.EventBuffer = (uint8*)FMemory::Malloc(NeededSize);
GCurrentFrame.MaxEventBufferSize = NeededSize;
}