class
CrShader::VariantCache
- CrShader::VariantCache
- Reference
- Object
Overview
============================================================================= VariantCache - Thread-Safe O(1) Shader Permutation & Specialization Cache
Maps (source, target, strip_debug_inspects, optimize_names, sorted features) via 64-bit FNV-1a hashing to compiled shader source code (and live Godot::Shader resources when loaded in the Godot / Lapis runtime).
Defined in:
crshader/runtime/variant_cache.crcrshader_resource.cr
Constant Summary
-
FNV_OFFSET_BASIS =
14695981039346656037_u64 -
FNV_PRIME =
1099511628211_u64
Constructors
Class Method Summary
- .canonical_feature_signature(features : Hash(String, FeatureValue) | Nil) : String
- .compute_key(source : String, target : ShaderTarget | Nil, features : Hash(String, FeatureValue) | Nil = nil, strip_debug_inspects : Bool = false, optimize_names : Bool = false) : Tuple(UInt64, String)
- .normalize_feature_val(val : FeatureValue) : String
Instance Method Summary
- #clear! : Void
- #get_or_compile(source : String, target : ShaderTarget | Nil = nil, features : Hash(String, FeatureValue) | Nil = nil, strip_debug_inspects : Bool = false, optimize_names : Bool = false, filename : String | Nil = nil) : CachedVariant
- #get_or_create_godot_shader(source : String, features : Hash(String, FeatureValue) | Nil = nil, strip_debug_inspects : Bool = false, optimize_names : Bool = false, filename : String | Nil = nil) : Godot::Shader | Nil
- #hits : Int64
- #max_entries : Int32
- #max_entries=(max_entries : Int32)
- #misses : Int64
- #stats : CacheStats
Constructor Detail
Class Method Detail
def self.compute_key(source : String, target : ShaderTarget | Nil, features : Hash(String, FeatureValue) | Nil = nil, strip_debug_inspects : Bool = false, optimize_names : Bool = false) : Tuple(UInt64, String)
#
Instance Method Detail
def get_or_compile(source : String, target : ShaderTarget | Nil = nil, features : Hash(String, FeatureValue) | Nil = nil, strip_debug_inspects : Bool = false, optimize_names : Bool = false, filename : String | Nil = nil) : CachedVariant
#
def get_or_create_godot_shader(source : String, features : Hash(String, FeatureValue) | Nil = nil, strip_debug_inspects : Bool = false, optimize_names : Bool = false, filename : String | Nil = nil) : Godot::Shader | Nil
#