Repository navigation
Closed
Labels
P2Important issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)e: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team
Description
What happens
On Impeller OpenGLES:
TextShadowCache::Lookupruns the Gaussian blur underRenderTargetCache::DisableCache()(text_shadow_cache.cc#L63-L67 on master). Each miss allocates, then frees, an MSAA color + depth-stencil pair and two blur textures per shadow.MarkFrameEnddrops entries unused in that frame (text_shadow_cache.cc#L35-L38). Text whose glyphs cycle through a few states misses on every change.
Steps to reproduce
Profile build, scroll, count TexImage2DInitialization and render passes per frame on 1.raster in systrace.
import 'dart:async';
import 'package:flutter/material.dart';
const kShadows = [
Shadow(color: Colors.black, blurRadius: 3),
Shadow(color: Colors.black, blurRadius: 8),
];
void main() => runApp(MaterialApp(home: Repro()));
class Repro extends StatefulWidget {
@override
State<Repro> createState() => _ReproState();
}
class _ReproState extends State<Repro> {
int tick = 0;
@override
void initState() {
super.initState();
Timer.periodic(const Duration(milliseconds: 33), (_) => setState(() => tick++));
}
@override
Widget build(BuildContext context) => Scaffold(
body: Column(children: [
Expanded(
child: ListView.builder(
itemBuilder: (_, i) => ListTile(title: Text('Row $i')),
),
),
Row(children: [
const Text('Slowmode is enabled', style: TextStyle(shadows: kShadows)),
Text(' ${tick % 4}'),
]),
Text('Someone is typing${'.' * (tick % 4)}',
style: const TextStyle(shadows: kShadows)),
]),
);
}Expected
Unchanged text hits. Changed text reuses same-size blur targets from RenderTargetCache.
Actual
moto g54 5G (PowerVR BXM-8-256, 120 Hz):
- 3.47.7: both labels miss nearly every frame, 12
TexImage2DInitializationand 17 passes per frame. - 3.50 beta (with Started caching text shadows by content. #190681): the static label hits. Each change of the other label still allocates 2 MSAA renderbuffers + 6 textures and adds 8 passes.
Redmi Note 12 Pro 5G (Mali-G68): same per-frame counts on 3.47.7.
flutter doctor -v: Flutter 3.47.7, engine d8a2d6c768. Master a3d71d8 also reproduces from source.
Related
- Started caching text shadows by content. #190681 fixes the static case only.
- [Impeller] Off-frame rendering advances
RenderTargetCache's frame clock, evicting onscreensaveLayertargets #194307: off-frame rendering ages entries. - [Impeller] [Android] Text Shadow with CJK characters causes severe raster jank in ListView #184496: text shadow jank in a
ListView.
Fix in #194769.
Prepared with AI assistance.
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)e: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team
Activity
mbcorona commentedon Oct 21, 2026
Hi @M0n7y5, thanks for the writeup, the repro, and the PR.
Routing to team-engine.
gaaclarke commentedon Oct 26, 2026
Do you have some quantifiable data that informs making this change?
M0n7y5 commentedon Oct 29, 2026
Yes, from Perfetto traces on a moto g54 5G (PowerVR BXM-8-256, Impeller OpenGLES, 120 Hz),
TexImage2DInitializationevents and render passes counted per frame on the raster thread, plus releaseFrameTiming:The chat row's baseline is the 3.47.7 release build, so part of its raster gain comes from master itself (#190681 and the GLES state dedup); the allocation count is the number that isolates this change. On a Redmi Note 12 Pro 5G (Mali-G68) the repro goes from raster p50 5.35 ms to 1.94 ms with the patched engine. Output is pixel-identical in both cases. The traces and the counting script are available if useful.
[Impeller] Reuse render targets on text shadow cache misses (flutter#…