| Flutter Impeller |

Public Types | Public Member Functions | Friends | List of all members
impeller::ShaderFunctionMTL Class Referencefinal

`#include <shader_function_mtl.h>`

Inheritance diagram for impeller::ShaderFunctionMTL:

## Public Types
using | CompileCallback = std::function< void(id< MTLFunction >)>

## Public Member Functions
| ~ShaderFunctionMTL () override
id< MTLFunction > | GetMTLFunction () const
void | GetMTLFunctionSpecialized (const std::vector< Scalar > &constants, const CompileCallback &callback) const
Public Member Functions inherited from impeller::ShaderFunction
virtual | ~ShaderFunction ()
ShaderStage | GetStage () const
const std::string & | GetName () const
std::size_t | GetHash () const override
bool | IsEqual (const ShaderFunction &other) const override
Public Member Functions inherited from impeller::Comparable< ShaderFunction >
virtual std::size_t | GetHash () const=0

## Friends
class | ShaderLibraryMTL

## Additional Inherited Members
Static Public Member Functions inherited from impeller::BackendCast< ShaderFunctionMTL, ShaderFunction >
static ShaderFunctionMTL & | Cast (ShaderFunction &base)
static const ShaderFunctionMTL & | Cast (const ShaderFunction &base)
static ShaderFunctionMTL * | Cast (ShaderFunction *base)
static const ShaderFunctionMTL * | Cast (const ShaderFunction *base)
Protected Member Functions inherited from impeller::ShaderFunction
| ShaderFunction (UniqueID parent_library_id, std::string name, ShaderStage stage)

## Detailed Description

Definition at line 15 of file shader_function_mtl.h.

## Member Typedef Documentation

## ◆ CompileCallback

using impeller::ShaderFunctionMTL::CompileCallback = std::function<void(id<MTLFunction>)>

Definition at line 24 of file shader_function_mtl.h.

## Constructor & Destructor Documentation

## ◆ ~ShaderFunctionMTL()

impeller::ShaderFunctionMTL::~ShaderFunctionMTL | ( |  | ) |
| override default

## Member Function Documentation

## ◆ GetMTLFunction()

id< MTLFunction > impeller::ShaderFunctionMTL::GetMTLFunction | ( |  | ) | const

Definition at line 42 of file shader_function_mtl.mm.

42 {
43 return function_;
44 }

Referenced by impeller::GetMTLComputePipelineDescriptor(), and impeller::GetMTLRenderPipelineDescriptor().

## ◆ GetMTLFunctionSpecialized()

void impeller::ShaderFunctionMTL::GetMTLFunctionSpecialized | ( | const std::vector< Scalar > & | constants,
|  | const CompileCallback & | callback
| ) |  | const

Definition at line 20 of file shader_function_mtl.mm.

22 {
23 MTLFunctionConstantValues* constantValues =
24 [[MTLFunctionConstantValues alloc] init];
25 size_t index = 0;
26 for (const auto value : constants) {
27 Scalar copied_value = value;
28 [constantValues setConstantValue:&copied_value
29 type:MTLDataTypeFloat
30 atIndex:index];
31 index++;
32 }
33 CompileCallback callback_value = callback;
34 [library_ newFunctionWithName:@(GetName().data())
35 constantValues:constantValues
36 completionHandler:^(id<MTLFunction> _Nullable function,
37 NSError* _Nullable error) {
38 callback_value(function);
39 }];
40 }

References impeller::ShaderFunction::GetName(), type, and value.

Referenced by impeller::GetMTLRenderPipelineDescriptor().

## Friends And Related Function Documentation

## ◆ ShaderLibraryMTL

friend class ShaderLibraryMTL
| friend

Definition at line 30 of file shader_function_mtl.h.

The documentation for this class was generated from the following files:

- impeller/renderer/backend/metal/shader_function_mtl.h
- impeller/renderer/backend/metal/shader_function_mtl.mm

impeller::Scalar
float Scalar
Definition: scalar.h:18
value
int32_t value
Definition: dl_golden_unittests.cc:444
type
GLenum type
Definition: blit_command_gles.cc:151
impeller::ShaderFunctionMTL::CompileCallback
std::function< void(id< MTLFunction >)> CompileCallback
Definition: shader_function_mtl.h:24
impeller::ShaderFunction::GetName
const std::string & GetName() const
Definition: shader_function.cc:22