| 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
10 #include "flutter/fml/macros.h"
11 #include "impeller/base/backend_cast.h"
12 #include "impeller/renderer/shader_function.h"
13
14 namespace impeller {
15
16 class ShaderFunctionMTL final
17 : public ShaderFunction,
18 public BackendCast<ShaderFunctionMTL, ShaderFunction> {
19 public:
20 // |ShaderFunction|
21 ~ShaderFunctionMTL() override;
22
23 id<MTLFunction> GetMTLFunction() const;
24
25 using CompileCallback = std::function<void(id<MTLFunction>)>;
26
27 void GetMTLFunctionSpecialized(const std::vector<Scalar>& constants,
28 const CompileCallback& callback) const;
29
30 private:
31 friend class ShaderLibraryMTL;
32
33 id<MTLFunction> function_ = nullptr;
34 id<MTLLibrary> library_ = nullptr;
35
36 ShaderFunctionMTL(UniqueID parent_library_id,
37 id<MTLFunction> function,
38 id<MTLLibrary> library,
39 std::string name,
40 ShaderStage stage);
41
42 ShaderFunctionMTL(const ShaderFunctionMTL&) = delete;
43
44 ShaderFunctionMTL& operator=(const ShaderFunctionMTL&) = delete;
45 };
46
47 } // namespace impeller
48
49 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_SHADER_FUNCTION_MTL_H_
shader_function.h
impeller::ShaderStage
ShaderStage
Definition: shader_types.h:22
impeller::ShaderFunctionMTL::GetMTLFunctionSpecialized
void GetMTLFunctionSpecialized(const std::vector< Scalar > &constants, const CompileCallback &callback) const
Definition: shader_function_mtl.mm:20
impeller::ShaderFunctionMTL::~ShaderFunctionMTL
~ShaderFunctionMTL() override
impeller::ShaderFunction
Definition: shader_function.h:16
backend_cast.h
impeller::ShaderFunctionMTL::GetMTLFunction
id< MTLFunction > GetMTLFunction() const
Definition: shader_function_mtl.mm:42
impeller::ShaderFunctionMTL
Definition: shader_function_mtl.h:16
impeller::ShaderFunctionMTL::CompileCallback
std::function< void(id< MTLFunction >)> CompileCallback
Definition: shader_function_mtl.h:25
impeller::BackendCast
Definition: backend_cast.h:13
impeller::ShaderLibraryMTL
Definition: shader_library_mtl.h:23
impeller::UniqueID
Definition: comparable.h:16
impeller
Definition: aiks_context.cc:10