| 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 "impeller/base/backend_cast.h"
11 #include "impeller/renderer/shader_function.h"
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_
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:15
backend_cast.h
impeller::ShaderFunctionMTL::GetMTLFunction
id< MTLFunction > GetMTLFunction() const
Definition: shader_function_mtl.mm:42
impeller::ShaderFunctionMTL
Definition: shader_function_mtl.h:15
impeller::ShaderFunctionMTL::CompileCallback
std::function< void(id< MTLFunction >)> CompileCallback
Definition: shader_function_mtl.h:24
impeller::BackendCast
Definition: backend_cast.h:11
impeller::ShaderLibraryMTL
Definition: shader_library_mtl.h:22
impeller::UniqueID
Definition: comparable.h:16
impeller
Definition: allocation.cc:12