@@ -325,23 +325,13 @@ bool EntityPass::Render(ContentContext& renderer,
325325 Rect::MakeSize (root_render_target.GetRenderTargetSize ()),
326326 {.readonly = true });
327327
328- int32_t required_mip_count = 1 ;
329- IterateAllElements (
330- [&required_mip_count, lazy_glyph_atlas = renderer.GetLazyGlyphAtlas ()](
331- const Element& element) {
332- if (auto entity = std::get_if<Entity>(&element)) {
333- if (const auto & contents = entity->GetContents ()) {
334- contents->PopulateGlyphAtlas (lazy_glyph_atlas,
335- entity->DeriveTextScale ());
336- }
337- }
338- if (auto subpass = std::get_if<std::unique_ptr<EntityPass>>(&element)) {
339- const EntityPass* entity_pass = subpass->get ();
340- required_mip_count =
341- std::max (required_mip_count, entity_pass->GetRequiredMipCount ());
342- }
343- return true ;
344- });
328+ IterateAllEntities ([lazy_glyph_atlas =
329+ renderer.GetLazyGlyphAtlas ()](const Entity& entity) {
330+ if (const auto & contents = entity.GetContents ()) {
331+ contents->PopulateGlyphAtlas (lazy_glyph_atlas, entity.DeriveTextScale ());
332+ }
333+ return true ;
334+ });
345335
346336 ClipCoverageStack clip_coverage_stack = {ClipCoverageLayer{
347337 .coverage = Rect::MakeSize (root_render_target.GetRenderTargetSize ()),
@@ -353,7 +343,8 @@ bool EntityPass::Render(ContentContext& renderer,
353343 // there's no need to set up a stencil attachment on the root render target.
354344 if (reads_from_onscreen_backdrop) {
355345 EntityPassTarget offscreen_target = CreateRenderTarget (
356- renderer, root_render_target.GetRenderTargetSize (), required_mip_count,
346+ renderer, root_render_target.GetRenderTargetSize (),
347+ GetBackdropFilterMipCount (),
357348 GetClearColorOrDefault (render_target.GetRenderTargetSize ()));
358349
359350 if (!OnRender (renderer, // renderer
@@ -615,7 +606,7 @@ EntityPass::EntityResult EntityPass::GetEntityForElement(
615606 auto subpass_target = CreateRenderTarget (
616607 renderer, // renderer
617608 subpass_size, // size
618- /* mip_count= */ 1 ,
609+ subpass-> GetBackdropFilterMipCount () ,
619610 subpass->GetClearColorOrDefault (subpass_size)); // clear_color
620611
621612 if (!subpass_target.IsValid ()) {
@@ -1200,6 +1191,16 @@ void EntityPass::SetEnableOffscreenCheckerboard(bool enabled) {
12001191 enable_offscreen_debug_checkerboard_ = enabled;
12011192}
12021193
1194+ int32_t EntityPass::GetBackdropFilterMipCount () const {
1195+ int32_t result = 1 ;
1196+ for (auto & element : elements_) {
1197+ if (auto subpass = std::get_if<std::unique_ptr<EntityPass>>(&element)) {
1198+ result = std::max (result, subpass->get ()->GetRequiredMipCount ());
1199+ }
1200+ }
1201+ return result;
1202+ }
1203+
12031204EntityPassClipRecorder::EntityPassClipRecorder () {}
12041205
12051206void EntityPassClipRecorder::RecordEntity (const Entity& entity,
0 commit comments