bSupportsShaderRootConstants

bSupportsShaderRootConstants

#Overview

name: bSupportsShaderRootConstants

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bSupportsShaderRootConstants is to indicate whether the current shader platform supports shader root constants. Shader root constants are a feature that allows for efficient passing of small amounts of data directly to shaders without using constant buffers.

This setting variable is primarily used within the RHI (Rendering Hardware Interface) module of Unreal Engine 5. 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 in the ParseDataDrivenShaderInfo function within the DataDrivenShaderPlatformInfo.cpp file. It’s read from a configuration section, likely defined in an INI file or similar configuration source.

This variable interacts with other shader platform capability flags, such as bSupportsShaderBundleDispatch and bSupportsRenderTargetWriteMask. These flags collectively define the features supported by a particular shader platform.

Developers must be aware that this variable is platform-specific. Its value may differ across different rendering platforms (e.g., DirectX, Vulkan, Metal). Additionally, it’s forcibly disabled for preview platforms, as seen in the UpdatePreviewPlatforms function.

Best practices when using this variable include:

  1. Always check its value before attempting to use shader root constants in your rendering code.
  2. Be prepared to provide alternative implementations for platforms that don’t support shader root constants.
  3. Use the GetSupportsShaderRootConstants function to query this capability, rather than accessing the variable directly.
  4. Consider the performance implications of using or not using shader root constants based on this flag.
  5. Be aware that this capability might change with driver updates or new hardware, so design your code to be flexible.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Windows/DataDrivenPlatformInfo.ini:118, 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:216

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::ParseDataDrivenShaderInfo

Source code excerpt:

	GET_SECTION_BOOL_HELPER(bSupportsMSAA);
	GET_SECTION_BOOL_HELPER(bSupports4ComponentUAVReadWrite);
	GET_SECTION_BOOL_HELPER(bSupportsShaderRootConstants);
	GET_SECTION_BOOL_HELPER(bSupportsShaderBundleDispatch);
	GET_SECTION_BOOL_HELPER(bSupportsRenderTargetWriteMask);
	GET_SECTION_BOOL_HELPER(bSupportsRayTracing);
	GET_SECTION_BOOL_HELPER(bSupportsRayTracingShaders);
	GET_SECTION_BOOL_HELPER(bSupportsInlineRayTracing);
	GET_SECTION_BOOL_HELPER(bSupportsRayTracingCallableShaders);

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

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::UpdatePreviewPlatforms

Source code excerpt:


				// Settings that will never be supported in preview
				PREVIEW_FORCE_DISABLE(bSupportsShaderRootConstants);
				PREVIEW_FORCE_DISABLE(bSupportsShaderBundleDispatch);
				PREVIEW_FORCE_DISABLE(bSupportsRenderTargetWriteMask);
				PREVIEW_FORCE_DISABLE(bSupportsIntrinsicWaveOnce);
				PREVIEW_FORCE_DISABLE(bSupportsDOFHybridScattering);
				PREVIEW_FORCE_DISABLE(bSupports4ComponentUAVReadWrite);

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

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo

Source code excerpt:

	uint32 bSupportsMSAA : 1;
	uint32 bSupports4ComponentUAVReadWrite : 1;
	uint32 bSupportsShaderRootConstants : 1;
	uint32 bSupportsShaderBundleDispatch : 1;
	uint32 bSupportsRenderTargetWriteMask : 1;
	uint32 bSupportsRayTracing : 1;
	uint32 bSupportsRayTracingCallableShaders : 1;
	uint32 bSupportsRayTracingProceduralPrimitive : 1;
	uint32 bSupportsRayTracingTraversalStatistics : 1;

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

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo
function     static const bool GetSupportsShaderRootConstants

Source code excerpt:

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

	static FORCEINLINE_DEBUGGABLE const bool GetSupportsShaderBundleDispatch(const FStaticShaderPlatform Platform)
	{
		check(IsValid(Platform));
		return Infos[Platform].bSupportsShaderBundleDispatch;