An immutable collection of shaders loaded from a shader bundle asset. More...
#include <shader_library.h>
Public Types | |
| using | ShaderMap = std::unordered_map< std::string, fml::RefPtr< Shader > > |
Public Types inherited from tonic::DartWrappable | |
| enum | DartNativeFields { kPeerIndex , kNumberOfNativeFields } |
Public Member Functions | |
| std::string | ReloadFromAsset (impeller::Context::BackendType backend_type, const std::string &name) |
| std::string | ReloadFromFlatbuffer (impeller::Context::BackendType backend_type, std::shared_ptr< fml::Mapping > payload) |
| fml::RefPtr< Shader > | GetShader (const std::string &shader_name, Dart_Handle shader_wrapper) |
| const std::string & | GetLibraryId () const |
| ~ShaderLibrary () override | |
Public Member Functions inherited from flutter::RefCountedDartWrappable< ShaderLibrary > | |
| virtual void | RetainDartWrappableReference () const override |
| virtual void | ReleaseDartWrappableReference () const override |
Public Member Functions inherited from fml::RefCountedThreadSafe< T > | |
| void | Release () const |
Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase | |
| void | AddRef () const |
| bool | HasOneRef () const |
| void | AssertHasOneRef () const |
Public Member Functions inherited from tonic::DartWrappable | |
| DartWrappable () | |
| virtual const DartWrapperInfo & | GetDartWrapperInfo () const =0 |
| Dart_Handle | CreateDartWrapper (DartState *dart_state) |
| void | AssociateWithDartWrapper (Dart_Handle wrappable) |
| void | ClearDartWrapper () |
| Dart_WeakPersistentHandle | dart_wrapper () const |
Static Public Member Functions | |
| static fml::RefPtr< ShaderLibrary > | MakeFromAsset (impeller::Context::BackendType backend_type, const std::string &name, std::string &out_error) |
| static fml::RefPtr< ShaderLibrary > | MakeFromShaders (ShaderMap shaders) |
| static fml::RefPtr< ShaderLibrary > | MakeFromFlatbuffer (impeller::Context::BackendType backend_type, std::shared_ptr< fml::Mapping > payload, std::string library_id="") |
| static void | SetOverride (fml::RefPtr< ShaderLibrary > override_shader_library) |
Sets a return override for MakeFromAsset for testing purposes. | |
Additional Inherited Members | |
Protected Member Functions inherited from fml::RefCountedThreadSafe< T > | |
| RefCountedThreadSafe () | |
| ~RefCountedThreadSafe () | |
Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase | |
| RefCountedThreadSafeBase () | |
| ~RefCountedThreadSafeBase () | |
| bool | Release () const |
| void | Adopt () |
Protected Member Functions inherited from tonic::DartWrappable | |
| virtual | ~DartWrappable () |
Static Protected Member Functions inherited from tonic::DartWrappable | |
| static Dart_PersistentHandle | GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info) |
An immutable collection of shaders loaded from a shader bundle asset.
Definition at line 21 of file shader_library.h.
| using flutter::gpu::ShaderLibrary::ShaderMap = std::unordered_map<std::string, fml::RefPtr<Shader> > |
Definition at line 26 of file shader_library.h.
|
overridedefault |
|
inline |
Definition at line 65 of file shader_library.h.
| fml::RefPtr< Shader > flutter::gpu::ShaderLibrary::GetShader | ( | const std::string & | shader_name, |
| Dart_Handle | shader_wrapper | ||
| ) |
Definition at line 406 of file shader_library.cc.
Referenced by InternalFlutterGpu_ShaderLibrary_GetShader().
|
static |
Definition at line 29 of file shader_library.cc.
References flutter::UIDartState::Current(), flutter::data, MakeFromFlatbuffer(), and flutter::name.
Referenced by InternalFlutterGpu_ShaderLibrary_InitializeWithAsset().
|
static |
library_id is a stable identifier (typically the asset path the bundle was loaded from) used to namespace the shaders' entrypoints in the shared shader registry, so they cannot collide with engine-internal shaders or with shaders from a different bundle. If empty, a process-unique fallback is generated.
Definition at line 338 of file shader_library.cc.
References impeller::ShaderKey::MakeFallbackLibraryId(), and flutter::gpu::ParseShaderBundle().
Referenced by impeller::testing::InstantiateTestShaderLibrary(), and MakeFromAsset().
|
static |
Definition at line 50 of file shader_library.cc.
| std::string flutter::gpu::ShaderLibrary::ReloadFromAsset | ( | impeller::Context::BackendType | backend_type, |
| const std::string & | name | ||
| ) |
Re-fetches name from the AssetManager and reparses it into this library, preserving Dart object identity and the library_id so any already-handed-out Shader instances continue to work. Existing Shader entries whose names appear in the new bundle are mutated in place and marked dirty so the next pipeline build evicts and re-registers them. Returns the empty string on success.
Definition at line 356 of file shader_library.cc.
References flutter::UIDartState::Current(), flutter::data, flutter::name, and ReloadFromFlatbuffer().
Referenced by InternalFlutterGpu_ShaderLibrary_ReinitializeWithAsset().
| std::string flutter::gpu::ShaderLibrary::ReloadFromFlatbuffer | ( | impeller::Context::BackendType | backend_type, |
| std::shared_ptr< fml::Mapping > | payload | ||
| ) |
Reparses payload into this library, preserving Dart object identity and the library_id. Returns the empty string on success.
Definition at line 370 of file shader_library.cc.
References flutter::name, and flutter::gpu::ParseShaderBundle().
Referenced by ReloadFromAsset().
|
static |
Sets a return override for MakeFromAsset for testing purposes.
Definition at line 401 of file shader_library.cc.
Referenced by impeller::testing::InstantiateTestShaderLibrary().