bNeedsOfflineCompiler

bNeedsOfflineCompiler

#Overview

name: bNeedsOfflineCompiler

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bNeedsOfflineCompiler is to indicate whether a specific shader platform requires an offline compiler for shader compilation. This setting is primarily used in the rendering system, specifically for shader compilation and material processing.

Based on the callsites, this variable is utilized by the Material Editor subsystem and the RHI (Rendering Hardware Interface) module of Unreal Engine 5.

The value of this variable is set within the FGenericDataDrivenShaderPlatformInfo class, which is part of the data-driven shader platform information system. It’s likely populated from configuration files or platform-specific settings during engine initialization.

This variable interacts with other platform-specific shader compilation settings, such as bSupportsComputeFramework, bSupportsAnisotropicMaterials, and bSupportsDualSourceBlending.

Developers must be aware that when bNeedsOfflineCompiler is true for a platform, additional setup may be required to ensure the correct offline compiler is available and properly configured. This is crucial for accurate shader compilation and material processing on that platform.

Best practices when using this variable include:

  1. Ensuring the necessary offline compiler is installed and configured when targeting platforms that require it.
  2. Checking the value of bNeedsOfflineCompiler before attempting to compile shaders or process materials for a specific platform.
  3. Providing clear instructions or automation for setting up the required offline compiler in the project documentation or build scripts.
  4. Considering the implications of offline compilation on build times and CI/CD pipelines when targeting platforms that require it.
  5. Regularly updating the offline compiler to ensure compatibility with the latest engine version and platform SDKs.

#Setting Variables

#References In INI files

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

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

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

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

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/MaterialEditor/Private/MaterialStats.cpp:1407

Scope (from outer to inner):

file
function     void FMaterialStats::ComputeGridWarnings

Source code excerpt:


			auto ShaderPlatformType = PlatformPtr->GetPlatformShaderType();
			bool bNeedsOfflineCompiler = FMaterialStatsUtils::PlatformNeedsOfflineCompiler(ShaderPlatformType);
			if (bNeedsOfflineCompiler)
			{
				bool bCompilerAvailable = FMaterialStatsUtils::IsPlatformOfflineCompilerAvailable(ShaderPlatformType);

				if (!bCompilerAvailable)
				{
					auto WarningString = FString::Printf(TEXT("Platform %s needs an offline shader compiler to extract instruction count. Please check 'Editor Preferences' -> 'Content Editors' -> 'Material Editor' for additional settings."), *PlatformPtr->GetPlatformName().ToString());

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

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::ParseDataDrivenShaderInfo

Source code excerpt:

	GET_SECTION_BOOL_HELPER(bSupportsGen5TemporalAA);
	GET_SECTION_BOOL_HELPER(bTargetsTiledGPU);
	GET_SECTION_BOOL_HELPER(bNeedsOfflineCompiler);
	GET_SECTION_BOOL_HELPER(bSupportsComputeFramework);
	GET_SECTION_BOOL_HELPER(bSupportsAnisotropicMaterials);
	GET_SECTION_BOOL_HELPER(bSupportsDualSourceBlending);
	GET_SECTION_BOOL_HELPER(bRequiresGeneratePrevTransformBuffer);
	GET_SECTION_BOOL_HELPER(bRequiresRenderTargetDuringRaster);
	GET_SECTION_BOOL_HELPER(bRequiresDisableForwardLocalLights);

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

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo

Source code excerpt:

	uint32 bSupportsGen5TemporalAA : 1;
	uint32 bTargetsTiledGPU : 1;
	uint32 bNeedsOfflineCompiler : 1;
	uint32 bSupportsComputeFramework : 1;
	uint32 bSupportsAnisotropicMaterials : 1;
	uint32 bSupportsDualSourceBlending : 1;
	uint32 bRequiresGeneratePrevTransformBuffer : 1;
	uint32 bRequiresRenderTargetDuringRaster : 1;
	uint32 bRequiresDisableForwardLocalLights : 1;

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

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo
function     static const bool GetNeedsOfflineCompiler

Source code excerpt:

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

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