Flutter Impeller
shader_library_gles.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 <memory>
8 
9 #include "flutter/fml/macros.h"
10 #include "flutter/fml/mapping.h"
12 #include "impeller/base/thread.h"
15 
16 namespace impeller {
17 
18 class ShaderLibraryGLES final : public ShaderLibrary {
19  public:
20  // |ShaderLibrary|
21  ~ShaderLibraryGLES() override;
22 
23  // |ShaderLibrary|
24  bool IsValid() const override;
25 
26  private:
27  friend class ContextGLES;
28  const UniqueID library_id_;
29  mutable RWMutex functions_mutex_;
30  ShaderFunctionMap functions_ IPLR_GUARDED_BY(functions_mutex_);
31  bool is_valid_ = false;
32 
34  const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries);
35 
36  // |ShaderLibrary|
37  std::shared_ptr<const ShaderFunction> GetFunction(std::string_view name,
38  ShaderStage stage) override;
39 
40  // |ShaderLibrary|
41  void RegisterFunction(std::string name,
42  ShaderStage stage,
43  std::shared_ptr<fml::Mapping> code,
44  RegistrationCallback callback) override;
45 
46  // |ShaderLibrary|
47  void UnregisterFunction(std::string name, ShaderStage stage) override;
48 
49  FML_DISALLOW_COPY_AND_ASSIGN(ShaderLibraryGLES);
50 };
51 
52 } // namespace impeller
shader_library.h
impeller::ShaderLibraryGLES::IsValid
bool IsValid() const override
Definition: shader_library_gles.cc:93
shader_key.h
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::ShaderLibraryGLES::~ShaderLibraryGLES
~ShaderLibraryGLES() override
impeller::ContextGLES
Definition: context_gles.h:20
impeller::ShaderFunctionMap
std::unordered_map< ShaderKey, std::shared_ptr< const ShaderFunction >, ShaderKey::Hash, ShaderKey::Equal > ShaderFunctionMap
Definition: shader_key.h:43
impeller::ShaderLibraryGLES
Definition: shader_library_gles.h:18
comparable.h
IPLR_GUARDED_BY
#define IPLR_GUARDED_BY(x)
Definition: thread_safety.h:18
impeller::UniqueID
Definition: comparable.h:19
thread.h
impeller
Definition: aiks_context.cc:10