-
Notifications
You must be signed in to change notification settings - Fork 6k
Reland "[Windows] Move to FlutterCompositor for rendering" #49262
Conversation
return true; | ||
} | ||
|
||
bool CompositorOpenGL::ClearSurface() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This clears previously presented layers if the engine presents with 0 layers
|
||
// Clear the view if there are no layers to present. | ||
if (layers_count == 0) { | ||
return engine_->view()->ClearSoftwareBitmap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This clears previously presented layers if the engine presents with 0 layers
This looks good to me, but I'd like people more specialized in these code to approve it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, looking forward to it landing
9fafc4f
to
6077e6d
Compare
gl_->BindFramebuffer(GL_READ_FRAMEBUFFER, source_id); | ||
gl_->BindFramebuffer(GL_DRAW_FRAMEBUFFER, kWindowFrameBufferId); | ||
|
||
gl_->BlitFramebuffer(0, // srcX0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What version of GL are you using as the base? BlitFramebuffer won't be available on ES2 and you'll have to resort to render to texture instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding, ANGLE supports GLES 3.0 if Direct 3D 11 is available, which it is on Windows 7 and higher. I've tested this on a single Windows 7 machine.
I'm definitely concerned by this though. I plan to ask the Windows community members to test their apps on the master
channel once this is rolled into the framework.
…140519) Roll Flutter Engine from c70f0a495ace to 1b1b2a12a597 (32 revisions) flutter/engine@c70f0a4...1b1b2a1 2023-12-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 4a10533a4dc8 to bcf68d22f0fa (1 revision) (flutter/engine#49329) 2023-12-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 1d0c3ecd1349 to 4a10533a4dc8 (1 revision) (flutter/engine#49326) 2023-12-21 flar@google.com Ensure sorted rects in ui.Canvas for legacy compatibility (flutter/engine#49309) 2023-12-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 63a452b45026 to 1d0c3ecd1349 (1 revision) (flutter/engine#49318) 2023-12-21 dnfield@google.com [Impeller] Make IPLR files multi-platform (flutter/engine#49253) 2023-12-21 ditman@gmail.com [web] Defer injection of platform views until needed. (flutter/engine#48960) 2023-12-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 1aef027ec953 to 63a452b45026 (2 revisions) (flutter/engine#49311) 2023-12-21 skia-flutter-autoroll@skia.org Roll Skia from 29917d8c97ca to 4b16117e94b2 (4 revisions) (flutter/engine#49310) 2023-12-21 737941+loic-sharma@users.noreply.github.com Reland "[Windows] Move to FlutterCompositor for rendering" (flutter/engine#49262) 2023-12-21 30870216+gaaclarke@users.noreply.github.com Reland `[Impeller] new blur: refactored math and fixed expanded padding size` (flutter/engine#49302) 2023-12-20 dkwingsmt@users.noreply.github.com Multiview pipeline Pt. 1: Skip illegal render calls (flutter/engine#49266) 2023-12-20 barpac02@gmail.com SemanticsUpdateBuilder: make all args non-null (flutter/engine#49148) 2023-12-20 30870216+gaaclarke@users.noreply.github.com [Impeller] fixed Rect::Contains (flutter/engine#49294) 2023-12-20 skia-flutter-autoroll@skia.org Roll Dart SDK from 97c3b7e1885a to 1aef027ec953 (1 revision) (flutter/engine#49295) 2023-12-20 30870216+gaaclarke@users.noreply.github.com Revert "[Impeller] new blur: refactored math and fixed expanded padding size" (flutter/engine#49298) 2023-12-20 30870216+gaaclarke@users.noreply.github.com [Impeller] new blur: refactored math and fixed expanded padding size (flutter/engine#49206) 2023-12-20 dkwingsmt@users.noreply.github.com Multi-view pointer event (flutter/engine#46213) 2023-12-20 1961493+harryterkelsen@users.noreply.github.com [web:multiview] Only call `Renderer.clearFragmentProgramCache` on hot restart (flutter/engine#48758) 2023-12-20 skia-flutter-autoroll@skia.org Roll Skia from 9cb1bb1164ea to 29917d8c97ca (1 revision) (flutter/engine#49289) 2023-12-20 bdero@google.com [Impeller] Add interactive Blur+Clip AiksTest. (flutter/engine#49283) 2023-12-20 sergiy.dubovik@supercell.com [macos] FlutterKeyboardManager memory leak fix (flutter/engine#48824) 2023-12-20 zanderso@users.noreply.github.com Don't guard Windows arm64 Dart SDK download on the release candidate flag (flutter/engine#49244) 2023-12-20 15619084+vashworth@users.noreply.github.com Fix testAppExtensionLaunching for Xcode 15/iOS 17 (flutter/engine#49242) 2023-12-20 skia-flutter-autoroll@skia.org Roll Skia from 8060d6b36066 to 9cb1bb1164ea (2 revisions) (flutter/engine#49288) 2023-12-20 skia-flutter-autoroll@skia.org Roll Dart SDK from ed415d966d8a to 97c3b7e1885a (1 revision) (flutter/engine#49287) 2023-12-20 skia-flutter-autoroll@skia.org Roll Skia from d0f09ad481f7 to 8060d6b36066 (1 revision) (flutter/engine#49285) 2023-12-20 kevinjchisholm@gmail.com [release] Update release config (flutter/engine#49254) 2023-12-20 skia-flutter-autoroll@skia.org Roll Dart SDK from 1732c4c92ccd to ed415d966d8a (1 revision) (flutter/engine#49274) 2023-12-20 skia-flutter-autoroll@skia.org Roll Dart SDK from 4c59838945d9 to 1732c4c92ccd (1 revision) (flutter/engine#49269) 2023-12-20 goderbauer@google.com Sync lints with flutter/flutter (flutter/engine#49192) 2023-12-19 1961493+harryterkelsen@users.noreply.github.com [web] Enforce onDrawFrame/onBeginFrame render rule (flutter/engine#49214) 2023-12-19 barpac02@gmail.com [Docs] Add more info about running tests on iOS (flutter/engine#48859) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC jimgraham@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md ...
…lutter#140519) Roll Flutter Engine from c70f0a495ace to 1b1b2a12a597 (32 revisions) flutter/engine@c70f0a4...1b1b2a1 2023-12-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 4a10533a4dc8 to bcf68d22f0fa (1 revision) (flutter/engine#49329) 2023-12-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 1d0c3ecd1349 to 4a10533a4dc8 (1 revision) (flutter/engine#49326) 2023-12-21 flar@google.com Ensure sorted rects in ui.Canvas for legacy compatibility (flutter/engine#49309) 2023-12-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 63a452b45026 to 1d0c3ecd1349 (1 revision) (flutter/engine#49318) 2023-12-21 dnfield@google.com [Impeller] Make IPLR files multi-platform (flutter/engine#49253) 2023-12-21 ditman@gmail.com [web] Defer injection of platform views until needed. (flutter/engine#48960) 2023-12-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 1aef027ec953 to 63a452b45026 (2 revisions) (flutter/engine#49311) 2023-12-21 skia-flutter-autoroll@skia.org Roll Skia from 29917d8c97ca to 4b16117e94b2 (4 revisions) (flutter/engine#49310) 2023-12-21 737941+loic-sharma@users.noreply.github.com Reland "[Windows] Move to FlutterCompositor for rendering" (flutter/engine#49262) 2023-12-21 30870216+gaaclarke@users.noreply.github.com Reland `[Impeller] new blur: refactored math and fixed expanded padding size` (flutter/engine#49302) 2023-12-20 dkwingsmt@users.noreply.github.com Multiview pipeline Pt. 1: Skip illegal render calls (flutter/engine#49266) 2023-12-20 barpac02@gmail.com SemanticsUpdateBuilder: make all args non-null (flutter/engine#49148) 2023-12-20 30870216+gaaclarke@users.noreply.github.com [Impeller] fixed Rect::Contains (flutter/engine#49294) 2023-12-20 skia-flutter-autoroll@skia.org Roll Dart SDK from 97c3b7e1885a to 1aef027ec953 (1 revision) (flutter/engine#49295) 2023-12-20 30870216+gaaclarke@users.noreply.github.com Revert "[Impeller] new blur: refactored math and fixed expanded padding size" (flutter/engine#49298) 2023-12-20 30870216+gaaclarke@users.noreply.github.com [Impeller] new blur: refactored math and fixed expanded padding size (flutter/engine#49206) 2023-12-20 dkwingsmt@users.noreply.github.com Multi-view pointer event (flutter/engine#46213) 2023-12-20 1961493+harryterkelsen@users.noreply.github.com [web:multiview] Only call `Renderer.clearFragmentProgramCache` on hot restart (flutter/engine#48758) 2023-12-20 skia-flutter-autoroll@skia.org Roll Skia from 9cb1bb1164ea to 29917d8c97ca (1 revision) (flutter/engine#49289) 2023-12-20 bdero@google.com [Impeller] Add interactive Blur+Clip AiksTest. (flutter/engine#49283) 2023-12-20 sergiy.dubovik@supercell.com [macos] FlutterKeyboardManager memory leak fix (flutter/engine#48824) 2023-12-20 zanderso@users.noreply.github.com Don't guard Windows arm64 Dart SDK download on the release candidate flag (flutter/engine#49244) 2023-12-20 15619084+vashworth@users.noreply.github.com Fix testAppExtensionLaunching for Xcode 15/iOS 17 (flutter/engine#49242) 2023-12-20 skia-flutter-autoroll@skia.org Roll Skia from 8060d6b36066 to 9cb1bb1164ea (2 revisions) (flutter/engine#49288) 2023-12-20 skia-flutter-autoroll@skia.org Roll Dart SDK from ed415d966d8a to 97c3b7e1885a (1 revision) (flutter/engine#49287) 2023-12-20 skia-flutter-autoroll@skia.org Roll Skia from d0f09ad481f7 to 8060d6b36066 (1 revision) (flutter/engine#49285) 2023-12-20 kevinjchisholm@gmail.com [release] Update release config (flutter/engine#49254) 2023-12-20 skia-flutter-autoroll@skia.org Roll Dart SDK from 1732c4c92ccd to ed415d966d8a (1 revision) (flutter/engine#49274) 2023-12-20 skia-flutter-autoroll@skia.org Roll Dart SDK from 4c59838945d9 to 1732c4c92ccd (1 revision) (flutter/engine#49269) 2023-12-20 goderbauer@google.com Sync lints with flutter/flutter (flutter/engine#49192) 2023-12-19 1961493+harryterkelsen@users.noreply.github.com [web] Enforce onDrawFrame/onBeginFrame render rule (flutter/engine#49214) 2023-12-19 barpac02@gmail.com [Docs] Add more info about running tests on iOS (flutter/engine#48859) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC jimgraham@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md ...
…lutter#49262)" This reverts commit 00d7d23.
…lutter#49262)" This reverts commit 00d7d23.
…49461) This reverts #49262 (00d7d23) as it regressed [`material_floating_search_bar`](https://pub.dev/packages/material_floating_search_bar_2)'s animation. This revert was created manually due to merge conflicts. Issue tracking bug: flutter/flutter#140828 Part of flutter/flutter#128904 <details> <summary>Minimal repro of the broken animation...</summary> Here's what the animation is supposed to look like:  Here's what the animation actually looks like:  Here is a minimal repro of the broken animation: ```dart // The Windows compositor changes regresses the animation in // the `material_floating_search_bar_2` package: // // https://pub.dev/packages/material_floating_search_bar_2/versions/0.5.0 // // Below is a minimal repro of the broken animation. This has two pieces: // // 1. The background fades to a grey color // 2. A box is "revealed" using a custom clipper // // On framework commit b417fb8 this animation is broken on Windows. // On framework commit 9c2a756 this animation works as expected on Windows. // // Good gif: https://publish-01.obsidian.md/access/b48ac8ca270cd9dac18c4a64d11b1c02/assets/2023-12-28-compositor_animation_regression_good.gif // Bad gif: https://publish-01.obsidian.md/access/b48ac8ca270cd9dac18c4a64d11b1c02/assets/2023-12-28-compositor_animation_regression_bad.gif import 'dart:math'; import 'dart:ui'; import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @OverRide Widget build(BuildContext context) { // Not using `MaterialApp` is necessary to reproduce: return Container( color: Colors.white, child: const Directionality( textDirection: TextDirection.ltr, child: FloatingSearchBar(), ), ); // Switching to `MaterialApp` fixes the issue: // return const MaterialApp( // home: Scaffold( // body: FloatingSearchBar(), // ), // ); } } class FloatingSearchBar extends StatefulWidget { const FloatingSearchBar({super.key}); @OverRide FloatingSearchBarState createState() => FloatingSearchBarState(); } class FloatingSearchBarState extends State<FloatingSearchBar> with SingleTickerProviderStateMixin { late final AnimationController _controller = AnimationController( vsync: this, duration: const Duration(seconds: 2), ); @OverRide void dispose() { _controller.dispose(); super.dispose(); } void _animate() { if (_controller.isDismissed || _controller.status == AnimationStatus.reverse) { _controller.forward(); } else { _controller.reverse(); } } @OverRide Widget build(BuildContext context) { return AnimatedBuilder( animation: _controller, builder: (BuildContext context, _) { return Stack( children: <Widget>[ if (!_controller.isDismissed) FadeTransition( opacity: _controller, child: const SizedBox.expand( child: DecoratedBox( decoration: BoxDecoration(color: Colors.black26), ), ), ), _buildSearchBar(), ], ); }, ); } Widget _buildSearchBar() { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ // This is where the search text input would go... GestureDetector( onTap: () => _animate(), child: Text( switch (_controller.status) { AnimationStatus.forward || AnimationStatus.completed => 'Click to close', AnimationStatus.reverse || AnimationStatus.dismissed => 'Click to open', }, style: const TextStyle(color: Colors.black), ), ), // Below are where the search results would be. Clicking on the search // input above reveals the results below. // Removing this fixes the background's fade transition. ClipOval( clipper: _CircularRevealClipper( fraction: _controller.value, ), child: DecoratedBox( decoration: BoxDecoration( color: Colors.white, // Removing this line fixes the background's fade transition. borderRadius: BorderRadius.circular(16.0), ), child: const Padding( padding: EdgeInsets.all(64.0), child: Text( 'Hello world', style: TextStyle(color: Colors.black), ), ), ), ), ], ); } } class _CircularRevealClipper extends CustomClipper<Rect> { const _CircularRevealClipper({required this.fraction}); final double fraction; @OverRide Rect getClip(Size size) { final double halfWidth = size.width * 0.5; final double maxRadius = sqrt(halfWidth * halfWidth + size.height * size.height); final double radius = lerpDouble(0.0, maxRadius, fraction) ?? 0; return Rect.fromCircle( center: Offset(halfWidth, 0), radius: radius, ); } @OverRide bool shouldReclip(CustomClipper<Rect> oldClipper) { if (oldClipper is _CircularRevealClipper) { return oldClipper.fraction != fraction; } return true; } } ``` </details> [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
## Original pull request description This migrates the Windows embedder to `FlutterCompositor` so that the engine renders off-screen to a framebuffer instead of directly onto the window's surface. This will allow us to support platform views and multiple views on Windows. Addresses flutter/flutter#128904 ## Reland (again) #49262 was reverted as it regressed [`package:material_floating_search_bar_2`](https://pub.dev/packages/material_floating_search_bar_2/versions/0.5.0). See: flutter/flutter#140828 This pull request is split into the following commits: 1. d337378 is the previous reland pull request, unchanged 2. e866af0 disables the scissor test before blitting the framebuffer, allowing us to "force" copy the framebuffer's contents by ignoring scissoring values [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Reland
#48849 was reverted as it incorrectly expected to receive always 1 layer. However, the engine will present 0 layers on an "empty" app. This pull request is split into two commits:
Original pull request description
This migrates the Windows embedder to
FlutterCompositor
so that the engine renders off-screen to a framebuffer instead of directly onto the window's surface. This will allow us to support platform views and multiple views on Windows.Addresses flutter/flutter#128904
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.