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 
10 #include "flutter/fml/macros.h"
13 
14 namespace impeller {
15 
16 class CommandBufferMTL final : public CommandBuffer {
17  public:
18  // |CommandBuffer|
19  ~CommandBufferMTL() override;
20 
21  private:
22  friend class ContextMTL;
23 
24  id<MTLCommandBuffer> buffer_ = nullptr;
25 
26  CommandBufferMTL(const std::weak_ptr<const Context>& context,
27  id<MTLCommandQueue> queue);
28 
29  // |CommandBuffer|
30  void SetLabel(const std::string& label) const override;
31 
32  // |CommandBuffer|
33  bool IsValid() const override;
34 
35  // |CommandBuffer|
36  bool OnSubmitCommands(CompletionCallback callback) override;
37 
38  // |CommandBuffer|
39  void OnWaitUntilScheduled() override;
40 
41  // |CommandBuffer|
42  bool EncodeAndSubmit(const std::shared_ptr<RenderPass>& render_pass) override;
43 
44  // |CommandBuffer|
45  bool EncodeAndSubmit(const std::shared_ptr<BlitPass>& blit_ass,
46  const std::shared_ptr<Allocator>& allocator) override;
47 
48  // |CommandBuffer|
49  std::shared_ptr<RenderPass> OnCreateRenderPass(RenderTarget target) override;
50 
51  // |CommandBuffer|
52  std::shared_ptr<BlitPass> OnCreateBlitPass() override;
53 
54  // |CommandBuffer|
55  std::shared_ptr<ComputePass> OnCreateComputePass() override;
56 
57  CommandBufferMTL(const CommandBufferMTL&) = delete;
58 
59  CommandBufferMTL& operator=(const CommandBufferMTL&) = delete;
60 };
61 
62 } // namespace impeller
63 
64 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_COMMAND_BUFFER_MTL_H_
impeller::CommandBuffer::CompletionCallback
std::function< void(Status)> CompletionCallback
Definition: command_buffer.h:55
impeller::CommandBufferMTL
Definition: command_buffer_mtl.h:16
impeller::RenderTarget
Definition: render_target.h:49
impeller::CommandBufferMTL::~CommandBufferMTL
~CommandBufferMTL() override
command_buffer.h
allocator.h
impeller::ContextMTL
Definition: context_mtl.h:34
impeller
Definition: aiks_context.cc:10
impeller::CommandBuffer
A collection of encoded commands to be submitted to the GPU for execution. A command buffer is obtain...
Definition: command_buffer.h:45