bSupportsVariableRateShading

bSupportsVariableRateShading

#Overview

name: bSupportsVariableRateShading

The value of this variable can be defined or overridden in .ini config files. 6 .ini config files referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bSupportsVariableRateShading is to indicate whether a specific shader platform supports Variable Rate Shading (VRS) technology. VRS is a rendering technique that allows for varying shading rates across different parts of the screen, potentially improving performance by reducing shading work in less important areas.

This setting variable is primarily used in the RHI (Rendering Hardware Interface) subsystem of Unreal Engine. It’s part of the data-driven shader platform information system, which allows for flexible configuration of shader platform capabilities.

The value of this variable is set through the data-driven shader platform info parsing system, specifically in the ParseDataDrivenShaderInfo function of the FGenericDataDrivenShaderPlatformInfo class. It’s likely populated from a configuration file or another data source that defines shader platform characteristics.

This variable interacts with other shader platform capability flags and settings within the FGenericDataDrivenShaderPlatformInfo class, such as bSupportsDxc, bIsSPIRV, and NumberOfComputeThreads.

Developers must be aware that this variable is platform-specific. Its value may differ across different rendering platforms (e.g., DirectX, Vulkan, Metal), so code that uses this setting should account for platform differences.

Best practices when using this variable include:

  1. Always check its value before attempting to use VRS features in your rendering code.
  2. Use the provided GetSupportsVariableRateShading function to query this capability, rather than accessing the variable directly.
  3. Consider providing fallback rendering paths for platforms that don’t support VRS.
  4. Be aware that supporting VRS might require additional setup and management in your rendering pipeline.
  5. Test your game’s visual quality and performance with VRS enabled and disabled to ensure it’s providing the desired benefits without introducing visual artifacts.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Android/DataDrivenPlatformInfo.ini:88, section: [ShaderPlatform VULKAN_ES3_1_ANDROID]

Location: <Workspace>/Engine/Config/Android/DataDrivenPlatformInfo.ini:122, section: [ShaderPlatform VULKAN_SM5_ANDROID]

Location: <Workspace>/Engine/Config/VulkanPC/DataDrivenPlatformInfo.ini:115, section: [ShaderPlatform VULKAN_SM5]

Location: <Workspace>/Engine/Config/VulkanPC/DataDrivenPlatformInfo.ini:233, section: [ShaderPlatform VULKAN_SM6]

Location: <Workspace>/Engine/Config/Windows/DataDrivenPlatformInfo.ini:59, section: [ShaderPlatform PCD3D_SM5]

Location: <Workspace>/Engine/Config/Windows/DataDrivenPlatformInfo.ini:116, section: [ShaderPlatform PCD3D_SM6]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/DataDrivenShaderPlatformInfo.cpp:263

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::ParseDataDrivenShaderInfo

Source code excerpt:

	GET_SECTION_BOOL_HELPER(bIsHlslcc);
	GET_SECTION_BOOL_HELPER(bSupportsDxc);
	GET_SECTION_BOOL_HELPER(bSupportsVariableRateShading);
	GET_SECTION_BOOL_HELPER(bIsSPIRV);
	GET_SECTION_INT_HELPER(NumberOfComputeThreads);

	GET_SECTION_BOOL_HELPER(bWaterUsesSimpleForwardShading);
	GET_SECTION_BOOL_HELPER(bSupportsHairStrandGeometry);
	GET_SECTION_BOOL_HELPER(bSupportsDOFHybridScattering);

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:88

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo

Source code excerpt:

	uint32 bSupportsDxc : 1; // Whether DirectXShaderCompiler (DXC) is supported
	uint32 bIsSPIRV : 1;
	uint32 bSupportsVariableRateShading : 1;
	uint32 NumberOfComputeThreads : 10;
	uint32 bWaterUsesSimpleForwardShading : 1;
	uint32 bSupportsHairStrandGeometry : 1;
	uint32 bSupportsDOFHybridScattering : 1;
	uint32 bNeedsExtraMobileFrames : 1;
	uint32 bSupportsHZBOcclusion : 1;

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:611

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo
function     static const bool GetSupportsVariableRateShading

Source code excerpt:

	{
		check(IsValid(Platform));
		return Infos[Platform].bSupportsVariableRateShading;
	}

	static FORCEINLINE_DEBUGGABLE const uint32 GetNumberOfComputeThreads(const FStaticShaderPlatform Platform)
	{
		check(IsValid(Platform));
		return Infos[Platform].NumberOfComputeThreads;