Unverified Commit 1ff82af5 authored by gaaclarke's avatar gaaclarke Committed by GitHub

[Impeller] Adds advanced blend benchmark (#131893)

issue: https://github.com/flutter/flutter/issues/131784

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
parent c4954968
...@@ -2613,6 +2613,38 @@ targets: ...@@ -2613,6 +2613,38 @@ targets:
["devicelab", "android", "linux", "samsung", "s10"] ["devicelab", "android", "linux", "samsung", "s10"]
task_name: animated_blur_backdrop_filter_perf__timeline_summary task_name: animated_blur_backdrop_filter_perf__timeline_summary
- name: Linux_samsung_s10 animated_advanced_blend_perf_opengles__timeline_summary
recipe: devicelab/devicelab_drone
presubmit: false
bringup: true
timeout: 60
properties:
ignore_flakiness: "true"
tags: >
["devicelab", "android", "linux", "samsung", "s10"]
task_name: animated_advanced_blend_perf_opengles__timeline_summary
- name: Linux_samsung_s10 animated_advanced_blend_perf__timeline_summary
recipe: devicelab/devicelab_drone
presubmit: false
bringup: true
timeout: 60
properties:
ignore_flakiness: "true"
tags: >
["devicelab", "android", "linux", "samsung", "s10"]
task_name: animated_advanced_blend_perf__timeline_summary
- name: Mac_ios animated_advanced_blend_perf_ios__timeline_summary
recipe: devicelab/devicelab_drone
presubmit: false
timeout: 60
bringup: true
properties:
tags: >
["devicelab", "ios", "mac"]
task_name: animated_advanced_blend_perf_ios__timeline_summary
- name: Linux_samsung_s10 animated_blur_backdrop_filter_perf_opengles__timeline_summary - name: Linux_samsung_s10 animated_blur_backdrop_filter_perf_opengles__timeline_summary
recipe: devicelab/devicelab_drone recipe: devicelab/devicelab_drone
presubmit: false presubmit: false
......
...@@ -91,6 +91,9 @@ ...@@ -91,6 +91,9 @@
/dev/devicelab/bin/tasks/textfield_perf__e2e_summary.dart @zanderso @flutter/engine /dev/devicelab/bin/tasks/textfield_perf__e2e_summary.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/web_size__compile_test.dart @yjbanov @flutter/web /dev/devicelab/bin/tasks/web_size__compile_test.dart @yjbanov @flutter/web
/dev/devicelab/bin/tasks/wide_gamut_ios.dart @gaaclarke @flutter/engine /dev/devicelab/bin/tasks/wide_gamut_ios.dart @gaaclarke @flutter/engine
/dev/devicelab/bin/tasks/animated_advanced_blend_perf__timeline_summary.dart @gaaclarke @flutter/engine
/dev/devicelab/bin/tasks/animated_advanced_blend_perf_ios__timeline_summary.dart @gaaclarke @flutter/engine
/dev/devicelab/bin/tasks/animated_advanced_blend_perf_opengles__timeline_summary.dart @gaaclarke @flutter/engine
/dev/devicelab/bin/tasks/animated_blur_backdrop_filter_perf__timeline_summary.dart @jonahwilliams @flutter/engine /dev/devicelab/bin/tasks/animated_blur_backdrop_filter_perf__timeline_summary.dart @jonahwilliams @flutter/engine
/dev/devicelab/bin/tasks/animated_blur_backdrop_filter_perf_opengles__timeline_summary.dart @gaaclarke @flutter/engine /dev/devicelab/bin/tasks/animated_blur_backdrop_filter_perf_opengles__timeline_summary.dart @gaaclarke @flutter/engine
/dev/devicelab/bin/tasks/slider_perf_android.dart @tahatesser @flutter/framework /dev/devicelab/bin/tasks/slider_perf_android.dart @tahatesser @flutter/framework
......
...@@ -132,7 +132,6 @@ ...@@ -132,7 +132,6 @@
1842E3C5134E282C88C541B8 /* Pods-Runner.release.xcconfig */, 1842E3C5134E282C88C541B8 /* Pods-Runner.release.xcconfig */,
F269DC09D76325C7B7334781 /* Pods-Runner.profile.xcconfig */, F269DC09D76325C7B7334781 /* Pods-Runner.profile.xcconfig */,
); );
name = Pods;
path = Pods; path = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
...@@ -351,7 +350,10 @@ ...@@ -351,7 +350,10 @@
DEVELOPMENT_TEAM = S8QB4VV633; DEVELOPMENT_TEAM = S8QB4VV633;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.macrobenchmarks; PRODUCT_BUNDLE_IDENTIFIER = com.example.macrobenchmarks;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
...@@ -464,9 +466,13 @@ ...@@ -464,9 +466,13 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = S8QB4VV633;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.macrobenchmarks; PRODUCT_BUNDLE_IDENTIFIER = com.example.macrobenchmarks;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
...@@ -479,9 +485,13 @@ ...@@ -479,9 +485,13 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = S8QB4VV633;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.macrobenchmarks; PRODUCT_BUNDLE_IDENTIFIER = com.example.macrobenchmarks;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
......
...@@ -26,10 +26,7 @@ ...@@ -26,10 +26,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
...@@ -39,19 +36,19 @@ ...@@ -39,19 +36,19 @@
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
<AdditionalOptions> <Testables>
</AdditionalOptions> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES"
debugServiceExtension = "internal" debugServiceExtension = "internal"
enableGPUFrameCaptureMode = "1"
allowLocationSimulation = "YES"> allowLocationSimulation = "YES">
<BuildableProductRunnable <BuildableProductRunnable
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">
...@@ -63,8 +60,6 @@ ...@@ -63,8 +60,6 @@
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Profile" buildConfiguration = "Profile"
......
...@@ -39,6 +39,7 @@ const String kSlidersRouteName = '/sliders'; ...@@ -39,6 +39,7 @@ const String kSlidersRouteName = '/sliders';
const String kDrawPointsPageRougeName = '/draw_points'; const String kDrawPointsPageRougeName = '/draw_points';
const String kDrawVerticesPageRouteName = '/draw_vertices'; const String kDrawVerticesPageRouteName = '/draw_vertices';
const String kDrawAtlasPageRouteName = '/draw_atlas'; const String kDrawAtlasPageRouteName = '/draw_atlas';
const String kAnimatedAdvancedBlend = '/animated_advanced_blend';
const String kOpacityPeepholeOneRectRouteName = '$kOpacityPeepholeRouteName/one_big_rect'; const String kOpacityPeepholeOneRectRouteName = '$kOpacityPeepholeRouteName/one_big_rect';
const String kOpacityPeepholeColumnOfOpacityRouteName = '$kOpacityPeepholeRouteName/column_of_opacity'; const String kOpacityPeepholeColumnOfOpacityRouteName = '$kOpacityPeepholeRouteName/column_of_opacity';
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'common.dart'; import 'common.dart';
import 'src/animated_advanced_blend.dart';
import 'src/animated_blur_backdrop_filter.dart'; import 'src/animated_blur_backdrop_filter.dart';
import 'src/animated_complex_image_filtered.dart'; import 'src/animated_complex_image_filtered.dart';
import 'src/animated_complex_opacity.dart'; import 'src/animated_complex_opacity.dart';
...@@ -95,6 +96,7 @@ class MacrobenchmarksApp extends StatelessWidget { ...@@ -95,6 +96,7 @@ class MacrobenchmarksApp extends StatelessWidget {
kDrawPointsPageRougeName: (BuildContext context) => const DrawPointsPage(), kDrawPointsPageRougeName: (BuildContext context) => const DrawPointsPage(),
kDrawVerticesPageRouteName: (BuildContext context) => const DrawVerticesPage(), kDrawVerticesPageRouteName: (BuildContext context) => const DrawVerticesPage(),
kDrawAtlasPageRouteName: (BuildContext context) => const DrawAtlasPage(), kDrawAtlasPageRouteName: (BuildContext context) => const DrawAtlasPage(),
kAnimatedAdvancedBlend: (BuildContext context) => const AnimatedAdvancedBlend(),
}, },
); );
} }
...@@ -364,6 +366,13 @@ class HomePage extends StatelessWidget { ...@@ -364,6 +366,13 @@ class HomePage extends StatelessWidget {
Navigator.pushNamed(context, kDrawAtlasPageRouteName); Navigator.pushNamed(context, kDrawAtlasPageRouteName);
}, },
), ),
ElevatedButton(
key: const Key(kAnimatedAdvancedBlend),
child: const Text('Animated Advanced Blend'),
onPressed: () {
Navigator.pushNamed(context, kAnimatedAdvancedBlend);
},
),
], ],
), ),
); );
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
class _MultiplyPainter extends CustomPainter {
_MultiplyPainter(this._color);
final Color _color;
@override
void paint(Canvas canvas, Size size) {
const int xDenominator = 2;
const int yDenominator = 10;
final double width = size.width / xDenominator;
final double height = size.height / yDenominator;
for (int y = 0; y < yDenominator; y++) {
for (int x = 0; x < xDenominator; x++) {
final Rect rect = Offset(x * width, y * height) & Size(width, height);
final Paint basePaint = Paint()
..color = Color.fromARGB(
(((x + 1) * width) / size.width * 255.0).floor(),
(((y + 1) * height) / size.height * 255.0).floor(),
255,
127);
canvas.drawRect(rect, basePaint);
final Paint multiplyPaint = Paint()
..color = _color
..blendMode = BlendMode.multiply;
canvas.drawRect(rect, multiplyPaint);
}
}
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}
class AnimatedAdvancedBlend extends StatefulWidget {
const AnimatedAdvancedBlend({super.key});
@override
State<AnimatedAdvancedBlend> createState() => _AnimatedAdvancedBlendState();
}
class _AnimatedAdvancedBlendState extends State<AnimatedAdvancedBlend> with SingleTickerProviderStateMixin {
late final AnimationController controller = AnimationController(vsync: this, duration: const Duration(milliseconds: 5000));
late final Animation<double> animation = controller.drive(Tween<double>(begin: 0.0, end: 1.0));
Color _color = const Color.fromARGB(255, 255, 0, 255);
@override
void initState() {
super.initState();
controller.repeat();
animation.addListener(() {
setState(() {
_color = Color.fromARGB((animation.value * 255).floor(), 255, 0, 255);
});
});
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: CustomPaint(
painter: _MultiplyPainter(_color),
child: Container(),
),
));
}
}
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:macrobenchmarks/common.dart';
import 'util.dart';
void main() {
macroPerfTest(
'animated_advanced_blend_perf',
kAnimatedAdvancedBlend,
pageDelay: const Duration(seconds: 1),
duration: const Duration(seconds: 10),
);
}
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createAnimatedAdvancedBlendPerfTest(enableImpeller: true));
}
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createAnimatedAdvancedBlendPerfTest(enableImpeller: true));
}
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createAnimatedAdvancedBlendPerfTest(
enableImpeller: true, forceOpenGLES: true));
}
...@@ -628,6 +628,21 @@ TaskFunction createGradientStaticPerfE2ETest() { ...@@ -628,6 +628,21 @@ TaskFunction createGradientStaticPerfE2ETest() {
).run; ).run;
} }
TaskFunction createAnimatedAdvancedBlendPerfTest({
bool? enableImpeller,
bool? forceOpenGLES,
}) {
return PerfTest(
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
'test_driver/run_app.dart',
'animated_advanced_blend_perf',
enableImpeller: enableImpeller,
forceOpenGLES: forceOpenGLES,
testDriver: 'test_driver/animated_advanced_blend_perf_test.dart',
saveTraceFile: true,
).run;
}
TaskFunction createAnimatedBlurBackropFilterPerfTest({ TaskFunction createAnimatedBlurBackropFilterPerfTest({
bool? enableImpeller, bool? enableImpeller,
bool? forceOpenGLES, bool? forceOpenGLES,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment