10 #include "flutter/fml/trace_event.h"
24 : reactor_(
std::move(reactor)),
25 is_valid_(reactor_ && reactor_->IsValid()) {}
31 bool BlitPassGLES::IsValid()
const {
36 void BlitPassGLES::OnSetLabel(std::string label) {
37 label_ = std::move(label);
41 const std::shared_ptr<Allocator>& transients_allocator,
43 const std::vector<std::unique_ptr<BlitEncodeGLES>>& commands,
44 const std::string& label) {
45 TRACE_EVENT0(
"impeller",
"BlitPassGLES::EncodeCommandsInReactor");
47 if (commands.empty()) {
53 fml::ScopedCleanupClosure pop_pass_debug_marker(
54 [&gl]() { gl.PopDebugGroup(); });
58 pop_pass_debug_marker.Release();
61 for (
const auto& command : commands) {
62 fml::ScopedCleanupClosure pop_cmd_debug_marker(
63 [&gl]() { gl.PopDebugGroup(); });
64 auto label = command->GetLabel();
66 gl.PushDebugGroup(label);
68 pop_cmd_debug_marker.Release();
71 if (!command->Encode(reactor)) {
80 bool BlitPassGLES::EncodeCommands(
81 const std::shared_ptr<Allocator>& transients_allocator)
const {
85 if (commands_.empty()) {
89 std::shared_ptr<const BlitPassGLES> shared_this = shared_from_this();
90 return reactor_->AddOperation([transients_allocator,
91 blit_pass = std::move(shared_this),
92 label = label_](
const auto& reactor) {
94 blit_pass->commands_, label);
95 FML_CHECK(result) <<
"Must be able to encode GL commands without error.";
100 bool BlitPassGLES::OnCopyTextureToTextureCommand(
101 std::shared_ptr<Texture> source,
102 std::shared_ptr<Texture> destination,
104 IPoint destination_origin,
106 auto command = std::make_unique<BlitCopyTextureToTextureCommandGLES>();
107 command->label = label;
108 command->source = std::move(source);
109 command->destination = std::move(destination);
110 command->source_region = source_region;
111 command->destination_origin = destination_origin;
113 commands_.emplace_back(std::move(command));
118 bool BlitPassGLES::OnCopyTextureToBufferCommand(
119 std::shared_ptr<Texture> source,
120 std::shared_ptr<DeviceBuffer> destination,
122 size_t destination_offset,
124 auto command = std::make_unique<BlitCopyTextureToBufferCommandGLES>();
125 command->label = label;
126 command->source = std::move(source);
127 command->destination = std::move(destination);
128 command->source_region = source_region;
129 command->destination_offset = destination_offset;
131 commands_.emplace_back(std::move(command));
136 bool BlitPassGLES::OnGenerateMipmapCommand(std::shared_ptr<Texture> texture,
138 auto command = std::make_unique<BlitGenerateMipmapCommandGLES>();
139 command->label = label;
140 command->texture = std::move(texture);
142 commands_.emplace_back(std::move(command));