MapLibre Native Core
|
A ShaderRegistry contains a collection of gfx::Shader instances. Using the registry, shaders may be dynamically registered or replaced at runtime. More...
#include <shader_registry.hpp>
Public Member Functions | |
ShaderRegistry () | |
ShaderRegistry (const ShaderRegistry &)=delete | |
ShaderRegistry (ShaderRegistry &&) noexcept=delete | |
ShaderRegistry & | operator= (const ShaderRegistry &)=delete |
ShaderRegistry & | operator= (ShaderRegistry &&) noexcept=delete |
virtual | ~ShaderRegistry ()=default |
virtual bool | isShader (const std::string &shaderName) const noexcept |
Checks if a shader exists in the registry for the given name. More... | |
virtual const std::shared_ptr< gfx::Shader > | getShader (const std::string &shaderName) const noexcept |
Get a shader from the registry by name. More... | |
virtual bool | replaceShader (std::shared_ptr< Shader > &&shader) noexcept |
Replace a matching shader in the registry with the provided instance. Shader type-names must match. More... | |
virtual bool | replaceShader (std::shared_ptr< Shader > &&shader, const std::string &shaderName) noexcept |
Replace a matching shader in the registry with the provided instance. Shader type-names must match. This variant replaces by explicit name. More... | |
virtual bool | registerShader (std::shared_ptr< Shader > &&shader) noexcept |
Register a new shader with the registry. If a shader is present in the registry with a conflicting name, registration will fail. More... | |
virtual bool | registerShader (std::shared_ptr< Shader > &&shader, const std::string &shaderName) noexcept |
Register a new shader with the registry. If a shader is present in the registry with a conflicting name, registration will fail. This variant registers using an explicit name. More... | |
template<typename T , typename std::enable_if_t< is_shader_v< T >, bool > * = nullptr> | |
std::shared_ptr< T > | get (const std::string &shaderName) noexcept |
Shorthand helper to quickly get a derived type from the registry. More... | |
template<typename T , typename std::enable_if_t< is_shader_v< T >, bool > * = nullptr> | |
std::shared_ptr< T > | get () noexcept |
Shorthand helper to quickly get a derived type from the registry. This variant looks up shaders only by type name. More... | |
template<typename T , typename std::enable_if_t< is_shader_v< T >, bool > * = nullptr> | |
bool | populate (std::shared_ptr< T > &to, const std::string &shaderName) noexcept |
Ensure the destination 'to' is populated with the requested shader. If already non-null, does nothing. More... | |
template<typename T , typename std::enable_if_t< is_shader_v< T >, bool > * = nullptr> | |
bool | populate (std::shared_ptr< T > &to) noexcept |
Ensure the destination 'to' is populated with the requested shader. If already non-null, does nothing. This variant looks up shaders only by type name. More... | |
A ShaderRegistry contains a collection of gfx::Shader instances. Using the registry, shaders may be dynamically registered or replaced at runtime.
Definition at line 16 of file shader_registry.hpp.
|
explicit |
|
delete |
|
deletenoexcept |
|
virtualdefault |
|
inlinenoexcept |
Shorthand helper to quickly get a derived type from the registry. This variant looks up shaders only by type name.
T | Derived type, inheriting gfx::Shader |
Definition at line 96 of file shader_registry.hpp.
|
inlinenoexcept |
Shorthand helper to quickly get a derived type from the registry.
T | Derived type, inheriting gfx::Shader |
shaderName | The registry name to look up |
Definition at line 82 of file shader_registry.hpp.
|
virtualnoexcept |
Get a shader from the registry by name.
shaderName | Name of shader |
gfx::Shader
or nullptr
if no shader is found with the given name
|
virtualnoexcept |
Checks if a shader exists in the registry for the given name.
shaderName | Name of shader |
|
delete |
|
deletenoexcept |
|
inlinenoexcept |
Ensure the destination 'to' is populated with the requested shader. If already non-null, does nothing. This variant looks up shaders only by type name.
T | Derived type, inheriting gfx::Shader |
to | Location to store the shader |
Definition at line 133 of file shader_registry.hpp.
|
inlinenoexcept |
Ensure the destination 'to' is populated with the requested shader. If already non-null, does nothing.
T | Derived type, inheriting gfx::Shader |
to | Location to store the shader |
shaderName | The registry name to look up |
Definition at line 112 of file shader_registry.hpp.
|
virtualnoexcept |
Register a new shader with the registry. If a shader is present in the registry with a conflicting name, registration will fail.
shader | A gfx::Shader to register. The ShaderRegistry will take ownership. |
|
virtualnoexcept |
Register a new shader with the registry. If a shader is present in the registry with a conflicting name, registration will fail. This variant registers using an explicit name.
shader | A gfx::Shader to register. The ShaderRegistry will take ownership. |
shaderName | Unique name to register the shader under. |
|
virtualnoexcept |
Replace a matching shader in the registry with the provided instance. Shader type-names must match.
shader | A gfx::Shader . The ShaderRegistry will take ownership. |
|
virtualnoexcept |
Replace a matching shader in the registry with the provided instance. Shader type-names must match. This variant replaces by explicit name.
shader | A gfx::Shader . The ShaderRegistry will take ownership. |
shaderName | Unique name to register the shader under. |