r.ShaderPipelineCache.SaveBoundPSOLog
r.ShaderPipelineCache.SaveBoundPSOLog
#Overview
name: r.ShaderPipelineCache.SaveBoundPSOLog
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If > 0 then a log of all bound PSOs for this run of the program will be saved to a writable user cache file. Defaults to 0 but is forced on with -logpso.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ShaderPipelineCache.SaveBoundPSOLog is to control the logging of bound Pipeline State Objects (PSOs) during program execution. It is primarily used for debugging and performance optimization in the rendering system of Unreal Engine 5.
This setting variable is part of the RenderCore module, specifically related to the ShaderPipelineCache subsystem. It’s used to manage the caching and logging of PSOs, which are crucial for efficient rendering in modern graphics APIs.
The value of this variable is set through a console variable (CVarPSOFileCacheSaveBoundPSOLog) in the engine’s configuration system. It defaults to 0 (disabled) but can be enabled by setting it to a value greater than 0 or by using the “-logpso” command-line argument.
The associated variable CVarPSOFileCacheSaveBoundPSOLog directly interacts with r.ShaderPipelineCache.SaveBoundPSOLog. They share the same value and purpose.
Developers should be aware that enabling this logging feature may have performance implications, especially in development builds. It’s primarily intended for debugging and optimization purposes, not for use in shipping builds.
Best practices for using this variable include:
- Enable it temporarily when investigating rendering performance issues or unexpected behavior related to PSOs.
- Use it in conjunction with other shader pipeline cache settings for comprehensive debugging.
- Remember to disable it in shipping builds to avoid unnecessary overhead.
- Analyze the generated logs to identify patterns in PSO usage and potential optimization opportunities.
Regarding the associated variable CVarPSOFileCacheSaveBoundPSOLog:
This is a TAutoConsoleVariable
The variable is used in the GetShaderPipelineCacheSaveBoundPSOLog() function to determine whether PSO logging should be enabled. This function checks both the console variable value and the presence of the “-logpso” command-line argument.
Developers should note that this variable is marked as render thread safe (ECVF_RenderThreadSafe), meaning it can be safely accessed from the render thread without causing race conditions.
When working with this variable, developers should consider the same best practices and awareness points as mentioned for r.ShaderPipelineCache.SaveBoundPSOLog, as they are essentially two sides of the same coin in terms of functionality.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ShaderPipelineCache.cpp:123
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarPSOFileCacheSaveBoundPSOLog(
TEXT("r.ShaderPipelineCache.SaveBoundPSOLog"),
(int32)0,
TEXT("If > 0 then a log of all bound PSOs for this run of the program will be saved to a writable user cache file. Defaults to 0 but is forced on with -logpso."),
ECVF_Default | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarPSOFileCacheGameFileMaskEnabled(
#Associated Variable and Callsites
This variable is associated with another variable named CVarPSOFileCacheSaveBoundPSOLog
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ShaderPipelineCache.cpp:122
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarPSOFileCacheSaveBoundPSOLog(
TEXT("r.ShaderPipelineCache.SaveBoundPSOLog"),
(int32)0,
TEXT("If > 0 then a log of all bound PSOs for this run of the program will be saved to a writable user cache file. Defaults to 0 but is forced on with -logpso."),
ECVF_Default | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ShaderPipelineCache.cpp:179
Scope (from outer to inner):
file
function static bool GetShaderPipelineCacheSaveBoundPSOLog
Source code excerpt:
bCmdLineForce = FParse::Param(FCommandLine::Get(), TEXT("logpso"));
}
return GRHISupportsPipelineFileCache && (bCmdLineForce || CVarPSOFileCacheSaveBoundPSOLog.GetValueOnAnyThread() == 1);
}
static bool GetPSOFileCacheSaveUserCache()
{
static const auto CVarPSOFileCacheSaveUserCache = IConsoleManager::Get().FindConsoleVariable(TEXT("r.ShaderPipelineCache.SaveUserCache"));
return GRHISupportsPipelineFileCache && (CVarPSOFileCacheSaveUserCache && CVarPSOFileCacheSaveUserCache->GetInt() > 0);