-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] finish migration to new render pass API. #49740
Changes from all commits
b47d01e
5143ba9
52f7456
0536713
2ac88c2
c9fc88b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -235,13 +235,14 @@ bool AtlasContents::Render(const ContentContext& renderer, | |
| } | ||
| } | ||
|
|
||
| Command cmd; | ||
| DEBUG_COMMAND_INFO( | ||
| cmd, SPrintF("DrawAtlas Blend (%s)", BlendModeToString(blend_mode_))); | ||
| cmd.BindVertices(vtx_builder.CreateVertexBuffer(host_buffer)); | ||
| cmd.stencil_reference = entity.GetClipDepth(); | ||
| auto options = OptionsFromPass(pass); | ||
| cmd.pipeline = renderer.GetPorterDuffBlendPipeline(options); | ||
| #ifdef IMPELLER_DEBUG | ||
| pass.SetCommandLabel( | ||
| SPrintF("DrawAtlas Blend (%s)", BlendModeToString(blend_mode_))); | ||
| #endif // IMPELLER_DEBUG | ||
| pass.SetVertexBuffer(vtx_builder.CreateVertexBuffer(host_buffer)); | ||
| pass.SetStencilReference(entity.GetClipDepth()); | ||
| pass.SetPipeline( | ||
| renderer.GetPorterDuffBlendPipeline(OptionsFromPass(pass))); | ||
|
|
||
| FS::FragInfo frag_info; | ||
| VS::FrameInfo frame_info; | ||
|
|
@@ -253,7 +254,7 @@ bool AtlasContents::Render(const ContentContext& renderer, | |
| } | ||
| auto dst_sampler = renderer.GetContext()->GetSamplerLibrary()->GetSampler( | ||
| dst_sampler_descriptor); | ||
| FS::BindTextureSamplerDst(cmd, texture_, dst_sampler); | ||
| FS::BindTextureSamplerDst(pass, texture_, dst_sampler); | ||
| frame_info.texture_sampler_y_coord_scale = texture_->GetYCoordScale(); | ||
|
|
||
| frag_info.output_alpha = alpha_; | ||
|
|
@@ -269,14 +270,14 @@ bool AtlasContents::Render(const ContentContext& renderer, | |
| frag_info.dst_coeff_src_alpha = blend_coefficients[3]; | ||
| frag_info.dst_coeff_src_color = blend_coefficients[4]; | ||
|
|
||
| FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info)); | ||
| FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info)); | ||
|
|
||
| frame_info.mvp = pass.GetOrthographicTransform() * entity.GetTransform(); | ||
|
|
||
| auto uniform_view = host_buffer.EmplaceUniform(frame_info); | ||
| VS::BindFrameInfo(cmd, uniform_view); | ||
| VS::BindFrameInfo(pass, uniform_view); | ||
|
|
||
| return pass.AddCommand(std::move(cmd)); | ||
| return pass.Draw().ok(); | ||
| } | ||
|
|
||
| // Advanced blends. | ||
|
|
@@ -396,8 +397,7 @@ bool AtlasTextureContents::Render(const ContentContext& renderer, | |
| return true; | ||
| } | ||
|
|
||
| Command cmd; | ||
| DEBUG_COMMAND_INFO(cmd, "AtlasTexture"); | ||
| pass.SetCommandLabel("AtlasTexture"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI this is still incurring a copy because the parameter takes a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/flutter/engine/blob/main/impeller/renderer/render_pass.h#L74 This takes a string view.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RenderPass label vs Command label
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should rename SetCommandLabel at some point since the concept of Command has been eliminated.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think that it would be better if the RenderPass label was provided during construction instead of via a Setter. Then we just need "SetLabel" |
||
|
|
||
| auto& host_buffer = renderer.GetTransientsBuffer(); | ||
|
|
||
|
|
@@ -407,14 +407,14 @@ bool AtlasTextureContents::Render(const ContentContext& renderer, | |
| frame_info.alpha = alpha_; | ||
|
|
||
| auto options = OptionsFromPassAndEntity(pass, entity); | ||
| cmd.pipeline = renderer.GetTexturePipeline(options); | ||
| cmd.stencil_reference = entity.GetClipDepth(); | ||
| cmd.BindVertices(vertex_builder.CreateVertexBuffer(host_buffer)); | ||
| VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info)); | ||
| FS::BindTextureSampler(cmd, texture, | ||
| pass.SetPipeline(renderer.GetTexturePipeline(options)); | ||
| pass.SetStencilReference(entity.GetClipDepth()); | ||
| pass.SetVertexBuffer(vertex_builder.CreateVertexBuffer(host_buffer)); | ||
| VS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info)); | ||
| FS::BindTextureSampler(pass, texture, | ||
| renderer.GetContext()->GetSamplerLibrary()->GetSampler( | ||
| parent_.GetSamplerDescriptor())); | ||
| return pass.AddCommand(std::move(cmd)); | ||
| return pass.Draw().ok(); | ||
| } | ||
|
|
||
| // AtlasColorContents | ||
|
|
@@ -483,8 +483,7 @@ bool AtlasColorContents::Render(const ContentContext& renderer, | |
| return true; | ||
| } | ||
|
|
||
| Command cmd; | ||
| DEBUG_COMMAND_INFO(cmd, "AtlasColors"); | ||
| pass.SetCommandLabel("AtlasColors"); | ||
|
|
||
| auto& host_buffer = renderer.GetTransientsBuffer(); | ||
|
|
||
|
|
@@ -496,12 +495,12 @@ bool AtlasColorContents::Render(const ContentContext& renderer, | |
|
|
||
| auto opts = OptionsFromPassAndEntity(pass, entity); | ||
| opts.blend_mode = BlendMode::kSourceOver; | ||
| cmd.pipeline = renderer.GetGeometryColorPipeline(opts); | ||
| cmd.stencil_reference = entity.GetClipDepth(); | ||
| cmd.BindVertices(vertex_builder.CreateVertexBuffer(host_buffer)); | ||
| VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info)); | ||
| FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info)); | ||
| return pass.AddCommand(std::move(cmd)); | ||
| pass.SetPipeline(renderer.GetGeometryColorPipeline(opts)); | ||
| pass.SetStencilReference(entity.GetClipDepth()); | ||
| pass.SetVertexBuffer(vertex_builder.CreateVertexBuffer(host_buffer)); | ||
| VS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info)); | ||
| FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info)); | ||
| return pass.Draw().ok(); | ||
| } | ||
|
|
||
| } // namespace impeller | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only added ifdefs where we do runtime string creation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the macro style we had previously. Did you find the string creation wasn't getting stripped out?
FWIW this could be transformed to a static string too since we only have so many blend modes. I did that at some point but the PR got caught up and dropped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings were still getting formatted, then dropped. We could add more static strings for these, I wouldn't be opposed. Feedback I got on the macro approach was that everyone hated it 😆