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::ShaderOptionGroup Class Referencefinal

Public Member Functions

 AZ_TYPE_INFO (ShaderOptionGroup, "{906F69F5-52F0-4095-9562-0E91DDDE6E2F}")
 
 AZ_CLASS_ALLOCATOR (ShaderOptionGroup, AZ::ThreadPoolAllocator)
 
 ShaderOptionGroup (const ShaderOptionGroup &rhs)
 
 ShaderOptionGroup (const ConstPtr< ShaderOptionGroupLayout > &shaderOptionGroupLayout)
 
 ShaderOptionGroup (const ConstPtr< ShaderOptionGroupLayout > &shaderOptionGroupLayout, const ShaderVariantId &id)
 
void Clear ()
 Clears all values in the group back to empty.
 
void SetAllToDefaultValues ()
 Resets all shader options to their default values.
 
void SetUnspecifiedToDefaultValues ()
 Resets unspecified shader options to their default values.
 
bool IsFullySpecified () const
 Returns whether all options have been specified. This would indicate a fully baked shader variant.
 
bool IsEmpty () const
 Returns true when no options have been specified. This would indicate a root shader variant.
 
ShaderOptionIndex FindShaderOptionIndex (const Name &optionName) const
 
bool SetValue (const Name &optionName, const Name &valueName)
 
bool SetValue (const Name &optionName, ShaderOptionValue valueIndex)
 
ShaderOptionValue GetValue (const Name &optionName) const
 
bool SetValue (ShaderOptionIndex optionIndex, const Name &valueName)
 
bool SetValue (ShaderOptionIndex optionIndex, ShaderOptionValue valueIndex)
 
ShaderOptionValue GetValue (ShaderOptionIndex optionIndex) const
 
bool ClearValue (const Name &optionName)
 
bool ClearValue (ShaderOptionIndex optionIndex)
 Resets the shader option value to an uninitialized state.
 
const ShaderVariantKey & GetShaderVariantKey () const
 Returns the constructed key.
 
const ShaderVariantKey & GetShaderVariantMask () const
 Returns the constructed mask.
 
const ShaderVariantIdGetShaderVariantId () const
 Returns the constructed id, which contains both the shader variant key and mask.
 
const ShaderOptionGroupLayoutGetShaderOptionLayout () const
 Returns the shader option layout used to build the key.
 
const AZStd::vector< ShaderOptionDescriptor > & GetShaderOptionDescriptors () const
 Returns the shader option descriptors.
 
ShaderVariantKey GetShaderVariantKeyFallbackValue () const
 
AZStd::string ToString () const
 Dump the names and values of all shader options, used for debug output.
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 

Friends

class ShaderOptionDescriptor
 

Member Function Documentation

◆ ClearValue()

bool AZ::RPI::ShaderOptionGroup::ClearValue ( const Name &  optionName)

Resets the shader option value to an uninitialized state. For performance reasons consider caching the index for optionName and calling void ClearValue(ShaderOptionIndex optionIndex) instead.

◆ FindShaderOptionIndex()

ShaderOptionIndex AZ::RPI::ShaderOptionGroup::FindShaderOptionIndex ( const Name &  optionName) const

Returns the shader option index associated with the shader option id, or a null index if the id was not found.

◆ GetShaderVariantKeyFallbackValue()

ShaderVariantKey AZ::RPI::ShaderOptionGroup::GetShaderVariantKeyFallbackValue ( ) const

The fallback value for this shader option group, to be used in ShaderResourceGroup::SetShaderVariantKeyFallbackValue. Any unspecified shader option values will be set to their defaults.

◆ GetValue() [1/2]

ShaderOptionValue AZ::RPI::ShaderOptionGroup::GetValue ( const Name &  optionName) const

Helper method which gets the value for the shader option specified by optionName. For performance reasons consider caching the index for optionName and calling void GetValue(ShaderOptionIndex optionIndex) instead.

◆ GetValue() [2/2]

ShaderOptionValue AZ::RPI::ShaderOptionGroup::GetValue ( ShaderOptionIndex  optionIndex) const

Helper method which gets the value set for the shader option specified by optionIndex. If you have previously cached the shader option descriptor, you might want to use ShaderOptionDescriptor::Get(ShaderOptionGroup&) instead. Returns a Null ShaderOptionValue if the value is unspecified.

◆ SetValue() [1/4]

bool AZ::RPI::ShaderOptionGroup::SetValue ( const Name &  optionName,
const Name &  valueName 
)

Helper method which assigns a value (valueId) to the shader option specified by optionName. For performance reasons consider caching the indices for both names and calling void SetValue(ShaderOptionIndex optionIndex, ShaderOptionValue value) instead.

◆ SetValue() [2/4]

bool AZ::RPI::ShaderOptionGroup::SetValue ( const Name &  optionName,
ShaderOptionValue  valueIndex 
)

Helper method which assigns a value to the shader option specified by optionName. For performance reasons consider caching the index for optionName and calling void SetValue(ShaderOptionIndex optionIndex, ShaderOptionValue value) instead.

◆ SetValue() [3/4]

bool AZ::RPI::ShaderOptionGroup::SetValue ( ShaderOptionIndex  optionIndex,
const Name &  valueName 
)

Helper method which assigns a value (valueId) to the shader option specified by optionIndex. For performance reasons consider caching the index for valueName and calling void SetValue(ShaderOptionIndex optionIndex, ShaderOptionValue value) instead.

◆ SetValue() [4/4]

bool AZ::RPI::ShaderOptionGroup::SetValue ( ShaderOptionIndex  optionIndex,
ShaderOptionValue  valueIndex 
)

Helper method which assigns a value to the shader option specified by optionIndex If you have previously cached the shader option descriptor, you might want to use ShaderOptionDescriptor::Set(ShaderOptionGroup&, const ShaderOptionValue&) instead.


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