| Flutter Impeller |

shader_library.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_RENDERER_SHADER_LIBRARY_H_
6 #define FLUTTER_IMPELLER_RENDERER_SHADER_LIBRARY_H_
7
8 #include <future>
9 #include <memory>
10 #include <string_view>
11
12 #include "fml/mapping.h"
13 #include "impeller/core/shader_types.h"
14
15 namespace impeller {
16
17 class Context;
18 class ShaderFunction;
19
20 class ShaderLibrary : public std::enable_shared_from_this<ShaderLibrary> {
21 public:
22 virtual ~ShaderLibrary();
23
24 virtual bool IsValid() const = 0;
25
26 virtual std::shared_ptr<const ShaderFunction> GetFunction(
27 std::string_view name,
28 ShaderStage stage) = 0;
29
30 using RegistrationCallback = std::function<void(bool)>;
31 virtual void RegisterFunction(std::string name,
32 ShaderStage stage,
33 std::shared_ptr<fml::Mapping> code,
34 RegistrationCallback callback);
35
36 virtual void UnregisterFunction(std::string name, ShaderStage stage) = 0;
37
38 protected:
39 ShaderLibrary();
40
41 private:
42 ShaderLibrary(const ShaderLibrary&) = delete;
43
44 ShaderLibrary& operator=(const ShaderLibrary&) = delete;
45 };
46
47 } // namespace impeller
48
49 #endif // FLUTTER_IMPELLER_RENDERER_SHADER_LIBRARY_H_
impeller::ShaderLibrary::GetFunction
virtual std::shared_ptr< const ShaderFunction > GetFunction(std::string_view name, ShaderStage stage)=0
impeller::ShaderLibrary::ShaderLibrary
ShaderLibrary()
impeller::ShaderLibrary::RegistrationCallback
std::function< void(bool)> RegistrationCallback
Definition: shader_library.h:30
impeller::ShaderLibrary
Definition: shader_library.h:20
impeller::ShaderStage
ShaderStage
Definition: shader_types.h:22
impeller::ShaderLibrary::RegisterFunction
virtual void RegisterFunction(std::string name, ShaderStage stage, std::shared_ptr< fml::Mapping > code, RegistrationCallback callback)
Definition: shader_library.cc:13
impeller::ShaderLibrary::IsValid
virtual bool IsValid() const =0
impeller::ShaderLibrary::~ShaderLibrary
virtual ~ShaderLibrary()
impeller::ShaderLibrary::UnregisterFunction
virtual void UnregisterFunction(std::string name, ShaderStage stage)=0
shader_types.h
impeller
Definition: allocation.cc:12