Open 3D Engine Atom Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::RPI::ShaderVariantAsset Class Referencefinal

#include <ShaderVariantAsset.h>

Inherits AZ::Data::AssetData.

Public Member Functions

 AZ_RTTI (ShaderVariantAsset, "{51BED815-36D8-410E-90F0-1FA9FF765FBA}", Data::AssetData)
 
 AZ_DISABLE_COPY_MOVE (ShaderVariantAsset)
 
RPI::ShaderVariantStableId GetStableId () const
 
const ShaderVariantIdGetShaderVariantId () const
 
uint32_t GetSupervariantIndex () const
 
const RHI::ShaderStageFunctionGetShaderStageFunction (RHI::ShaderStage shaderStage) const
 Returns the shader stage function associated with the provided stage enum value.
 
bool IsFullyBaked () const
 
AZ::u64 GetBuildTimestamp () const
 
bool IsRootVariant () const
 

Static Public Member Functions

static void Reflect (ReflectContext *context)
 
static uint32_t MakeAssetProductSubId (uint32_t rhiApiUniqueIndex, uint32_t supervariantIndex, ShaderVariantStableId variantStableId, uint32_t subProductType=0)
 

Static Public Attributes

static constexpr const char * Extension = "azshadervariant"
 
static constexpr const char * DisplayName = "ShaderVariant"
 
static constexpr const char * Group = "Shader"
 
static constexpr uint32_t ShaderVariantAssetSubProductType = 1
 

Friends

class ShaderVariantAssetHandler
 
class ShaderVariantAssetCreator
 

Detailed Description

A ShaderVariantAsset contains the shader byte code for each shader stage (Vertex, Fragment, Tessellation, etc) for a given RHI::APIType (dx12, vulkan, metal, etc). One independent file per RHI::APIType.

Member Function Documentation

◆ GetBuildTimestamp()

AZ::u64 AZ::RPI::ShaderVariantAsset::GetBuildTimestamp ( ) const

Return the timestamp when this asset was built, and it must be >= than the timestamp of the main ShaderAsset. This is used to synchronize versions of the ShaderAsset and ShaderVariantAsset, especially during hot-reload.

◆ IsFullyBaked()

bool AZ::RPI::ShaderVariantAsset::IsFullyBaked ( ) const

Returns whether the variant is fully baked variant (all options are static branches), or false if the variant uses dynamic branches for some shader options. If the shader variant is not fully baked, the ShaderVariantKeyFallbackValue must be correctly set when drawing.

◆ MakeAssetProductSubId()

static uint32_t AZ::RPI::ShaderVariantAsset::MakeAssetProductSubId ( uint32_t  rhiApiUniqueIndex,
uint32_t  supervariantIndex,
ShaderVariantStableId  variantStableId,
uint32_t  subProductType = 0 
)
static

@rhiApiUniqueIndex comes from RHI::Factory::GetAPIUniqueIndex() @subProductType is always 0 for a regular ShaderVariantAsset, for all other debug subProducts created by ShaderVariantAssetBuilder this is 1+.


The documentation for this class was generated from the following file: