Flutter Engine
The Flutter Engine
compute_pass_bindings_cache_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
6
7namespace impeller {
8
10 id<MTLComputePipelineState> pipeline) {
11 if (pipeline == pipeline_) {
12 return;
13 }
14 pipeline_ = pipeline;
15 [encoder_ setComputePipelineState:pipeline_];
16}
17
18id<MTLComputePipelineState> ComputePassBindingsCacheMTL::GetPipeline() const {
19 return pipeline_;
20}
21
23 id<MTLComputeCommandEncoder> encoder) {
24 encoder_ = encoder;
25}
26
28 uint64_t offset,
29 id<MTLBuffer> buffer) {
30 auto found = buffers_.find(index);
31 if (found != buffers_.end() && found->second.buffer == buffer) {
32 // The right buffer is bound. Check if its offset needs to be updated.
33 if (found->second.offset == offset) {
34 // Buffer and its offset is identical. Nothing to do.
35 return;
36 }
37
38 // Only the offset needs to be updated.
39 found->second.offset = offset;
40
41 [encoder_ setBufferOffset:offset atIndex:index];
42 return;
43 }
44
45 buffers_[index] = {buffer, static_cast<size_t>(offset)};
46 [encoder_ setBuffer:buffer offset:offset atIndex:index];
47}
48
50 id<MTLTexture> texture) {
51 auto found = textures_.find(index);
52 if (found != textures_.end() && found->second == texture) {
53 // Already bound.
54 return;
55 }
56 textures_[index] = texture;
57 [encoder_ setTexture:texture atIndex:index];
58 return;
59}
60
62 id<MTLSamplerState> sampler) {
63 auto found = samplers_.find(index);
64 if (found != samplers_.end() && found->second == sampler) {
65 // Already bound.
66 return;
67 }
68 samplers_[index] = sampler;
69 [encoder_ setSamplerState:sampler atIndex:index];
70 return;
71}
72
73} // namespace impeller
FlTexture * texture
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
SeparatedVector2 offset
void SetEncoder(id< MTLComputeCommandEncoder > encoder)
void SetComputePipelineState(id< MTLComputePipelineState > pipeline)
void SetBuffer(uint64_t index, uint64_t offset, id< MTLBuffer > buffer)
void SetSampler(uint64_t index, id< MTLSamplerState > sampler)
id< MTLComputePipelineState > GetPipeline() const
void SetTexture(uint64_t index, id< MTLTexture > texture)