Flutter Impeller
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 
10 #include "flutter/fml/macros.h"
12 
13 namespace impeller {
14 
15 class ComputePassMTL final : public ComputePass {
16  public:
17  // |RenderPass|
18  ~ComputePassMTL() override;
19 
20  private:
21  friend class CommandBufferMTL;
22 
23  id<MTLCommandBuffer> buffer_ = nil;
24  std::string label_;
25  bool is_valid_ = false;
26 
27  ComputePassMTL(std::weak_ptr<const Context> context,
28  id<MTLCommandBuffer> buffer);
29 
30  // |ComputePass|
31  bool IsValid() const override;
32 
33  // |ComputePass|
34  void OnSetLabel(const std::string& label) override;
35 
36  // |ComputePass|
37  bool OnEncodeCommands(const Context& context,
38  const ISize& grid_size,
39  const ISize& thread_group_size) const override;
40 
41  bool EncodeCommands(const std::shared_ptr<Allocator>& allocator,
42  id<MTLComputeCommandEncoder> pass,
43  const ISize& grid_size,
44  const ISize& thread_group_size) const;
45 
46  ComputePassMTL(const ComputePassMTL&) = delete;
47 
48  ComputePassMTL& operator=(const ComputePassMTL&) = delete;
49 };
50 
51 } // namespace impeller
52 
53 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_COMPUTE_PASS_MTL_H_
impeller::ComputePassMTL
Definition: compute_pass_mtl.h:15
impeller::ComputePass::EncodeCommands
bool EncodeCommands() const
Encode the recorded commands to the underlying command buffer.
Definition: compute_pass.cc:50
impeller::TSize< int64_t >
impeller::ComputePassMTL::~ComputePassMTL
~ComputePassMTL() override
impeller::CommandBufferMTL
Definition: command_buffer_mtl.h:16
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:47
compute_pass.h
impeller
Definition: aiks_context.cc:10
impeller::ComputePass
Compute passes encode compute shader into the underlying command buffer.
Definition: compute_pass.h:23