From 98739667aec07d62848e3b1c4e8068124d219aa3 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Thu, 28 Feb 2019 20:06:28 -0800 Subject: [PATCH] Shader warm-up doc fixes (#28679) See https://github.com/flutter/flutter/pull/28614#discussion_r261422778 and https://github.com/flutter/flutter/pull/28614#pullrequestreview-209359908 --- .../flutter/lib/src/painting/binding.dart | 2 +- .../lib/src/painting/shader_warm_up.dart | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/flutter/lib/src/painting/binding.dart b/packages/flutter/lib/src/painting/binding.dart index 41e584fb607..7608917835d 100644 --- a/packages/flutter/lib/src/painting/binding.dart +++ b/packages/flutter/lib/src/painting/binding.dart @@ -39,7 +39,7 @@ mixin PaintingBinding on BindingBase, ServicesBinding { /// in the middle of an animation or interaction. In that case, set /// [shaderWarmUp] to a custom [ShaderWarmUp] before calling [initInstances] /// (usually before [runApp] for normal Flutter apps, and before - /// [enableFlutterDriverExtension] for Flutter drive tests). Paint the scene + /// [enableFlutterDriverExtension] for Flutter driver tests). Paint the scene /// in the custom [ShaderWarmUp] so Flutter can pre-compile and cache the /// shaders during startup. The warm up is only costly (100ms-200ms, /// depending on the shaders to compile) during the first run after the diff --git a/packages/flutter/lib/src/painting/shader_warm_up.dart b/packages/flutter/lib/src/painting/shader_warm_up.dart index ec7bbdb6ab2..b2ea90f7513 100644 --- a/packages/flutter/lib/src/painting/shader_warm_up.dart +++ b/packages/flutter/lib/src/painting/shader_warm_up.dart @@ -23,17 +23,18 @@ import 'package:flutter/foundation.dart'; /// done before calling [runApp]. /// /// To determine whether a draw operation is useful for warming up shaders, -/// check the difference in the `worst_frame_rasterizer_time_millis` benchmarks. -/// Also, tracing with `flutter run --profile --trace-skia` may reveal whether -/// there is shader-compilation-related jank. If there is such jank, some long +/// check whether it improves the slowest GPU frame. Also, tracing with +/// `flutter run --profile --trace-skia` may reveal whether there is shader- +/// compilation-related jank. If there is such jank, some long /// `GrGLProgramBuilder::finalize` calls would appear in the middle of an /// animation. Their parent calls, which look like `XyzOp` (e.g., `FillRecOp`, -/// `CircularRRectOp`) would suggest Xyz draw operations are causing the shaders -/// to be compiled. A useful shader warm-up draw operation would eliminate such -/// long compilation calls in the animation. To double-check the warm-up, trace -/// with `flutter run --profile --trace-skia --start-paused`. The -/// `GrGLProgramBuilder` with the associated `XyzOp` should appear during -/// startup rather than in the middle of a later animation. +/// `CircularRRectOp`) would suggest Xyz draw operations are causing the +/// shaders to be compiled. A useful shader warm-up draw operation would +/// eliminate such long compilation calls in the animation. To double-check +/// the warm-up, trace with `flutter run --profile --trace-skia --start- +/// paused`. The `GrGLProgramBuilder` with the associated `XyzOp` should +/// appear during startup rather than in the middle of a later animation. + /// /// This warm-up needs to be run on each individual device because the shader /// compilation depends on the specific GPU hardware and driver a device has. It