bSupportsVulkanSM5

bSupportsVulkanSM5

#Overview

name: bSupportsVulkanSM5

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 8 C++ source files. Also referenced in 1 C# build file meaning it may affect the build system logic.

#Summary

#Usage in the C++ source code

The purpose of bSupportsVulkanSM5 is to enable Vulkan SM5 (Shader Model 5) rendering support for Android devices, particularly for more advanced or desktop-like rendering capabilities on Android platforms.

This setting variable is primarily used in the Android-specific modules of Unreal Engine 5, including:

  1. AndroidTargetPlatformSettings
  2. LauncherServices
  3. AndroidRuntimeSettings
  4. Android-specific parts of the Core module

The value of this variable is set in the Android Runtime Settings, which can be configured in the project settings or through the engine configuration files.

bSupportsVulkanSM5 interacts with other variables such as:

Developers must be aware of the following when using this variable:

  1. It’s an experimental feature, as indicated by the “Experimental” tag in the property metadata.
  2. It’s mutually exclusive with Meta Quest packaging (bPackageForMetaQuest).
  3. Enabling this might affect the GPU architecture selection and overall rendering pipeline for the Android platform.

Best practices when using this variable include:

  1. Only enable it if you specifically need Vulkan SM5 features on Android devices that support it.
  2. Ensure that your target devices actually support Vulkan SM5 before enabling this option.
  3. Test thoroughly on various Android devices to ensure compatibility and performance.
  4. Consider the implications on package size and device compatibility when enabling this feature.
  5. Be prepared to handle fallback scenarios for devices that don’t support Vulkan SM5.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:3043, section: [/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Developer/Android/AndroidTargetPlatformSettings/Private/AndroidTargetPlatformSettings.cpp:49

Scope (from outer to inner):

file
function     bool FAndroidTargetPlatformSettings::SupportsVulkanSM5

Source code excerpt:

	bool bSupportsMobileVulkanSM5 = false;
#if WITH_ENGINE
	GConfig->GetBool(TEXT("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings"), TEXT("bSupportsVulkanSM5"), bSupportsMobileVulkanSM5, GEngineIni);
#endif
	return bSupportsMobileVulkanSM5;
}

bool FAndroidTargetPlatformSettings::SupportsFeature(ETargetPlatformFeatures Feature) const
{

#Loc: <Workspace>/Engine/Source/Developer/LauncherServices/Private/Launcher/LauncherWorker.cpp:348

Scope (from outer to inner):

file
function     static void AddDeviceToLaunchCommand

Source code excerpt:

			bool bAndroidSupportsVulkan, bAndroidSupportsVulkanSM5;
			AndroidEngineSettings.GetBool(TEXT("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings"), TEXT("bSupportsVulkan"), bAndroidSupportsVulkan);
			AndroidEngineSettings.GetBool(TEXT("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings"), TEXT("bSupportsVulkanSM5"), bAndroidSupportsVulkanSM5);
			bCookedVulkan = bAndroidSupportsVulkan || bAndroidSupportsVulkanSM5;
			bCheckTargetedRHIs = false;
		}

		if (bCheckTargetedRHIs)
		{

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Classes/AndroidRuntimeSettings.h:425

Scope (from outer to inner):

file
class        class UAndroidRuntimeSettings : public UObject

Source code excerpt:

	// Enable Vulkan SM5 rendering support
	UPROPERTY(GlobalConfig, EditAnywhere, Category = Build, meta = (DisplayName = "Support Vulkan Desktop [Experimental]", EditCondition = "!bPackageForMetaQuest"))
	bool bSupportsVulkanSM5;

	/** Directory for Debug Vulkan Layers to package */
	UPROPERTY(GlobalConfig, EditAnywhere, Category = Build, meta = (DisplayName = "Debug Vulkan Layer Directory"))
	FDirectoryPath DebugVulkanLayerDirectory;

	/** Debug Vulkan Device Layers to enable */

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Private/AndroidRuntimeSettings.cpp:114

Scope (from outer to inner):

file
function     void UAndroidRuntimeSettings::HandleMetaQuestSupport

Source code excerpt:

			UE_LOG(LogAndroidRuntimeSettings, Warning, TEXT("Support arm64 has been changed to true.\n"));
		}
		if (bSupportsVulkanSM5)
		{
			bSupportsVulkanSM5 = false;
			UpdateSinglePropertyInConfigFile(GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(UAndroidRuntimeSettings, bSupportsVulkanSM5)), GetDefaultConfigFilename());
			UE_LOG(LogAndroidRuntimeSettings, Warning, TEXT("Support Vulkan Desktop has been changed to false.\n"));
			EnsureValidGPUArch();
		}
		if (bBuildForES31)
		{
			bBuildForES31 = false;

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Private/AndroidRuntimeSettings.cpp:133

Scope (from outer to inner):

file
function     void UAndroidRuntimeSettings::HandleMetaQuestSupport

Source code excerpt:

		UE_LOG(LogAndroidRuntimeSettings, Display, TEXT("Support Vulkan: %d.\n"), bSupportsVulkan);
		UE_LOG(LogAndroidRuntimeSettings, Display, TEXT("Support x86_64: %d.\n"), bBuildForX8664);
		UE_LOG(LogAndroidRuntimeSettings, Display, TEXT("Support Vulkan Desktop: %d.\n"), bSupportsVulkanSM5);
		UE_LOG(LogAndroidRuntimeSettings, Display, TEXT("Support OpenGL ES3.2: %d."), bBuildForES31);

		int32 SupportedDevicesTagIndex = ExtraApplicationSettings.Find("com.oculus.supportedDevices");
		FString SupportedDevicesValue("quest|quest2|questpro|quest3");
		int32 SupportedDevicesIndex = ExtraApplicationSettings.Find(SupportedDevicesValue);
		// The supported devices tag is present but not up to date and does not contain all the currently supported devices.

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Private/AndroidRuntimeSettings.cpp:266

Scope (from outer to inner):

file
function     void UAndroidRuntimeSettings::EnsureValidGPUArch

Source code excerpt:

{
	// Ensure that at least one GPU architecture is supported
	if (!bSupportsVulkan && !bBuildForES31 && !bSupportsVulkanSM5)
	{
		UE_LOG(LogAndroidRuntimeSettings, Warning, TEXT("No GPU architecture is selected.\n"));
		// Default to Vulkan for Meta Quest devices
		if (bPackageForMetaQuest)
		{
			bSupportsVulkan = true;

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Android/AndroidPlatformMisc.cpp:2315

Scope (from outer to inner):

file
function     bool FAndroidMisc::IsDesktopVulkanAvailable

Source code excerpt:

		CachedDesktopVulkanAvailable = 0;

		bool bSupportsVulkanSM5 = false;

		GConfig->GetBool(TEXT("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings"), TEXT("bSupportsVulkanSM5"), bSupportsVulkanSM5, GEngineIni);

		if (bSupportsVulkanSM5)
		{
			CachedDesktopVulkanAvailable = 1;
		}
	}

	return CachedDesktopVulkanAvailable == 1;

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Android/AndroidPlatformMisc.cpp:2347

Scope (from outer to inner):

file
function     bool FAndroidMisc::IsVulkanAvailable

Source code excerpt:


			// @todo Lumin: Double check all this stuff after merging general android Vulkan SM5 from main
			const bool bSupportsVulkanSM5 = IsDesktopVulkanAvailable();

			const bool bVulkanDisabledCmdLine = FParse::Param(FCommandLine::Get(), TEXT("GL")) || FParse::Param(FCommandLine::Get(), TEXT("OpenGL"));

			if (!FModuleManager::Get().ModuleExists(TEXT("VulkanRHI")))
			{
				UE_LOG(LogAndroid, Log, TEXT("Vulkan not available as VulkanRHI not present."));
			}
			else if (!(bSupportsVulkan || bSupportsVulkanSM5))
			{
				UE_LOG(LogAndroid, Log, TEXT("Vulkan not available as project packaged without bSupportsVulkan or bSupportsVulkanSM5."));
			}
			else if (bVulkanDisabledCmdLine)
			{
				UE_LOG(LogAndroid, Log, TEXT("Vulkan API detection is disabled by a command line option."));

#References in C# build files

This variable is referenced in the following C# build files:

Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Android/UEDeployAndroid.cs:1444

			ConfigHierarchy Ini = GetConfigCacheIni(ConfigHierarchyType.Engine);
			Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bSupportsVulkan", out bSupportsVulkan);
			Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bSupportsVulkanSM5", out bSupportsVulkanSM5);

			bool bCopyVulkanLayers = (bSupportsVulkan || bSupportsVulkanSM5) && (Configuration != "Shipping");
			if (bCopyVulkanLayers)
			{
				string VulkanLayersDir = Path.Combine(Unreal.EngineDirectory.ToString(), "Binaries", "ThirdParty", "Vulkan", "Android", NDKArch);
				if (Directory.Exists(VulkanLayersDir))