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).

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:

  1. Leave it enabled (default value of 1) for development and debugging to catch potential buffer access errors.
  2. Consider disabling it (set to 0) for release builds if performance is a critical concern and thorough testing has been done to ensure stability.
  3. Always test the application thoroughly after changing this setting to ensure it doesn’t introduce stability issues.

Regarding the associated variable GCVarRobustBufferAccess:

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:798, section: [Android DeviceProfile]

#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);
}