r.Vulkan.AlwaysWriteDS
r.Vulkan.AlwaysWriteDS
#Overview
name: r.Vulkan.AlwaysWriteDS
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Vulkan.AlwaysWriteDS is to control whether descriptors should always be written in the Vulkan rendering backend of Unreal Engine 5. This setting is primarily used for debugging and development purposes in the Vulkan RHI (Rendering Hardware Interface) subsystem.
This setting variable is utilized by the Vulkan RHI module of Unreal Engine 5, specifically in the pipeline state management component.
The value of this variable is set through the console variable system, as evidenced by its declaration as a TAutoConsoleVariable. It’s initialized with a default value of 0, meaning it’s disabled by default.
The associated variable GAlwaysWriteDS interacts directly with r.Vulkan.AlwaysWriteDS. They share the same value, and GAlwaysWriteDS is used to access the setting’s value in the code.
Developers must be aware that this variable is only available in Debug and Development builds (UE_BUILD_DEBUG || UE_BUILD_DEVELOPMENT). It’s not accessible in shipping or test builds, which is a common practice for debug-oriented settings.
Best practices when using this variable include:
- Only enable it when necessary for debugging descriptor set issues in Vulkan.
- Be aware of potential performance implications when enabled, as it forces descriptor writes that might otherwise be optimized out.
- Remember to disable it before final builds or performance testing, as it’s meant for development use only.
Regarding the associated variable GAlwaysWriteDS: The purpose of GAlwaysWriteDS is to provide a convenient way to access the value of r.Vulkan.AlwaysWriteDS within the C++ code. It’s used in the ShouldAlwaysWriteDescriptors() function to determine if descriptors should always be written.
This variable is used internally by the Vulkan RHI module to control descriptor writing behavior. It’s accessed using the GetValueOnAnyThread() method, which suggests it’s designed to be thread-safe.
The value of GAlwaysWriteDS is set automatically by the console variable system based on the value of r.Vulkan.AlwaysWriteDS.
Developers should be aware that changes to r.Vulkan.AlwaysWriteDS will be reflected in GAlwaysWriteDS, and that this variable is only available in debug and development builds.
Best practices for GAlwaysWriteDS include using it consistently within the Vulkan RHI code when decisions about descriptor writing need to be made, and being aware of its performance implications in debug scenarios.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipelineState.cpp:21
Scope: file
Source code excerpt:
#if UE_BUILD_DEBUG || UE_BUILD_DEVELOPMENT
static TAutoConsoleVariable<int32> GAlwaysWriteDS(
TEXT("r.Vulkan.AlwaysWriteDS"),
0,
TEXT(""),
ECVF_RenderThreadSafe
);
#endif
#Associated Variable and Callsites
This variable is associated with another variable named GAlwaysWriteDS
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipelineState.cpp:20
Scope: file
Source code excerpt:
#if UE_BUILD_DEBUG || UE_BUILD_DEVELOPMENT
static TAutoConsoleVariable<int32> GAlwaysWriteDS(
TEXT("r.Vulkan.AlwaysWriteDS"),
0,
TEXT(""),
ECVF_RenderThreadSafe
);
#endif
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipelineState.cpp:31
Scope (from outer to inner):
file
function static bool ShouldAlwaysWriteDescriptors
Source code excerpt:
{
#if UE_BUILD_DEBUG || UE_BUILD_DEVELOPMENT
return (GAlwaysWriteDS.GetValueOnAnyThread() != 0);
#else
return false;
#endif
}
FVulkanComputePipelineDescriptorState::FVulkanComputePipelineDescriptorState(FVulkanDevice* InDevice, FVulkanComputePipeline* InComputePipeline)