bIsPC

bIsPC

#Overview

name: bIsPC

The value of this variable can be defined or overridden in .ini config files. 11 .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 bIsPC is to indicate whether the current platform is a Personal Computer (PC) platform. This setting variable is used to distinguish PC platforms from other platforms like consoles or mobile devices in the Unreal Engine 5 codebase.

This setting variable is primarily used in the RHI (Rendering Hardware Interface) subsystem of Unreal Engine 5. It’s part of the FGenericDataDrivenShaderPlatformInfo class, which is responsible for managing shader platform information.

The value of this variable is typically set during the initialization of the shader platform information. It’s parsed from configuration data in the ParseDataDrivenShaderInfo function and can be forcibly set for preview platforms in the UpdatePreviewPlatforms function.

bIsPC interacts with other platform-specific variables such as bIsMobile, bIsConsole, and bIsAndroidOpenGLES. These variables are often used together to determine the characteristics of the current platform.

Developers must be aware that this variable is used to make platform-specific decisions in the rendering pipeline. It’s crucial for determining which shader features and optimizations are available or should be used.

Best practices when using this variable include:

  1. Always use the provided getter function (GetIsPC) instead of accessing the variable directly.
  2. Be cautious when making assumptions based solely on this variable, as platform capabilities can vary.
  3. Consider the implications on cross-platform development when using this variable to make platform-specific optimizations.
  4. Remember that in the editor context, this variable is always set to true, which might not reflect the target platform’s actual characteristics.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Mac/DataDrivenPlatformInfo.ini:30, section: [ShaderPlatform METAL_SM5]

Location: <Workspace>/Engine/Config/Mac/DataDrivenPlatformInfo.ini:70, section: [ShaderPlatform METAL_SM6]

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

Location: <Workspace>/Engine/Config/Mac/DataDrivenPlatformInfo.ini:129, section: [ShaderPlatform METAL_MACES3_1]

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

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

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

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

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

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

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

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::ParseDataDrivenShaderInfo

Source code excerpt:

	GET_SECTION_BOOL_HELPER(bIsMobile);
	GET_SECTION_BOOL_HELPER(bIsMetalMRT);
	GET_SECTION_BOOL_HELPER(bIsPC);
	GET_SECTION_BOOL_HELPER(bIsConsole);
	GET_SECTION_BOOL_HELPER(bIsAndroidOpenGLES);
	GET_SECTION_BOOL_HELPER(bSupportsDebugViewShaders);
	GET_SECTION_BOOL_HELPER(bSupportsMobileMultiView);
	GET_SECTION_BOOL_HELPER(bSupportsArrayTextureCompression);
	GET_SECTION_BOOL_HELPER(bSupportsDistanceFields);

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

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::UpdatePreviewPlatforms

Source code excerpt:


				// 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);

				// Support for stereo features requires extra consideration. The editor may not use the same technique as the preview platform,
				// particularly MobileMultiView may be substituted by a fallback path. In order to avoid inundating real mobile platforms
				// with the properties needed for the desktop MMV fallback path, override them here with the editor ones to make MMV preview possible

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

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo

Source code excerpt:

	uint32 bIsMobile : 1;
	uint32 bIsMetalMRT : 1;
	uint32 bIsPC : 1;
	uint32 bIsConsole : 1;
	uint32 bIsAndroidOpenGLES : 1;

	uint32 bSupportsDebugViewShaders : 1;
	uint32 bSupportsMobileMultiView : 1;
	uint32 bSupportsArrayTextureCompression : 1;

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

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo
function     static const bool GetIsPC

Source code excerpt:

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

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