Flutter Engine
The Flutter Engine
compute_pass_mtl.h
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#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_COMPUTE_PASS_MTL_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_COMPUTE_PASS_MTL_H_
7
8#include <Metal/Metal.h>
9
13
14namespace impeller {
15
16class ComputePassMTL final : public ComputePass {
17 public:
18 // |RenderPass|
19 ~ComputePassMTL() override;
20
21 private:
22 friend class CommandBufferMTL;
23
24 id<MTLCommandBuffer> buffer_ = nil;
25 id<MTLComputeCommandEncoder> encoder_ = nil;
26 ComputePassBindingsCacheMTL pass_bindings_cache_ =
28 bool is_valid_ = false;
29 bool has_label_ = false;
30
31 ComputePassMTL(std::shared_ptr<const Context> context,
32 id<MTLCommandBuffer> buffer);
33
34 // |ComputePass|
35 bool IsValid() const override;
36
37 // |ComputePass|
38 fml::Status Compute(const ISize& grid_size) override;
39
40 // |ComputePass|
41 void SetCommandLabel(std::string_view label) override;
42
43 // |ComputePass|
44 void OnSetLabel(const std::string& label) override;
45
46 // |ComputePass|
47 void SetPipeline(const std::shared_ptr<Pipeline<ComputePipelineDescriptor>>&
48 pipeline) override;
49
50 // |ComputePass|
51 bool BindResource(ShaderStage stage,
53 const ShaderUniformSlot& slot,
54 const ShaderMetadata& metadata,
55 BufferView view) override;
56
57 // |ComputePass|
58 bool BindResource(ShaderStage stage,
60 const SampledImageSlot& slot,
61 const ShaderMetadata& metadata,
62 std::shared_ptr<const Texture> texture,
63 const std::unique_ptr<const Sampler>& sampler) override;
64
65 // |ComputePass|
66 bool EncodeCommands() const override;
67
68 // |ComputePass|
69 void AddBufferMemoryBarrier() override;
70
71 // |ComputePass|
72 void AddTextureMemoryBarrier() override;
73
74 ComputePassMTL(const ComputePassMTL&) = delete;
75
76 ComputePassMTL& operator=(const ComputePassMTL&) = delete;
77};
78
79} // namespace impeller
80
81#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_COMPUTE_PASS_MTL_H_
GLenum type
Compute passes encode compute shader into the underlying command buffer.
Definition: compute_pass.h:23
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
Ensures that bindings on the pass are not redundantly set or updated. Avoids making the driver do add...
Metadata required to bind a combined texture and sampler.
Definition: shader_types.h:98
Metadata required to bind a buffer.
Definition: shader_types.h:81