MaxMeshShaderThreadGroupSize

MaxMeshShaderThreadGroupSize

#Overview

name: MaxMeshShaderThreadGroupSize

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 MaxMeshShaderThreadGroupSize is to define the maximum number of threads that can be grouped together in a mesh shader for a specific shader platform. This setting is part of Unreal Engine 5’s rendering system, specifically related to mesh shaders, which are a modern GPU feature for efficient geometry processing.

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

The value of this variable is set through the data-driven shader platform information parsing process, as seen in the ParseDataDrivenShaderInfo function in DataDrivenShaderPlatformInfo.cpp. It’s likely populated from a configuration file or platform-specific settings.

MaxMeshShaderThreadGroupSize interacts with other mesh shader-related variables, such as bSupportsMeshShadersTier1 and bSupportsMeshShadersWithClipDistance. These variables collectively define the mesh shader capabilities of a given platform.

Developers must be aware that this variable is platform-specific and its value may vary depending on the target hardware. It’s crucial for optimizing mesh shader performance and ensuring compatibility across different GPU architectures.

Best practices when using this variable include:

  1. Always check if mesh shaders are supported before using this value.
  2. Use this value to optimize mesh shader workloads by tailoring the thread group size to the platform’s capabilities.
  3. Be cautious when writing cross-platform code, as this value may differ between platforms.
  4. Use the provided GetMaxMeshShaderThreadGroupSize function to retrieve the value, ensuring you’re always getting the correct platform-specific setting.

#Setting Variables

#References In INI files

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

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::ParseDataDrivenShaderInfo

Source code excerpt:

	GET_SECTION_BOOL_HELPER(bSupportsMeshShadersTier1);
	GET_SECTION_BOOL_HELPER(bSupportsMeshShadersWithClipDistance);
	GET_SECTION_INT_HELPER(MaxMeshShaderThreadGroupSize);
	GET_SECTION_BOOL_HELPER(bRequiresUnwrappedMeshShaderArgs);
	GET_SECTION_BOOL_HELPER(bSupportsPerPixelDBufferMask);
	GET_SECTION_BOOL_HELPER(bIsHlslcc);
	GET_SECTION_BOOL_HELPER(bSupportsDxc);
	GET_SECTION_BOOL_HELPER(bSupportsVariableRateShading);
	GET_SECTION_BOOL_HELPER(bIsSPIRV);

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

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::UpdatePreviewPlatforms

Source code excerpt:

				// Settings that need to match the runtime
				PREVIEW_USE_RUNTIME_VALUE(bSupportsGPUScene);
				PREVIEW_USE_RUNTIME_VALUE(MaxMeshShaderThreadGroupSize);
				PREVIEW_USE_RUNTIME_VALUE(bSupportsSceneDataCompressedTransforms);
				PREVIEW_USE_RUNTIME_VALUE(bSupportsVertexShaderSRVs);
				PREVIEW_USE_RUNTIME_VALUE(bSupportsManualVertexFetch);
				PREVIEW_USE_RUNTIME_VALUE(bSupportsRealTypes);
				PREVIEW_USE_RUNTIME_VALUE(bSupportsUniformBufferObjects);

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

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo

Source code excerpt:

	uint32 bSupportsMeshShadersTier1 : 1;
	uint32 bSupportsMeshShadersWithClipDistance : 1;
	uint32 MaxMeshShaderThreadGroupSize : 10;
	uint32 bRequiresUnwrappedMeshShaderArgs : 1;
	uint32 bSupportsPerPixelDBufferMask : 1;
	uint32 bIsHlslcc : 1;
	uint32 bSupportsDxc : 1; // Whether DirectXShaderCompiler (DXC) is supported
	uint32 bIsSPIRV : 1;
	uint32 bSupportsVariableRateShading : 1;

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

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo
function     static const uint32 GetMaxMeshShaderThreadGroupSize

Source code excerpt:

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

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