| 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 #pragma once
6
7 #include <future>
8 #include <memory>
9 #include <string_view>
10
11 #include "flutter/fml/macros.h"
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 FML_DISALLOW_COPY_AND_ASSIGN(ShaderLibrary);
43 };
44
45 } // namespace impeller
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:20
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: aiks_context.cc:10