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