r.Vulkan.RobustBufferAccess
r.Vulkan.RobustBufferAccess
#Overview
name: r.Vulkan.RobustBufferAccess
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0 to disable robust buffer access1 to enable (default)
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Vulkan.RobustBufferAccess is to control the robust buffer access feature in the Vulkan rendering backend of Unreal Engine 5. This setting is specifically related to the Vulkan graphics API and affects how buffer access is handled for improved stability and error detection.
The Vulkan RHI (Render Hardware Interface) subsystem of Unreal Engine 5 relies on this setting variable. It is primarily used in the VulkanRHI module, which is responsible for interfacing between Unreal Engine and the Vulkan API.
The value of this variable is set through a console variable (CVar) named GCVarRobustBufferAccess. It is defined with a default value of 1, meaning the robust buffer access feature is enabled by default. Developers can change this value using console commands or configuration files.
The associated variable GCVarRobustBufferAccess interacts directly with r.Vulkan.RobustBufferAccess. They share the same value and purpose, with GCVarRobustBufferAccess being the actual implementation of the console variable.
Developers must be aware that this variable affects the Vulkan device features and descriptor buffer properties. It can impact performance and stability, so changes should be made with caution and thorough testing.
Best practices when using this variable include:
- Leave it enabled (default value of 1) for development and debugging to catch potential buffer access errors.
- Consider disabling it (set to 0) for release builds if performance is a critical concern and thorough testing has been done to ensure stability.
- Always test the application thoroughly after changing this setting to ensure it doesn’t introduce stability issues.
Regarding the associated variable GCVarRobustBufferAccess:
- It is the actual implementation of the r.Vulkan.RobustBufferAccess setting.
- It is used to query the current state of the robust buffer access feature in various parts of the Vulkan RHI code.
- The value is typically accessed using the GetValueOnAnyThread() method, which allows for thread-safe access to the variable’s value.
- It directly influences the VkPhysicalDeviceFeatures structure, specifically the robustBufferAccess member, which is used when creating the Vulkan logical device.
- Developers should be aware that changing this variable at runtime may not have an immediate effect, as some Vulkan features are set during device creation and cannot be changed without recreating the device.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:798, section: [Android DeviceProfile]
- INI Section:
Android DeviceProfile
- Raw value:
1
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanDevice.cpp:36
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> GCVarRobustBufferAccess(
TEXT("r.Vulkan.RobustBufferAccess"),
1,
TEXT("0 to disable robust buffer access")
TEXT("1 to enable (default)"),
ECVF_ReadOnly
);
#Associated Variable and Callsites
This variable is associated with another variable named GCVarRobustBufferAccess
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanDescriptorSets.cpp:154
Scope: file
Source code excerpt:
extern TAutoConsoleVariable<int32> GCVarRobustBufferAccess;
static inline uint32 GetDescriptorTypeSize(FVulkanDevice* Device, VkDescriptorType DescriptorType)
{
const bool bRobustBufferAccess = (GCVarRobustBufferAccess.GetValueOnAnyThread() > 0);
const VkPhysicalDeviceDescriptorBufferPropertiesEXT& DescriptorBufferProperties = Device->GetOptionalExtensionProperties().DescriptorBufferProps;
switch (DescriptorType)
{
case VK_DESCRIPTOR_TYPE_SAMPLER:
return DescriptorBufferProperties.samplerDescriptorSize;
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanDevice.cpp:35
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> GCVarRobustBufferAccess(
TEXT("r.Vulkan.RobustBufferAccess"),
1,
TEXT("0 to disable robust buffer access")
TEXT("1 to enable (default)"),
ECVF_ReadOnly
);
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanDevice.cpp:229
Scope (from outer to inner):
file
function void FVulkanPhysicalDeviceFeatures::Query
Source code excerpt:
// Apply config modifications
Core_1_0.robustBufferAccess = GCVarRobustBufferAccess.GetValueOnAnyThread() > 0 ? VK_TRUE : VK_FALSE;
// Apply platform restrictions
FVulkanPlatform::RestrictEnabledPhysicalDeviceFeatures(this);
}