#include <ShaderVariantTreeAsset.h>
Inherits AZ::Data::AssetData.
Public Member Functions | |
AZ_RTTI (ShaderVariantTreeAsset, "{EBF48506-F8BB-4B37-8FAC-F132BF83E42D}", Data::AssetData) | |
AZ_DISABLE_COPY_MOVE (ShaderVariantTreeAsset) | |
size_t | GetNodeCount () const |
Returns the total number of nodes. | |
ShaderVariantSearchResult | FindVariantStableId (const ShaderOptionGroupLayout *shaderOptionGroupLayout, const ShaderVariantId &shaderVariantId) const |
Static Public Member Functions | |
static void | Reflect (ReflectContext *context) |
static Data::AssetId | GetShaderVariantTreeAssetIdFromShaderAssetId (const Data::AssetId &shaderAssetId) |
Friends | |
class | ShaderVariantTreeAssetHandler |
class | ShaderVariantTreeAssetCreator |
struct | ShaderVariantTreeNode |
The shader variant tree is a data structure to perform lookups of shader variants that have the best runtime performance on the GPU. The tree supports the lookup of a best-fit shader variant, given a specific shader variant key. The best-fit variant should have the best runtime performance on the GPU, as it has less dynamic branches.
The algorithm does the following:
The variant searched using the tree has a key that matches the requested key, but some values can be undefined. For example, requesting a key equal to "00101" could return a variant with ID "0?10?", in which ? stands for undefined values. The undefined values must be provided to the fallback constant buffer. (See Shader::FindFallbackShaderResourceGroupAsset).
ShaderVariantSearchResult AZ::RPI::ShaderVariantTreeAsset::FindVariantStableId | ( | const ShaderOptionGroupLayout * | shaderOptionGroupLayout, |
const ShaderVariantId & | shaderVariantId | ||
) | const |
Finds and returns the shader variant index associated with the specified ID. The search involves two general steps: