D3D12TargetedShaderFormats
D3D12TargetedShaderFormats
#Overview
name: D3D12TargetedShaderFormats
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 12
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of D3D12TargetedShaderFormats is to specify the targeted shader formats for DirectX 12 rendering on Windows platforms in Unreal Engine 5.
This setting variable is primarily used by the Windows Target Platform module and the Rendering subsystem of Unreal Engine. It is referenced in various parts of the engine, including the Windows Target Settings, Renderer Settings, and Static Mesh processing.
The value of this variable is set in the project’s configuration files, specifically in the DefaultEngine.ini file under the [/Script/WindowsTargetPlatform.WindowsTargetSettings] section.
D3D12TargetedShaderFormats interacts with other similar variables such as D3D11TargetedShaderFormats and VulkanTargetedShaderFormats. These variables collectively define the supported shader formats for different graphics APIs on Windows.
Developers must be aware that changing this variable requires a restart of the engine (as indicated by the ConfigRestartRequired meta tag). Additionally, this setting affects shader compilation and may impact performance and compatibility across different hardware configurations.
Best practices when using this variable include:
- Ensuring that the appropriate shader formats are included for the targeted hardware and DirectX 12 features.
- Keeping the list up-to-date with the latest supported shader models for DirectX 12.
- Considering the impact on build times and package sizes when including multiple shader formats.
- Coordinating this setting with other graphics API settings to maintain consistency across the project.
- Regularly reviewing and updating this setting as new shader models become available or project requirements change.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:3161, section: [/Script/WindowsTargetPlatform.WindowsTargetSettings]
- INI Section:
/Script/WindowsTargetPlatform.WindowsTargetSettings
- Raw value:
PCD3D_SM5
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:296, section: [/Script/WindowsTargetPlatform.WindowsTargetSettings]
- INI Section:
/Script/WindowsTargetPlatform.WindowsTargetSettings
- Raw value:
PCD3D_SM5
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:297, section: [/Script/WindowsTargetPlatform.WindowsTargetSettings]
- INI Section:
/Script/WindowsTargetPlatform.WindowsTargetSettings
- Raw value:
PCD3D_SM6
- Is Array:
True
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Classes/WindowsTargetSettings.h:52
Scope (from outer to inner):
file
class class UWindowsTargetSettings : public UObject
Source code excerpt:
UPROPERTY(EditAnywhere, config, Category = "Rendering", Meta = (ConfigRestartRequired = true))
TArray<FString> D3D12TargetedShaderFormats;
UPROPERTY(EditAnywhere, config, Category = "Rendering", Meta = (ConfigRestartRequired = true))
TArray<FString> D3D11TargetedShaderFormats;
UPROPERTY(EditAnywhere, config, Category = "Rendering", Meta = (ConfigRestartRequired = true))
TArray<FString> VulkanTargetedShaderFormats;
#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Private/WindowsTargetPlatformClasses.cpp:55
Scope (from outer to inner):
file
function void UWindowsTargetSettings::PostInitProperties
Source code excerpt:
if (!TargetedRHIs_DEPRECATED.IsEmpty())
{
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:309
Scope (from outer to inner):
file
class class TGenericWindowsTargetPlatform : public TTargetPlatformBase<TProperties>
function virtual void GetPlatformSpecificProjectAnalytics
Source code excerpt:
TSuper::AppendAnalyticsEventConfigString(AnalyticsParamArray, TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("DefaultGraphicsRHI"), GEngineIni);
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
#Loc: <Workspace>/Engine/Source/Editor/DetailCustomizations/Private/WindowsTargetSettingsDetails.cpp:202
Scope (from outer to inner):
file
function void FWindowsTargetSettingsDetails::CustomizeDetails
Source code excerpt:
ITargetPlatform* TargetPlatform = FModuleManager::GetModuleChecked<ITargetPlatformModule>("WindowsTargetPlatform").GetTargetPlatforms()[0];
D3D12TargetShaderFormatsDetails = MakeShareable(new FShaderFormatsPropertyDetails(&DetailBuilder, TEXT("D3D12TargetedShaderFormats"), TEXT("D3D12 Targeted Shader Formats")));
D3D12TargetShaderFormatsDetails->CreateTargetShaderFormatsPropertyView(TargetPlatform, &GetFriendlyNameForWindowsShaderPlatformCheckbox, &FilterShaderPlatform_D3D12, ECategoryPriority::Important);
D3D11TargetShaderFormatsDetails = MakeShareable(new FShaderFormatsPropertyDetails(&DetailBuilder, TEXT("D3D11TargetedShaderFormats"), TEXT("D3D11 Targeted Shader Formats")));
D3D11TargetShaderFormatsDetails->CreateTargetShaderFormatsPropertyView(TargetPlatform, &GetFriendlyNameForWindowsShaderPlatformCheckbox, &FilterShaderPlatform_D3D11, ECategoryPriority::Important);
VulkanTargetShaderFormatsDetails = MakeShareable(new FShaderFormatsPropertyDetails(&DetailBuilder, TEXT("VulkanTargetedShaderFormats"), TEXT("Vulkan Targeted Shader Formats")));
#Loc: <Workspace>/Engine/Source/Editor/GameProjectGeneration/Private/GameProjectUtils.cpp:2093
Scope (from outer to inner):
file
function void GameProjectUtils::AddHardwareConfigValues
Source code excerpt:
false /* ShouldReplaceExistingValue */);
// Force clear D3D12TargetedShaderFormats since the BaseEngine list can change at any time.
ConfigValues.Emplace(TEXT("DefaultEngine.ini"),
TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"),
TEXT("!D3D12TargetedShaderFormats"),
TEXT("ClearArray"),
false /* ShouldReplaceExistingValue */);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RendererSettings.cpp:413
Scope (from outer to inner):
file
function void URendererSettings::CheckForMissingShaderModels
Source code excerpt:
TArray<FString> D3D11TargetedShaderFormats;
TArray<FString> D3D12TargetedShaderFormats;
TArray<FString> WindowsVulkanTargetedShaderFormats;
TArray<FString> WindowsTargetedRHIs;
TArray<FString> LinuxVulkanTargetedShaderFormats;
TArray<FString> LinuxTargetedRHIs;
#if PLATFORM_WINDOWS
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RendererSettings.cpp:433
Scope (from outer to inner):
file
function void URendererSettings::CheckForMissingShaderModels
Source code excerpt:
{
GConfig->GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("D3D11TargetedShaderFormats"), D3D11TargetedShaderFormats, GEngineIni);
GConfig->GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("D3D12TargetedShaderFormats"), D3D12TargetedShaderFormats, GEngineIni);
CopySM6Format(TEXT("PCD3D_SM6"), WindowsTargetedRHIs, D3D12TargetedShaderFormats);
}
}
#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);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RendererSettings.cpp:446
Scope (from outer to inner):
file
function void URendererSettings::CheckForMissingShaderModels
Source code excerpt:
#endif
const bool bProjectUsesD3D = (D3D11TargetedShaderFormats.Num() + D3D12TargetedShaderFormats.Num()) > 0;
const bool bProjectMissingD3DSM6 = (bProjectUsesD3D && !D3D12TargetedShaderFormats.Contains(TEXT("PCD3D_SM6")));
const bool bProjectUsesWindowsVulkan = (WindowsVulkanTargetedShaderFormats.Num() > 0);
const bool bProjectMissingWindowsVulkanSM6 = (bProjectUsesWindowsVulkan && !WindowsVulkanTargetedShaderFormats.Contains(TEXT("SF_VULKAN_SM6")));
const bool bProjectUsesLinuxVulkan = (LinuxTargetedRHIs.Num() > 0) || (LinuxVulkanTargetedShaderFormats.Num() > 0);
const bool bProjectMissingLinuxVulkanSM6 = (bProjectUsesLinuxVulkan && !LinuxVulkanTargetedShaderFormats.Contains(TEXT("SF_VULKAN_SM6")));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp:6726
Scope (from outer to inner):
file
function void UStaticMesh::CheckForMissingShaderModels
Source code excerpt:
TArray<FString> D3D11TargetedShaderFormats;
TArray<FString> D3D12TargetedShaderFormats;
TArray<FString> WindowsVulkanTargetedShaderFormats;
TArray<FString> WindowsTargetedRHIs;
TArray<FString> LinuxVulkanTargetedShaderFormats;
TArray<FString> LinuxTargetedRHIs;
#if PLATFORM_WINDOWS
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp:6746
Scope (from outer to inner):
file
function void UStaticMesh::CheckForMissingShaderModels
Source code excerpt:
{
GConfig->GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("D3D11TargetedShaderFormats"), D3D11TargetedShaderFormats, GEngineIni);
GConfig->GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("D3D12TargetedShaderFormats"), D3D12TargetedShaderFormats, GEngineIni);
CopySM6Format(TEXT("PCD3D_SM6"), WindowsTargetedRHIs, D3D12TargetedShaderFormats);
}
}
#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);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp:6759
Scope (from outer to inner):
file
function void UStaticMesh::CheckForMissingShaderModels
Source code excerpt:
#endif
const bool bProjectUsesD3D = (D3D11TargetedShaderFormats.Num() + D3D12TargetedShaderFormats.Num()) > 0;
const bool bProjectMissingD3DSM6 = (bProjectUsesD3D && !D3D12TargetedShaderFormats.Contains(TEXT("PCD3D_SM6")));
const bool bProjectUsesWindowsVulkan = (WindowsVulkanTargetedShaderFormats.Num() > 0);
const bool bProjectMissingWindowsVulkanSM6 = (bProjectUsesWindowsVulkan && !WindowsVulkanTargetedShaderFormats.Contains(TEXT("SF_VULKAN_SM6")));
const bool bProjectUsesLinuxVulkan = (LinuxTargetedRHIs.Num() > 0) || (LinuxVulkanTargetedShaderFormats.Num() > 0);
const bool bProjectMissingLinuxVulkanSM6 = (bProjectUsesLinuxVulkan && !LinuxVulkanTargetedShaderFormats.Contains(TEXT("SF_VULKAN_SM6")));
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/Windows/WindowsDynamicRHI.cpp:345
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);