Flutter Impeller
blit_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_BLIT_PASS_MTL_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_BLIT_PASS_MTL_H_
7 
8 #include <Metal/Metal.h>
9 
10 #include "flutter/fml/macros.h"
13 
14 namespace impeller {
15 
16 class BlitPassMTL final : public BlitPass {
17  public:
18  // |RenderPass|
19  ~BlitPassMTL() override;
20 
21  private:
22  friend class CommandBufferMTL;
23 
24  std::vector<std::unique_ptr<BlitEncodeMTL>> commands_;
25  id<MTLCommandBuffer> buffer_ = nil;
26  std::string label_;
27  bool is_valid_ = false;
28 
29  explicit BlitPassMTL(id<MTLCommandBuffer> buffer);
30 
31  // |BlitPass|
32  bool IsValid() const override;
33 
34  // |BlitPass|
35  void OnSetLabel(std::string label) override;
36 
37  // |BlitPass|
38  bool EncodeCommands(
39  const std::shared_ptr<Allocator>& transients_allocator) const override;
40 
41  bool EncodeCommands(id<MTLBlitCommandEncoder> pass) const;
42 
43  // |BlitPass|
44  bool OnCopyTextureToTextureCommand(std::shared_ptr<Texture> source,
45  std::shared_ptr<Texture> destination,
46  IRect source_region,
47  IPoint destination_origin,
48  std::string label) override;
49 
50  // |BlitPass|
51  bool OnCopyTextureToBufferCommand(std::shared_ptr<Texture> source,
52  std::shared_ptr<DeviceBuffer> destination,
53  IRect source_region,
54  size_t destination_offset,
55  std::string label) override;
56  // |BlitPass|
57  bool OnCopyBufferToTextureCommand(BufferView source,
58  std::shared_ptr<Texture> destination,
59  IPoint destination_origin,
60  std::string label) override;
61 
62  // |BlitPass|
63  bool OnGenerateMipmapCommand(std::shared_ptr<Texture> texture,
64  std::string label) override;
65 
66  BlitPassMTL(const BlitPassMTL&) = delete;
67 
68  BlitPassMTL& operator=(const BlitPassMTL&) = delete;
69 };
70 
71 } // namespace impeller
72 
73 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_BLIT_PASS_MTL_H_
impeller::BlitPassMTL::~BlitPassMTL
~BlitPassMTL() override
blit_command_mtl.h
impeller::BlitPass
Blit passes encode blit into the underlying command buffer.
Definition: blit_pass.h:26
blit_pass.h
impeller::CommandBufferMTL
Definition: command_buffer_mtl.h:16
impeller::BufferView
Definition: buffer_view.h:15
impeller::TPoint< int64_t >
impeller::BlitPassMTL
Definition: blit_pass_mtl.h:16
impeller
Definition: aiks_blur_unittests.cc:20
impeller::TRect< int64_t >