Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Friends | List of all members
impeller::BlitPassMTL Class Referencefinal

#include <blit_pass_mtl.h>

Inheritance diagram for impeller::BlitPassMTL:
impeller::BlitPass

Public Member Functions

 ~BlitPassMTL () override
 
- Public Member Functions inherited from impeller::BlitPass
virtual ~BlitPass ()
 
void SetLabel (std::string label)
 
bool AddCopy (std::shared_ptr< Texture > source, std::shared_ptr< Texture > destination, std::optional< IRect > source_region=std::nullopt, IPoint destination_origin={}, std::string label="")
 Record a command to copy the contents of one texture to another texture. The blit area is limited by the intersection of the texture coverage with respect the source region and destination origin. No work is encoded into the command buffer at this time.
 
bool AddCopy (std::shared_ptr< Texture > source, std::shared_ptr< DeviceBuffer > destination, std::optional< IRect > source_region=std::nullopt, size_t destination_offset=0, std::string label="")
 Record a command to copy the contents of the buffer to the texture. No work is encoded into the command buffer at this time.
 
bool AddCopy (BufferView source, std::shared_ptr< Texture > destination, IPoint destination_origin={}, std::string label="")
 Record a command to copy the contents of the buffer to the texture. No work is encoded into the command buffer at this time.
 
bool GenerateMipmap (std::shared_ptr< Texture > texture, std::string label="")
 Record a command to generate all mip levels for a texture. No work is encoded into the command buffer at this time.
 

Private Member Functions

bool IsValid () const override
 
void OnSetLabel (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 OnCopyTextureToTextureCommand (std::shared_ptr< Texture > source, std::shared_ptr< Texture > destination, IRect source_region, IPoint destination_origin, std::string label) override
 
bool OnCopyTextureToBufferCommand (std::shared_ptr< Texture > source, std::shared_ptr< DeviceBuffer > destination, IRect source_region, size_t destination_offset, std::string label) override
 
bool OnCopyBufferToTextureCommand (BufferView source, std::shared_ptr< Texture > destination, IPoint destination_origin, std::string label) override
 
bool OnGenerateMipmapCommand (std::shared_ptr< Texture > texture, std::string label) override
 

Friends

class CommandBufferMTL
 

Additional Inherited Members

- Protected Member Functions inherited from impeller::BlitPass
 BlitPass ()
 

Detailed Description

Definition at line 16 of file blit_pass_mtl.h.

Constructor & Destructor Documentation

◆ ~BlitPassMTL()

impeller::BlitPassMTL::~BlitPassMTL ( )
overridedefault

Member Function Documentation

◆ EncodeCommands()

bool impeller::BlitPassMTL::EncodeCommands ( const std::shared_ptr< Allocator > &  transients_allocator) const
overrideprivatevirtual

Encode the recorded commands to the underlying command buffer.

Parameters
transients_allocatorThe transients allocator.
Returns
If the commands were encoded to the underlying command buffer.

Implements impeller::BlitPass.

Definition at line 47 of file blit_pass_mtl.mm.

48 {
49 TRACE_EVENT0("impeller", "BlitPassMTL::EncodeCommands");
50 if (!IsValid()) {
51 return false;
52 }
53
54 auto blit_command_encoder = [buffer_ blitCommandEncoder];
55
56 if (!blit_command_encoder) {
57 return false;
58 }
59
60 if (!label_.empty()) {
61 [blit_command_encoder setLabel:@(label_.c_str())];
62 }
63
64 // Success or failure, the pass must end. The buffer can only process one pass
65 // at a time.
67 [blit_command_encoder]() { [blit_command_encoder endEncoding]; });
68
69 return EncodeCommands(blit_command_encoder);
70}
Wraps a closure that is invoked in the destructor unless released by the caller.
Definition closure.h:32
bool EncodeCommands(const std::shared_ptr< Allocator > &transients_allocator) const override
Encode the recorded commands to the underlying command buffer.
bool IsValid() const override
#define TRACE_EVENT0(category_group, name)

◆ IsValid()

bool impeller::BlitPassMTL::IsValid ( ) const
overrideprivatevirtual

Implements impeller::BlitPass.

Definition at line 36 of file blit_pass_mtl.mm.

36 {
37 return is_valid_;
38}

◆ OnCopyBufferToTextureCommand()

bool impeller::BlitPassMTL::OnCopyBufferToTextureCommand ( BufferView  source,
std::shared_ptr< Texture destination,
IPoint  destination_origin,
std::string  label 
)
overrideprivatevirtual

Implements impeller::BlitPass.

Definition at line 126 of file blit_pass_mtl.mm.

130 {
131 auto command = std::make_unique<BlitCopyBufferToTextureCommandMTL>();
132 command->label = label;
133 command->source = std::move(source);
134 command->destination = std::move(destination);
135 command->destination_origin = destination_origin;
136
137 commands_.emplace_back(std::move(command));
138 return true;
139}
SkBitmap source
Definition examples.cpp:28
list command
Definition valgrind.py:24

◆ OnCopyTextureToBufferCommand()

bool impeller::BlitPassMTL::OnCopyTextureToBufferCommand ( std::shared_ptr< Texture source,
std::shared_ptr< DeviceBuffer destination,
IRect  source_region,
size_t  destination_offset,
std::string  label 
)
overrideprivatevirtual

Implements impeller::BlitPass.

Definition at line 109 of file blit_pass_mtl.mm.

114 {
115 auto command = std::make_unique<BlitCopyTextureToBufferCommandMTL>();
116 command->label = label;
117 command->source = std::move(source);
118 command->destination = std::move(destination);
119 command->source_region = source_region;
120 command->destination_offset = destination_offset;
121
122 commands_.emplace_back(std::move(command));
123 return true;
124}

◆ OnCopyTextureToTextureCommand()

bool impeller::BlitPassMTL::OnCopyTextureToTextureCommand ( std::shared_ptr< Texture source,
std::shared_ptr< Texture destination,
IRect  source_region,
IPoint  destination_origin,
std::string  label 
)
overrideprivatevirtual

Implements impeller::BlitPass.

Definition at line 91 of file blit_pass_mtl.mm.

96 {
97 auto command = std::make_unique<BlitCopyTextureToTextureCommandMTL>();
98 command->label = label;
99 command->source = std::move(source);
100 command->destination = std::move(destination);
101 command->source_region = source_region;
102 command->destination_origin = destination_origin;
103
104 commands_.emplace_back(std::move(command));
105 return true;
106}

◆ OnGenerateMipmapCommand()

bool impeller::BlitPassMTL::OnGenerateMipmapCommand ( std::shared_ptr< Texture texture,
std::string  label 
)
overrideprivatevirtual

Implements impeller::BlitPass.

Definition at line 142 of file blit_pass_mtl.mm.

143 {
144 auto command = std::make_unique<BlitGenerateMipmapCommandMTL>();
145 command->label = label;
146 command->texture = std::move(texture);
147
148 commands_.emplace_back(std::move(command));
149 return true;
150}
FlTexture * texture

◆ OnSetLabel()

void impeller::BlitPassMTL::OnSetLabel ( std::string  label)
overrideprivatevirtual

Implements impeller::BlitPass.

Definition at line 40 of file blit_pass_mtl.mm.

40 {
41 if (label.empty()) {
42 return;
43 }
44 label_ = std::move(label);
45}

Friends And Related Symbol Documentation

◆ CommandBufferMTL

friend class CommandBufferMTL
friend

Definition at line 22 of file blit_pass_mtl.h.


The documentation for this class was generated from the following files: