Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
14namespace impeller {
15
16class 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|
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_
bool OnCopyTextureToBufferCommand(std::shared_ptr< Texture > source, std::shared_ptr< DeviceBuffer > destination, IRect source_region, size_t destination_offset, std::string label) override
bool OnGenerateMipmapCommand(std::shared_ptr< Texture > texture, std::string label) override
void OnSetLabel(std::string label) override
bool OnCopyBufferToTextureCommand(BufferView source, std::shared_ptr< Texture > destination, IPoint destination_origin, std::string label) override
bool OnCopyTextureToTextureCommand(std::shared_ptr< Texture > source, std::shared_ptr< Texture > destination, IRect source_region, IPoint destination_origin, std::string label) override
bool EncodeCommands(const std::shared_ptr< Allocator > &transients_allocator) const override
Encode the recorded commands to the underlying command buffer.
bool IsValid() const override
Blit passes encode blit into the underlying command buffer.
Definition blit_pass.h:26
SkBitmap source
Definition examples.cpp:28
static const uint8_t buffer[]
FlTexture * texture