Flutter Engine
The Flutter Engine
impeller
renderer
backend
metal
shader_function_mtl.mm
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
#include "
impeller/renderer/backend/metal/shader_function_mtl.h
"
6
7
namespace
impeller
{
8
9
ShaderFunctionMTL::ShaderFunctionMTL(UniqueID parent_library_id,
10
id<MTLFunction>
function
,
11
id<MTLLibrary> library,
12
std::string
name
,
13
ShaderStage
stage)
14
: ShaderFunction(parent_library_id,
std
::move(
name
), stage),
15
function_(
function
),
16
library_(library) {}
17
18
ShaderFunctionMTL::~ShaderFunctionMTL() =
default
;
19
20
void
ShaderFunctionMTL::GetMTLFunctionSpecialized(
21
const
std::vector<Scalar>& constants,
22
const
CompileCallback
&
callback
)
const
{
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
}
41
42
id<MTLFunction> ShaderFunctionMTL::GetMTLFunction()
const
{
43
return
function_;
44
}
45
46
}
// namespace impeller
type
GLenum type
Definition:
blit_command_gles.cc:126
impeller::ShaderFunctionMTL::CompileCallback
std::function< void(id< MTLFunction >)> CompileCallback
Definition:
shader_function_mtl.h:24
callback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Definition:
fl_key_channel_responder.cc:120
error
const uint8_t uint32_t uint32_t GError ** error
Definition:
fl_pixel_buffer_texture_test.cc:40
value
uint8_t value
Definition:
fl_standard_message_codec.cc:36
function
Dart_NativeFunction function
Definition:
fuchsia.cc:51
SkOpts::init
static bool init()
Definition:
SkBitmapProcState_opts.cpp:26
flutter::name
DEF_SWITCHES_START aot vmservice shared library name
Definition:
switches.h:32
impeller
Definition:
texture.h:18
impeller::Scalar
float Scalar
Definition:
scalar.h:18
impeller::ShaderStage
ShaderStage
Definition:
shader_types.h:22
std
Definition:
ref_ptr.h:256
shader_function_mtl.h
Generated on Sun Jun 23 2024 21:55:03 for Flutter Engine by
1.9.4