Flutter Impeller
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
 

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

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 ( )
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
const std::string & GetName() const
std::function< void(id< MTLFunction >)> CompileCallback
int32_t value
float Scalar
Definition: scalar.h:19

References type, and value.

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: