bIsHlslcc

bIsHlslcc

#Overview

name: bIsHlslcc

The value of this variable can be defined or overridden in .ini config files. 3 .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 bIsHlslcc is to indicate whether a specific shader platform uses the HLSL to GLSL cross-compiler (HLSLCC) for shader compilation. This setting is part of Unreal Engine’s rendering system, specifically related to shader compilation and platform-specific shader handling.

Based on the callsites, this variable is primarily used within the RHI (Rendering Hardware Interface) module of Unreal Engine. It’s part of the FGenericDataDrivenShaderPlatformInfo class, which manages shader platform information.

The value of this variable is set during the parsing of shader platform configuration data in the ParseDataDrivenShaderInfo function. It’s read from a configuration section using the GET_SECTION_BOOL_HELPER macro.

bIsHlslcc interacts closely with other shader platform-related variables such as bSupportsDxc, ShaderFormat, and Language. It’s often used in conjunction with these variables to determine the appropriate shader compilation strategy for a given platform.

Developers must be aware that this variable is platform-specific and can affect how shaders are compiled and processed for different target platforms. It’s crucial for determining whether HLSLCC is used for a particular shader platform, which can have implications for shader compatibility and performance.

Best practices when using this variable include:

  1. Ensure that the shader platform configurations are correctly set up for each target platform.
  2. Use the GetIsHlslcc function to query this value rather than accessing it directly, as it provides a safe and consistent way to check the status.
  3. Consider this variable in conjunction with other shader platform settings when implementing cross-platform shader code or debugging shader-related issues.
  4. Be aware of the performance implications of using HLSLCC vs. native shader compilation methods on different platforms.

#Setting Variables

#References In INI files

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

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

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

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::ParseDataDrivenShaderInfo

Source code excerpt:

	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);
	GET_SECTION_INT_HELPER(NumberOfComputeThreads);

	GET_SECTION_BOOL_HELPER(bWaterUsesSimpleForwardShading);

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

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::UpdatePreviewPlatforms

Source code excerpt:

				PREVIEW_USE_RUNTIME_VALUE(ShaderFormat);
				PREVIEW_USE_RUNTIME_VALUE(Language);
				PREVIEW_USE_RUNTIME_VALUE(bIsHlslcc);
				PREVIEW_USE_RUNTIME_VALUE(bSupportsDxc);

				// Editor is always PC, never console and always supports debug view shaders
				PREVIEW_FORCE_SETTING(bIsPC, true);
				PREVIEW_FORCE_SETTING(bSupportsDebugViewShaders, true);
				PREVIEW_FORCE_SETTING(bIsConsole, false);

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

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo

Source code excerpt:

	uint32 bRequiresUnwrappedMeshShaderArgs : 1;
	uint32 bSupportsPerPixelDBufferMask : 1;
	uint32 bIsHlslcc : 1;
	uint32 bSupportsDxc : 1; // Whether DirectXShaderCompiler (DXC) is supported
	uint32 bIsSPIRV : 1;
	uint32 bSupportsVariableRateShading : 1;
	uint32 NumberOfComputeThreads : 10;
	uint32 bWaterUsesSimpleForwardShading : 1;
	uint32 bSupportsHairStrandGeometry : 1;

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

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo
function     static const bool GetIsHlslcc

Source code excerpt:

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

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