Flutter Impeller
shader_function_mtl.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_BACKEND_METAL_SHADER_FUNCTION_MTL_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_SHADER_FUNCTION_MTL_H_
7 
8 #include <Metal/Metal.h>
9 
12 
13 namespace impeller {
14 
15 class ShaderFunctionMTL final
16  : public ShaderFunction,
17  public BackendCast<ShaderFunctionMTL, ShaderFunction> {
18  public:
19  // |ShaderFunction|
20  ~ShaderFunctionMTL() override;
21 
22  id<MTLFunction> GetMTLFunction() const;
23 
24  using CompileCallback = std::function<void(id<MTLFunction>)>;
25 
26  void GetMTLFunctionSpecialized(const std::vector<Scalar>& constants,
27  const CompileCallback& callback) const;
28 
29  private:
30  friend class ShaderLibraryMTL;
31 
32  id<MTLFunction> function_ = nullptr;
33  id<MTLLibrary> library_ = nullptr;
34 
35  ShaderFunctionMTL(UniqueID parent_library_id,
36  id<MTLFunction> function,
37  id<MTLLibrary> library,
38  std::string name,
39  ShaderStage stage);
40 
41  ShaderFunctionMTL(const ShaderFunctionMTL&) = delete;
42 
43  ShaderFunctionMTL& operator=(const ShaderFunctionMTL&) = delete;
44 };
45 
46 } // namespace impeller
47 
48 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_SHADER_FUNCTION_MTL_H_
void GetMTLFunctionSpecialized(const std::vector< Scalar > &constants, const CompileCallback &callback) const
std::function< void(id< MTLFunction >)> CompileCallback
id< MTLFunction > GetMTLFunction() const