VulkanTargetedShaderFormats

VulkanTargetedShaderFormats

#Overview

name: VulkanTargetedShaderFormats

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 10 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of VulkanTargetedShaderFormats is to specify the targeted shader formats for the Vulkan graphics API on Windows platforms in Unreal Engine 5. This setting is primarily used for configuring the rendering system, specifically for Vulkan support.

The Unreal Engine subsystems that rely on this setting variable include:

  1. Windows Target Platform module
  2. Launcher Services module
  3. Renderer Settings
  4. RHI (Rendering Hardware Interface) module

The value of this variable is typically set in the project’s configuration files, specifically in the Windows Target Settings section of the Engine.ini file. It can also be modified through the Unreal Engine Editor’s project settings interface.

This variable interacts with other related variables such as D3D11TargetedShaderFormats and D3D12TargetedShaderFormats. These variables collectively determine the supported shader formats for different graphics APIs on Windows platforms.

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

  1. Changes to this setting may require a project restart to take effect.
  2. It affects the compilation of shaders for Vulkan on Windows platforms.
  3. The setting is platform-specific and only applies to Windows builds.

Best practices when using this variable include:

  1. Ensure that the targeted shader formats are compatible with the intended deployment platforms.
  2. Regularly review and update the supported formats to take advantage of new Vulkan features and optimizations.
  3. Consider the performance implications of enabling or disabling specific shader formats.
  4. Coordinate changes to this setting with the overall rendering and platform support strategy of the project.
  5. Test thoroughly after making changes to ensure compatibility and performance across different hardware configurations.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:300, section: [/Script/WindowsTargetPlatform.WindowsTargetSettings]

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
function     static void AddDeviceToLaunchCommand

Source code excerpt:


			bCheckTargetedRHIs = true;
			WindowsEngineSettings.GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("VulkanTargetedShaderFormats"), TargetedShaderFormats);

			TArray<FString> OldConfigShaderFormats;
			WindowsEngineSettings.GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("TargetedRHIs"), OldConfigShaderFormats);

			for (const FString& OldConfigShaderFormat : OldConfigShaderFormats)
			{

#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Classes/WindowsTargetSettings.h:58

Scope (from outer to inner):

file
class        class UWindowsTargetSettings : public UObject

Source code excerpt:


	UPROPERTY(EditAnywhere, config, Category = "Rendering", Meta = (ConfigRestartRequired = true))
	TArray<FString> VulkanTargetedShaderFormats;

	/** The compiler version to use for this project. May be different to the chosen IDE. */
	UPROPERTY(EditAnywhere, config, Category = "Toolchain", Meta = (DisplayName = "Compiler Version"))
	ECompilerVersion Compiler;

	/** Sample rate to run the audio mixer with. */

#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Private/WindowsTargetPlatformClasses.cpp:57

Scope (from outer to inner):

file
function     void UWindowsTargetSettings::PostInitProperties

Source code excerpt:

		AddToShaderFormatList(D3D12TargetedShaderFormats, TargetedRHIs_DEPRECATED, &FilterShaderPlatform_D3D12);
		AddToShaderFormatList(D3D11TargetedShaderFormats, TargetedRHIs_DEPRECATED, &FilterShaderPlatform_D3D11);
		AddToShaderFormatList(VulkanTargetedShaderFormats, TargetedRHIs_DEPRECATED, &FilterShaderPlatform_Vulkan);

		TargetedRHIs_DEPRECATED.Empty();
	}
}

#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Public/GenericWindowsTargetPlatform.h:311

Scope (from outer to inner):

file
class        class TGenericWindowsTargetPlatform : public TTargetPlatformBase<TProperties>
function     virtual void GetPlatformSpecificProjectAnalytics

Source code excerpt:

		TSuper::AppendAnalyticsEventConfigArray(AnalyticsParamArray, TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("D3D12TargetedShaderFormats"), GEngineIni);
		TSuper::AppendAnalyticsEventConfigArray(AnalyticsParamArray, TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("D3D11TargetedShaderFormats"), GEngineIni);
		TSuper::AppendAnalyticsEventConfigArray(AnalyticsParamArray, TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("VulkanTargetedShaderFormats"), GEngineIni);
		TSuper::AppendAnalyticsEventConfigArray(AnalyticsParamArray, TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("TargetedRHIs"), GEngineIni, TEXT("TargetedRHIs_Deprecated") );
	}

#if WITH_ENGINE
	virtual void GetReflectionCaptureFormats(TArray<FName>& OutFormats) const override
	{

#Loc: <Workspace>/Engine/Source/Editor/DetailCustomizations/Private/WindowsTargetSettingsDetails.cpp:208

Scope (from outer to inner):

file
function     void FWindowsTargetSettingsDetails::CustomizeDetails

Source code excerpt:

	D3D11TargetShaderFormatsDetails->CreateTargetShaderFormatsPropertyView(TargetPlatform, &GetFriendlyNameForWindowsShaderPlatformCheckbox, &FilterShaderPlatform_D3D11, ECategoryPriority::Important);

	VulkanTargetShaderFormatsDetails = MakeShareable(new FShaderFormatsPropertyDetails(&DetailBuilder, TEXT("VulkanTargetedShaderFormats"), TEXT("Vulkan Targeted Shader Formats")));
	VulkanTargetShaderFormatsDetails->CreateTargetShaderFormatsPropertyView(TargetPlatform, &GetFriendlyNameForWindowsShaderPlatformCheckbox, &FilterShaderPlatform_Vulkan, ECategoryPriority::Important);

	// Next add the splash image customization
	const FText EditorSplashDesc(LOCTEXT("EditorSplashLabel", "Editor Splash"));
	IDetailCategoryBuilder& SplashCategoryBuilder = DetailBuilder.EditCategory(TEXT("Splash"));
	FDetailWidgetRow& EditorSplashWidgetRow = SplashCategoryBuilder.AddCustomRow(EditorSplashDesc);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RendererSettings.cpp:427

Scope (from outer to inner):

file
function     void URendererSettings::CheckForMissingShaderModels

Source code excerpt:

			if (IsVulkanPlatform(GMaxRHIShaderPlatform))
			{
				GConfig->GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("VulkanTargetedShaderFormats"), WindowsVulkanTargetedShaderFormats, GEngineIni);
				CopySM6Format(TEXT("SF_VULKAN_SM6"), WindowsTargetedRHIs, WindowsVulkanTargetedShaderFormats);
			}
			else
			{
				GConfig->GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("D3D11TargetedShaderFormats"), D3D11TargetedShaderFormats, GEngineIni);
				GConfig->GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("D3D12TargetedShaderFormats"), D3D12TargetedShaderFormats, GEngineIni);

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

Scope (from outer to inner):

file
function     void URendererSettings::CheckForMissingShaderModels

Source code excerpt:

#elif PLATFORM_LINUX
		// Gather all Linux shader format settings
		GConfig->GetArray(TEXT("/Script/LinuxTargetPlatform.LinuxTargetSettings"), TEXT("VulkanTargetedShaderFormats"), LinuxVulkanTargetedShaderFormats, GEngineIni);
		GConfig->GetArray(TEXT("/Script/LinuxTargetPlatform.LinuxTargetSettings"), TEXT("TargetedRHIs"), LinuxTargetedRHIs, GEngineIni);
		CopySM6Format(TEXT("SF_VULKAN_SM6"), LinuxTargetedRHIs, LinuxVulkanTargetedShaderFormats);
#elif PLATFORM_MAC
		// TODO: Gather all Mac shader format settings
#endif

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp:6740

Scope (from outer to inner):

file
function     void UStaticMesh::CheckForMissingShaderModels

Source code excerpt:

			if (IsVulkanPlatform(GMaxRHIShaderPlatform))
			{
				GConfig->GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("VulkanTargetedShaderFormats"), WindowsVulkanTargetedShaderFormats, GEngineIni);
				CopySM6Format(TEXT("SF_VULKAN_SM6"), WindowsTargetedRHIs, WindowsVulkanTargetedShaderFormats);
			}
			else
			{
				GConfig->GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("D3D11TargetedShaderFormats"), D3D11TargetedShaderFormats, GEngineIni);
				GConfig->GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("D3D12TargetedShaderFormats"), D3D12TargetedShaderFormats, GEngineIni);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp:6752

Scope (from outer to inner):

file
function     void UStaticMesh::CheckForMissingShaderModels

Source code excerpt:

#elif PLATFORM_LINUX
		// Gather all Linux shader format settings
		GConfig->GetArray(TEXT("/Script/LinuxTargetPlatform.LinuxTargetSettings"), TEXT("VulkanTargetedShaderFormats"), LinuxVulkanTargetedShaderFormats, GEngineIni);
		GConfig->GetArray(TEXT("/Script/LinuxTargetPlatform.LinuxTargetSettings"), TEXT("TargetedRHIs"), LinuxTargetedRHIs, GEngineIni);
		CopySM6Format(TEXT("SF_VULKAN_SM6"), LinuxTargetedRHIs, LinuxVulkanTargetedShaderFormats);
#elif PLATFORM_MAC
		// TODO: Gather all Mac shader format settings
#endif

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/Windows/WindowsDynamicRHI.cpp:346

Scope (from outer to inner):

file
function     FParsedWindowsDynamicRHIConfig ParseWindowsDynamicRHIConfig

Source code excerpt:

	Config.RHIConfigs[(int32)EWindowsRHI::D3D11]  = ParseWindowsRHIConfig(TEXT("D3D11TargetedShaderFormats"));
	Config.RHIConfigs[(int32)EWindowsRHI::D3D12]  = ParseWindowsRHIConfig(TEXT("D3D12TargetedShaderFormats"));
	Config.RHIConfigs[(int32)EWindowsRHI::Vulkan] = ParseWindowsRHIConfig(TEXT("VulkanTargetedShaderFormats"));

	// Only add OpenGL support to non-client programs.
	if (!FPlatformProperties::RequiresCookedData())
	{
		Config.RHIConfigs[(int32)EWindowsRHI::OpenGL].ShaderPlatforms.Add(SP_OPENGL_PCES3_1);
		Config.RHIConfigs[(int32)EWindowsRHI::OpenGL].FeatureLevels.Add(ERHIFeatureLevel::ES3_1);