Flutter Engine
 
Loading...
Searching...
No Matches
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 raw_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.
Describes the fixed function and programmable aspects of rendering and compute operations performed b...
Definition pipeline.h:52
A wrapper around a raw ptr that adds additional unopt mode only checks.
Definition raw_ptr.h:15
FlView * view
FlTexture * texture
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.
Metadata required to bind a buffer.