Flutter Impeller
command_buffer_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_COMMAND_BUFFER_MTL_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_COMMAND_BUFFER_MTL_H_
7 
8 #include <Metal/Metal.h>
9 
12 
13 namespace impeller {
14 
15 class CommandBufferMTL final : public CommandBuffer {
16  public:
17  // |CommandBuffer|
18  ~CommandBufferMTL() override;
19 
20  private:
21  friend class ContextMTL;
22 
23  id<MTLCommandBuffer> buffer_ = nil;
24  id<MTLDevice> device_ = nil;
25 
26  CommandBufferMTL(const std::weak_ptr<const Context>& context,
27  id<MTLDevice> device,
28  id<MTLCommandQueue> queue);
29 
30  // |CommandBuffer|
31  void SetLabel(std::string_view label) const override;
32 
33  // |CommandBuffer|
34  bool IsValid() const override;
35 
36  // |CommandBuffer|
37  bool OnSubmitCommands(CompletionCallback callback) override;
38 
39  // |CommandBuffer|
40  void OnWaitUntilCompleted() override;
41 
42  // |CommandBuffer|
43  void OnWaitUntilScheduled() override;
44 
45  // |CommandBuffer|
46  std::shared_ptr<RenderPass> OnCreateRenderPass(RenderTarget target) override;
47 
48  // |CommandBuffer|
49  std::shared_ptr<BlitPass> OnCreateBlitPass() override;
50 
51  // |CommandBuffer|
52  std::shared_ptr<ComputePass> OnCreateComputePass() override;
53 
54  CommandBufferMTL(const CommandBufferMTL&) = delete;
55 
56  CommandBufferMTL& operator=(const CommandBufferMTL&) = delete;
57 };
58 
59 } // namespace impeller
60 
61 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_COMMAND_BUFFER_MTL_H_
A collection of encoded commands to be submitted to the GPU for execution. A command buffer is obtain...
std::function< void(Status)> CompletionCallback