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

#include <shader_function_mtl.h>

Inheritance diagram for impeller::ShaderFunctionMTL:
impeller::ShaderFunction impeller::BackendCast< ShaderFunctionMTL, ShaderFunction > impeller::Comparable< ShaderFunction > impeller::ComparableBase

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
 
virtual std::size_t GetHash () const=0
 
virtual bool IsEqual (const ShaderFunction &other) const=0
 

Friends

class ShaderLibraryMTL
 

Additional Inherited Members

- Static Public Member Functions inherited from impeller::BackendCast< ShaderFunctionMTL, ShaderFunction >
static ShaderFunctionMTLCast (ShaderFunction &base)
 
static const ShaderFunctionMTLCast (const ShaderFunction &base)
 
static ShaderFunctionMTLCast (ShaderFunction *base)
 
static const ShaderFunctionMTLCast (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

Definition at line 24 of file shader_function_mtl.h.

Constructor & Destructor Documentation

◆ ~ShaderFunctionMTL()

impeller::ShaderFunctionMTL::~ShaderFunctionMTL ( )
overridedefault

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}

◆ 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}
GLenum type
std::function< void(id< MTLFunction >)> CompileCallback
const std::string & GetName() const
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
const uint8_t uint32_t uint32_t GError ** error
uint8_t value
Dart_NativeFunction function
Definition: fuchsia.cc:51
static bool init()
float Scalar
Definition: scalar.h:18

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: