SupportsBarycentricsSemantic
SupportsBarycentricsSemantic
#Overview
name: SupportsBarycentricsSemantic
The value of this variable can be defined or overridden in .ini config files. 2
.ini config files referencing this setting variable.
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of SupportsBarycentricsSemantic is to indicate whether the current rendering hardware and driver support barycentric coordinates as a shader input semantic. This is primarily used in the rendering system, specifically for advanced shading techniques that require access to barycentric coordinates within shaders.
This setting variable is relied upon by several Unreal Engine subsystems and modules:
- The D3D12RHI module uses it to determine shader compatibility.
- The RHI (Rendering Hardware Interface) module uses it for shader platform information and feature support.
- The Renderer module, specifically the Nanite system, uses it to determine shader permutations.
- The VulkanRHI module sets this variable during initialization.
The value of this variable is set in different places depending on the graphics API being used:
- For D3D12, it’s set in FD3D12Adapter::InitializeDevices() based on the D3D12 feature support.
- For Vulkan, it’s set to true in the FVulkanDynamicRHI constructor.
- It can also be set through data-driven shader platform information parsing.
This variable interacts with other variables and systems related to shader compilation and execution. For example, it’s used in conjunction with EShaderCodeFeatures::BarycentricsSemantic to validate shader usability.
Developers should be aware that:
- This feature may not be supported on all hardware or graphics APIs.
- Its availability can affect shader compilation and runtime behavior.
- It’s particularly important for advanced rendering techniques that rely on barycentric coordinates.
Best practices when using this variable include:
- Always check its value before attempting to use barycentric semantics in shaders.
- Provide fallback rendering paths for cases where it’s not supported.
- Use it in conjunction with other feature checks to ensure compatibility across different platforms and hardware configurations.
- Consider its value when optimizing rendering pipelines, as it can affect shader permutations and performance.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/VulkanPC/DataDrivenPlatformInfo.ini:258, section: [ShaderPlatform VULKAN_SM6]
- INI Section:
ShaderPlatform VULKAN_SM6
- Raw value:
RuntimeGuaranteed
- Is Array:
False
Location: <Workspace>/Engine/Config/Windows/DataDrivenPlatformInfo.ini:138, section: [ShaderPlatform PCD3D_SM6]
- INI Section:
ShaderPlatform PCD3D_SM6
- Raw value:
RuntimeDependent
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/D3D12RHI/Private/D3D12Adapter.cpp:1076
Scope (from outer to inner):
file
function void FD3D12Adapter::InitializeDevices
Source code excerpt:
D3D12_FEATURE_DATA_D3D12_OPTIONS3 Features{};
RootDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS3, &Features, sizeof(Features));
GRHIGlobals.SupportsBarycentricsSemantic = Features.BarycentricsSupported;
}
{
D3D12_FEATURE_DATA_D3D12_OPTIONS4 Features{};
RootDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS4, &Features, sizeof(Features));
GRHIGlobals.SupportsNative16BitOps = Features.Native16BitShaderOpsSupported;
#Loc: <Workspace>/Engine/Source/Runtime/D3D12RHI/Private/D3D12Shaders.cpp:87
Scope (from outer to inner):
file
function static bool ValidateShaderIsUsable
Source code excerpt:
}
if (EnumHasAnyFlags(InShader->Features, EShaderCodeFeatures::BarycentricsSemantic) && !GRHIGlobals.SupportsBarycentricsSemantic)
{
return false;
}
#endif
return true;
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/DataDrivenShaderPlatformInfo.cpp:295
Scope (from outer to inner):
file
function void FGenericDataDrivenShaderPlatformInfo::ParseDataDrivenShaderInfo
Source code excerpt:
GET_SECTION_INT_HELPER(MaxSamplers);
GET_SECTION_BOOL_HELPER(SupportsBarycentricsIntrinsics);
GET_SECTION_SUPPORT_HELPER(SupportsBarycentricsSemantic);
GET_SECTION_BOOL_HELPER(bSupportsWave64);
#undef GET_SECTION_BOOL_HELPER
#undef GET_SECTION_INT_HELPER
#undef GET_SECTION_SUPPORT_HELPER
#undef ADD_TO_PROPERTIES_STRING
#undef ADD_PROPERTY_TO_SHADERPLATFORM_FUNCTIONMAP
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:121
Scope (from outer to inner):
file
class class FGenericDataDrivenShaderPlatformInfo
Source code excerpt:
uint32 MaxSamplers : 8;
uint32 SupportsBarycentricsIntrinsics : 1;
uint32 SupportsBarycentricsSemantic : int32(ERHIFeatureSupport::NumBits);
uint32 bSupportsWave64 : 1;
// NOTE: When adding fields, you must also add to ParseDataDrivenShaderInfo!
uint32 bContainsValidPlatformInfo : 1;
FGenericDataDrivenShaderPlatformInfo()
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:785
Scope (from outer to inner):
file
class class FGenericDataDrivenShaderPlatformInfo
function static const ERHIFeatureSupport GetSupportsBarycentricsSemantic
Source code excerpt:
{
check(IsValid(Platform));
return ERHIFeatureSupport(Infos[Platform].SupportsBarycentricsSemantic);
}
static FORCEINLINE_DEBUGGABLE const bool GetSupportsWave64(const FStaticShaderPlatform Platform)
{
check(IsValid(Platform));
return Infos[Platform].bSupportsWave64;
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/RHIGlobals.h:644
Scope: file
Source code excerpt:
/** True if the RHI supports shaders with barycentrics */
bool SupportsBarycentricsSemantic = false;
/** True if HDR requires vendor specific extensions */
bool HDRNeedsVendorExtensions = false;
/** True if RHI supports MSAA resolve with a custom shader */
bool SupportsMSAAShaderResolve = false;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:396
Scope (from outer to inner):
file
function static bool ShouldUseSvBarycentricPermutation
Source code excerpt:
// Only use the barycentric permutation when support is runtime guaranteed or if we're dependent and the global cap flag is set.
if (BarycentricsSemanticSupport == ERHIFeatureSupport::RuntimeGuaranteed ||
(BarycentricsSemanticSupport == ERHIFeatureSupport::RuntimeDependent && GRHIGlobals.SupportsBarycentricsSemantic))
{
return true;
}
return false;
}
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanRHI.cpp:513
Scope (from outer to inner):
file
function FVulkanDynamicRHI::FVulkanDynamicRHI
Source code excerpt:
GConfig->GetInt(TEXT("TextureStreaming"), TEXT("PoolSizeVRAMPercentage"), GPoolSizeVRAMPercentage, GEngineIni);
GRHIGlobals.SupportsBarycentricsSemantic = true;
static const auto CVarPSOPrecaching = IConsoleManager::Get().FindConsoleVariable(TEXT("r.PSOPrecaching"));
GRHISupportsPSOPrecaching = FVulkanChunkedPipelineCacheManager::IsEnabled() && (CVarPSOPrecaching && CVarPSOPrecaching->GetInt() != 0) && CVarAllowVulkanPSOPrecache.GetValueOnAnyThread();
GRHISupportsPipelineFileCache = !GRHISupportsPSOPrecaching || CVarEnableVulkanPSOFileCacheWhenPrecachingActive.GetValueOnAnyThread();
UE_LOG(LogVulkanRHI, Log, TEXT("Vulkan PSO Precaching = %d, PipelineFileCache = %d"), GRHISupportsPSOPrecaching, GRHISupportsPipelineFileCache);