Skip to content

Commit 24489a0

Browse files
committed
[Impeller] Use the default geometry callback in circle and UberSDF contents
CircleContents and UberSDFContents were the only contents passing a custom create_geom_callback, and it only returned a precomputed GetPositionBuffer result. The default callback performs the same call, and neither CircleGeometry nor UberSDFGeometry overrides GetResultMode (both are kNormal). force_stencil was false as well, so the stencil-then-cover path never engaged. This also removes the now-unused geometry_result precompute. test-exempt: refactor with no behavior change; existing golden tests cover both pipelines.
1 parent e8834b8 commit 24489a0

2 files changed

Lines changed: 2 additions & 25 deletions

File tree

‎engine/src/flutter/impeller/entity/contents/circle_contents.cc‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ bool CircleContents::Render(const ContentContext& renderer,
5151
frag_info.aa_pixels = aa_padding_;
5252
frag_info.stroked = stroked_ ? 1.0f : 0.0f;
5353

54-
auto geometry_result = geometry_->GetPositionBuffer(renderer, entity, pass);
55-
5654
PipelineBuilderCallback pipeline_callback =
5755
[&renderer](ContentContextOptions options) {
5856
return renderer.GetCirclePipeline(options);
@@ -62,20 +60,11 @@ bool CircleContents::Render(const ContentContext& renderer,
6260
this, geometry_.get(), renderer, entity, pass, pipeline_callback,
6361
frame_info,
6462
/*bind_fragment_callback=*/
65-
// DrawGeometry invokes this before returning, so capturing locals by
66-
// reference is safe.
6763
[&frag_info, &data_host_buffer](RenderPass& pass) {
6864
FS::BindFragInfo(pass, data_host_buffer.EmplaceUniform(frag_info));
6965
pass.SetCommandLabel("Circle");
7066
return true;
71-
},
72-
/*force_stencil=*/false,
73-
/*create_geom_callback=*/
74-
// DrawGeometry invokes this before returning, so capturing
75-
// geometry_result by reference is safe.
76-
[&geometry_result](const ContentContext& renderer, const Entity& entity,
77-
RenderPass& pass,
78-
const Geometry* geometry) { return geometry_result; });
67+
});
7968
}
8069

8170
std::optional<Rect> CircleContents::GetCoverage(const Entity& entity) const {

‎engine/src/flutter/impeller/entity/contents/uber_sdf_contents.cc‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,6 @@ bool UberSDFContents::Render(const ContentContext& renderer,
153153
renderer.GetContext()->GetSamplerLibrary()->GetSampler({});
154154
}
155155

156-
auto geometry_result =
157-
GetGeometry()->GetPositionBuffer(renderer, entity, pass);
158-
159156
PipelineBuilderCallback pipeline_callback =
160157
[&renderer](ContentContextOptions options) {
161158
return renderer.GetUberSDFPipeline(options);
@@ -165,22 +162,13 @@ bool UberSDFContents::Render(const ContentContext& renderer,
165162
this, GetGeometry(), renderer, entity, pass, pipeline_callback,
166163
frame_info,
167164
/*bind_fragment_callback=*/
168-
// DrawGeometry invokes this before returning, so capturing locals by
169-
// reference is safe.
170165
[&frag_info, &data_host_buffer, &sampler_binding](RenderPass& pass) {
171166
FS::BindColorSourceSampler(pass, sampler_binding.texture,
172167
sampler_binding.sampler);
173168
FS::BindFragInfo(pass, data_host_buffer.EmplaceUniform(frag_info));
174169
pass.SetCommandLabel("UberSDF");
175170
return true;
176-
},
177-
/*force_stencil=*/false,
178-
/*create_geom_callback=*/
179-
// DrawGeometry invokes this before returning, so capturing
180-
// geometry_result by reference is safe.
181-
[&geometry_result](const ContentContext& renderer, const Entity& entity,
182-
RenderPass& pass,
183-
const Geometry* geometry) { return geometry_result; });
171+
});
184172
}
185173

186174
std::optional<Rect> UberSDFContents::GetCoverage(const Entity& entity) const {

0 commit comments

Comments
 (0)