bIsSPIRV
bIsSPIRV
#Overview
name: bIsSPIRV
The value of this variable can be defined or overridden in .ini config files. 4
.ini config files referencing this setting variable.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bIsSPIRV is to indicate whether a specific shader platform supports or uses SPIR-V (Standard Portable Intermediate Representation - Vulkan) as its shader intermediate language.
This setting variable is primarily used in the rendering system of Unreal Engine 5, specifically within the RHI (Rendering Hardware Interface) module. It’s part of the data-driven shader platform information system, which allows for flexible configuration of shader compilation and execution across different graphics APIs and hardware platforms.
The value of this variable is set during the parsing of data-driven shader information, as seen in the ParseDataDrivenShaderInfo
function in the DataDrivenShaderPlatformInfo.cpp
file. It’s stored as a bit field within the FGenericDataDrivenShaderPlatformInfo
class.
bIsSPIRV interacts with other shader platform configuration variables, such as bIsHlslcc
, bSupportsDxc
, and bSupportsVariableRateShading
. These variables collectively define the capabilities and characteristics of a specific shader platform.
Developers must be aware that this variable affects how shaders are compiled and processed for different graphics APIs. When bIsSPIRV is true, it indicates that the shader code should be compiled to or is expected to be in SPIR-V format, which is primarily used with Vulkan but can also be used with other APIs that support it.
Best practices when using this variable include:
- Ensure that the correct value is set for each supported platform to avoid shader compilation issues.
- Consider the implications of SPIR-V support when writing cross-platform shader code.
- Use the provided accessor method
GetIsSPIRV
to check for SPIR-V support rather than accessing the variable directly. - Be aware of the potential performance implications and API requirements when SPIR-V is used.
- Coordinate with the graphics programming team to ensure that the shader compilation pipeline is correctly configured for SPIR-V when this flag is set.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/Mac/DataDrivenPlatformInfo.ini:46, section: [ShaderPlatform METAL_SM5]
- INI Section:
ShaderPlatform METAL_SM5
- Raw value:
true
- Is Array:
False
Location: <Workspace>/Engine/Config/Mac/DataDrivenPlatformInfo.ini:86, section: [ShaderPlatform METAL_SM6]
- INI Section:
ShaderPlatform METAL_SM6
- Raw value:
true
- Is Array:
False
Location: <Workspace>/Engine/Config/VulkanPC/DataDrivenPlatformInfo.ini:22, section: [ShaderPlatform VULKAN_SM5]
- INI Section:
ShaderPlatform VULKAN_SM5
- Raw value:
true
- Is Array:
False
Location: <Workspace>/Engine/Config/VulkanPC/DataDrivenPlatformInfo.ini:153, section: [ShaderPlatform VULKAN_SM6]
- INI Section:
ShaderPlatform VULKAN_SM6
- Raw value:
true
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/DataDrivenShaderPlatformInfo.cpp:264
Scope (from outer to inner):
file
function void FGenericDataDrivenShaderPlatformInfo::ParseDataDrivenShaderInfo
Source code excerpt:
GET_SECTION_BOOL_HELPER(bSupportsDxc);
GET_SECTION_BOOL_HELPER(bSupportsVariableRateShading);
GET_SECTION_BOOL_HELPER(bIsSPIRV);
GET_SECTION_INT_HELPER(NumberOfComputeThreads);
GET_SECTION_BOOL_HELPER(bWaterUsesSimpleForwardShading);
GET_SECTION_BOOL_HELPER(bSupportsHairStrandGeometry);
GET_SECTION_BOOL_HELPER(bSupportsDOFHybridScattering);
GET_SECTION_BOOL_HELPER(bNeedsExtraMobileFrames);
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:87
Scope (from outer to inner):
file
class class FGenericDataDrivenShaderPlatformInfo
Source code excerpt:
uint32 bIsHlslcc : 1;
uint32 bSupportsDxc : 1; // Whether DirectXShaderCompiler (DXC) is supported
uint32 bIsSPIRV : 1;
uint32 bSupportsVariableRateShading : 1;
uint32 NumberOfComputeThreads : 10;
uint32 bWaterUsesSimpleForwardShading : 1;
uint32 bSupportsHairStrandGeometry : 1;
uint32 bSupportsDOFHybridScattering : 1;
uint32 bNeedsExtraMobileFrames : 1;
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:605
Scope (from outer to inner):
file
class class FGenericDataDrivenShaderPlatformInfo
function static const bool GetIsSPIRV
Source code excerpt:
{
check(IsValid(Platform));
return Infos[Platform].bIsSPIRV;
}
static FORCEINLINE_DEBUGGABLE const bool GetSupportsVariableRateShading(const FStaticShaderPlatform Platform)
{
check(IsValid(Platform));
return Infos[Platform].bSupportsVariableRateShading;