diff --git a/engine/src/flutter/impeller/entity/contents/checkerboard_contents.cc b/engine/src/flutter/impeller/entity/contents/checkerboard_contents.cc index 0c80a632b0..bcd8ba744e 100644 --- a/engine/src/flutter/impeller/entity/contents/checkerboard_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/checkerboard_contents.cc @@ -49,7 +49,7 @@ bool CheckerboardContents::Render(const ContentContext& renderer, frag_info.square_size = square_size_; FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info)); - pass.AddCommand(cmd); + pass.AddCommand(std::move(cmd)); return true; } diff --git a/engine/src/flutter/impeller/entity/contents/clip_contents.cc b/engine/src/flutter/impeller/entity/contents/clip_contents.cc index 20c2ab2ded..757ff487fa 100644 --- a/engine/src/flutter/impeller/entity/contents/clip_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/clip_contents.cc @@ -107,7 +107,7 @@ bool ClipContents::Render(const ContentContext& renderer, options.primitive_type = PrimitiveType::kTriangleStrip; cmd.pipeline = renderer.GetClipPipeline(options); - pass.AddCommand(cmd); + pass.AddCommand(Command(cmd)); } { diff --git a/engine/src/flutter/impeller/entity/contents/filters/blend_filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/blend_filter_contents.cc index 11f175bc0b..09b125afa8 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/blend_filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/blend_filter_contents.cc @@ -180,7 +180,7 @@ static std::optional AdvancedBlend( auto uniform_view = host_buffer.EmplaceUniform(frame_info); VS::BindFrameInfo(cmd, uniform_view); - pass.AddCommand(cmd); + pass.AddCommand(std::move(cmd)); return true; }; @@ -336,7 +336,7 @@ std::optional BlendFilterContents::CreateForegroundAdvancedBlend( auto uniform_view = host_buffer.EmplaceUniform(frame_info); VS::BindFrameInfo(cmd, uniform_view); - return pass.AddCommand(cmd); + return pass.AddCommand(std::move(cmd)); }; CoverageProc coverage_proc = [coverage](const Entity& entity) -> std::optional { @@ -476,7 +476,7 @@ std::optional BlendFilterContents::CreateForegroundPorterDuffBlend( auto uniform_view = host_buffer.EmplaceUniform(frame_info); VS::BindFrameInfo(cmd, uniform_view); - return pass.AddCommand(cmd); + return pass.AddCommand(std::move(cmd)); }; CoverageProc coverage_proc = @@ -573,7 +573,7 @@ static std::optional PipelineBlend( FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info)); VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info)); - pass.AddCommand(cmd); + pass.AddCommand(std::move(cmd)); return true; }; diff --git a/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc index 0226507dbc..fae49450d7 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc @@ -303,7 +303,7 @@ std::optional DirectionalGaussianBlurFilterContents::RenderFilter( FS::BindMaskInfo(cmd, host_buffer.EmplaceUniform(mask_info)); } - return pass.AddCommand(cmd); + return pass.AddCommand(std::move(cmd)); }; Vector2 scale; diff --git a/engine/src/flutter/impeller/entity/contents/filters/morphology_filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/morphology_filter_contents.cc index 16b5cc5daf..d651f5bfbe 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/morphology_filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/morphology_filter_contents.cc @@ -135,7 +135,7 @@ std::optional DirectionalMorphologyFilterContents::RenderFilter( VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info)); FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info)); - return pass.AddCommand(cmd); + return pass.AddCommand(std::move(cmd)); }; auto out_texture = renderer.MakeSubpass("Directional Morphology Filter", diff --git a/engine/src/flutter/impeller/entity/contents/framebuffer_blend_contents.cc b/engine/src/flutter/impeller/entity/contents/framebuffer_blend_contents.cc index 6e8adafbec..3044b0a925 100644 --- a/engine/src/flutter/impeller/entity/contents/framebuffer_blend_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/framebuffer_blend_contents.cc @@ -154,7 +154,7 @@ bool FramebufferBlendContents::Render(const ContentContext& renderer, frag_info.src_input_alpha = src_snapshot->opacity; FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info)); - return pass.AddCommand(cmd); + return pass.AddCommand(std::move(cmd)); } } // namespace impeller diff --git a/engine/src/flutter/impeller/entity/contents/text_contents.cc b/engine/src/flutter/impeller/entity/contents/text_contents.cc index 9f28e9e979..38801d16ef 100644 --- a/engine/src/flutter/impeller/entity/contents/text_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/text_contents.cc @@ -212,7 +212,7 @@ bool TextContents::Render(const ContentContext& renderer, .index_type = IndexType::kNone, }); - return pass.AddCommand(cmd); + return pass.AddCommand(std::move(cmd)); } } // namespace impeller diff --git a/engine/src/flutter/impeller/renderer/render_pass.cc b/engine/src/flutter/impeller/renderer/render_pass.cc index ffc5e44904..d07ce2bfaa 100644 --- a/engine/src/flutter/impeller/renderer/render_pass.cc +++ b/engine/src/flutter/impeller/renderer/render_pass.cc @@ -43,7 +43,7 @@ void RenderPass::SetLabel(std::string label) { OnSetLabel(std::move(label)); } -bool RenderPass::AddCommand(Command command) { +bool RenderPass::AddCommand(Command&& command) { if (!command) { VALIDATION_LOG << "Attempted to add an invalid command to the render pass."; return false; diff --git a/engine/src/flutter/impeller/renderer/render_pass.h b/engine/src/flutter/impeller/renderer/render_pass.h index f76531eed8..1db85ad3df 100644 --- a/engine/src/flutter/impeller/renderer/render_pass.h +++ b/engine/src/flutter/impeller/renderer/render_pass.h @@ -47,7 +47,7 @@ class RenderPass { /// /// @return If the command was valid for subsequent commitment. /// - bool AddCommand(Command command); + bool AddCommand(Command&& command); //---------------------------------------------------------------------------- /// @brief Encode the recorded commands to the underlying command buffer. diff --git a/engine/src/flutter/impeller/renderer/renderer_unittests.cc b/engine/src/flutter/impeller/renderer/renderer_unittests.cc index d41ca97f82..ac649603c3 100644 --- a/engine/src/flutter/impeller/renderer/renderer_unittests.cc +++ b/engine/src/flutter/impeller/renderer/renderer_unittests.cc @@ -270,7 +270,7 @@ TEST_P(RendererTest, CanRenderMultiplePrimitives) { Matrix::MakeTranslation({i * 50.0f, j * 50.0f, 0.0f}); VS::BindUniformBuffer( cmd, pass.GetTransientsBuffer().EmplaceUniform(uniforms)); - if (!pass.AddCommand(cmd)) { + if (!pass.AddCommand(std::move(cmd))) { return false; } } @@ -445,7 +445,7 @@ TEST_P(RendererTest, CanRenderInstanced) { cmd.BindVertices(builder.CreateVertexBuffer(pass.GetTransientsBuffer())); cmd.instance_count = kInstancesCount; - pass.AddCommand(cmd); + pass.AddCommand(std::move(cmd)); return true; })); } @@ -863,7 +863,7 @@ TEST_P(RendererTest, TheImpeller) { FS::BindBlueNoise(cmd, blue_noise, noise_sampler); FS::BindCubeMap(cmd, cube_map, cube_map_sampler); - pass.AddCommand(cmd); + pass.AddCommand(std::move(cmd)); return true; }; OpenPlaygroundHere(callback); @@ -919,7 +919,7 @@ TEST_P(RendererTest, ArrayUniforms) { FS::BindFragInfo(cmd, pass.GetTransientsBuffer().EmplaceUniform(fs_uniform)); - pass.AddCommand(cmd); + pass.AddCommand(std::move(cmd)); return true; }; OpenPlaygroundHere(callback); @@ -964,7 +964,7 @@ TEST_P(RendererTest, InactiveUniforms) { FS::BindFragInfo(cmd, pass.GetTransientsBuffer().EmplaceUniform(fs_uniform)); - pass.AddCommand(cmd); + pass.AddCommand(std::move(cmd)); return true; }; OpenPlaygroundHere(callback);