Skip to content

Starts flipping content on windows to avoid full screen renders - #193133

Merged
auto-submit[bot] merged 9 commits into
flutter:masterfrom
gaaclarke:no-flip-windows
Oct 3, 2026
Merged

auto-submit[bot] merged 9 commits into
flutter:masterfrom
gaaclarke:no-flip-windows

Conversation

@gaaclarke

@gaaclarke gaaclarke commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

This is glue code to hook us up to the optimization we've created in ANGLE at https://chromium-review.git.corp.google.com/c/angle/angle/+/8436859

This removes a temporary full screen texture and a full screen render pass, allowing us to MSAA resolve directly into the swapchain.

fixes: #192496

screenshot of afterwards capture

Notice the last thing is a resolve.

Screenshot 2026-09-25 133558

Pre-launch Checklist

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

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-windows Building on or for Windows specifically a: desktop Running on desktop e: impeller Impeller rendering backend issues and features requests team-windows Owned by the Windows platform team labels Sep 21, 2026
@gaaclarke gaaclarke added the CICD Run CI/CD label Sep 25, 2026
Comment on lines +123 to +124
attributes.push_back(EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE);
attributes.push_back(EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE);

@gaaclarke gaaclarke Sep 25, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds counter intuitive but looking at the gpu captures, this wasn't helping us. EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE only helps when rendering directly to the swapchain. We render to offscreen MSAA and resolve it to the swapchain.

@gaaclarke
gaaclarke marked this pull request as ready for review September 28, 2026 20:19
@gaaclarke
gaaclarke requested a review from a team as a code owner September 28, 2026 20:19

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for a top-left default framebuffer origin in Impeller's GLES backend, allowing embedders (such as ANGLE on Windows with EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE) to use an inverted Y-axis window surface. This avoids a full-screen shader pass for flipping during presentation by keeping the pipeline in a single orientation. Feedback on these changes suggests downgrading a warning log to a debug log when the surface orientation extension is unavailable to prevent noisy production logs, and refactoring a test helper function to remove an unused context parameter.

Comment on lines +228 to +229
FML_LOG(WARNING) << "EGL_ANGLE_surface_orientation is unavailable. "
"Falling back to a bottom-left surface origin.";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This warning is logged on any hardware/driver configuration that does not support EGL_ANGLE_surface_orientation. Since this is a completely expected fallback path and rendering remains fully correct, logging a WARNING can be unnecessarily noisy for production applications. Consider changing this to a debug-only log (FML_DLOG(INFO)) or a verbose log (FML_VLOG(1)).

Suggested change
FML_LOG(WARNING) << "EGL_ANGLE_surface_orientation is unavailable. "
"Falling back to a bottom-left surface origin.";
FML_DLOG(INFO) << \"EGL_ANGLE_surface_orientation is unavailable. \"\n \"Falling back to a bottom-left surface origin.\";

Comment on lines +553 to +556
std::shared_ptr<RenderPass> CreateWrappedFBORenderPass(
const std::shared_ptr<ContextGLES>& context,
const std::shared_ptr<ReactorGLES>& reactor,
const std::shared_ptr<CommandBuffer>& command_buffer) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The context parameter is not used anywhere inside the CreateWrappedFBORenderPass helper function. Removing it simplifies the helper's signature and improves maintainability.

std::shared_ptr<RenderPass> CreateWrappedFBORenderPass(\n    const std::shared_ptr<ReactorGLES>& reactor,\n    const std::shared_ptr<CommandBuffer>& command_buffer) {

Comment on lines +583 to +584
std::shared_ptr<RenderPass> render_pass =
CreateWrappedFBORenderPass(ctx.context, reactor, ctx.command_buffer);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Update the call to CreateWrappedFBORenderPass to match the simplified signature by removing the unused ctx.context argument.

  std::shared_ptr<RenderPass> render_pass =\n      CreateWrappedFBORenderPass(reactor, ctx.command_buffer);

Comment on lines +612 to +613
std::shared_ptr<RenderPass> render_pass =
CreateWrappedFBORenderPass(ctx.context, reactor, ctx.command_buffer);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Update the call to CreateWrappedFBORenderPass to match the simplified signature by removing the unused ctx.context argument.

  std::shared_ptr<RenderPass> render_pass =\n      CreateWrappedFBORenderPass(reactor, ctx.command_buffer);

@b-luk b-luk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except for one comment that I think could be clearer.

const bool flip_y = !is_wrapped_fbo;
//
// When the embedder's default framebuffer already has a top-left origin
// there is nothing to leave alone: every target, wrapped or not, is stored

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As someone new to this code, I think this comment and the existing comment above was a bit confusing. Particularly the phrasing of "nothing to leave alone" in the new comment, and the terms "offscreen FBO" and "swapchain" vs "wrapped" and "non-wrapped".

How about something like:

  // Offscreen (non-wrapped) FBOs always flip in the vertex shader so they are
  // stored with a top-left origin, matching Impeller's coordinate system. See
  // https://github.com/flutter/flutter/issues/186554.
  //
  // Wrapped FBOs match the embedder's default framebuffer origin:
  // - Bottom-left (the OpenGL default): no flip.
  // - Top-left (currently only the Windows embedder, via ANGLE's
  //   EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE): flip, like offscreen FBOs.
  //   The whole pipeline is then in one orientation, so the blit that
  //   presents a wrapped framebuffer to the swapchain is a straight 1:1 copy,
  //   which lets the driver resolve or DMA it instead of running a
  //   full-screen shader pass to flip it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@gaaclarke
gaaclarke requested a review from b-luk October 1, 2026 19:36
b-luk
b-luk previously approved these changes Oct 1, 2026
andywolff
andywolff previously approved these changes Oct 1, 2026

@andywolff andywolff left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some nits

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building on @b-luk's comment on lines 362-369, this comment still states that the swapchain always keeps the top-down to bottom-up conversion. We could update this note so it reflects that flip_y can now be true for swapchain targets when the default framebuffer has a top-left origin.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One option for this:

My comment at #193133 (comment) also suggested a change for this line

  // Offscreen (non-wrapped) FBOs always flip in the vertex shader so they are
  // stored with a top-left origin, matching Impeller's coordinate system. See
  // https://github.com/flutter/flutter/issues/186554.

That way the first paragraph of this comment block is only about offscreen/non-wrapped FBOs and doesn't mention the swapchain at all. And the second paragraph (which is already changed) is only about the swapchain/wrapped FBOs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed this, done

@gaaclarke gaaclarke added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Oct 1, 2026
@gaaclarke
gaaclarke dismissed stale reviews from andywolff and b-luk via 2402d49 October 2, 2026 01:28
@gaaclarke
gaaclarke requested review from andywolff and b-luk October 2, 2026 01:31
@gaaclarke
gaaclarke dismissed stale reviews from b-luk and andywolff via 4771817 October 2, 2026 17:49
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 2, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 2, 2026
@auto-submit

auto-submit Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/193133, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 2, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 2, 2026
Merged via the queue into flutter:master with commit 0e62d43 Oct 3, 2026
39 of 40 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 3, 2026
0nilinkz added a commit to 0nilinkz/flutter that referenced this pull request Oct 7, 2026
Resolve the EGL manager and Windows engine conflicts from flutter#193133 by passing both the upstream surface-orientation flag and the optional program cache. Keep cache installation after eglInitialize and before context creation.

Validation: clang-format checks on resolved ranges, whitespace checks, call-site review, and unchanged cache implementation/tests. Native Windows build and unit tests were not run on this macOS host.
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…ter#193133)

This is glue code to hook us up to the optimization we've created in
ANGLE at
https://chromium-review.git.corp.google.com/c/angle/angle/+/8436859

This removes a temporary full screen texture and a full screen render
pass, allowing us to MSAA resolve directly into the swapchain.

fixes: flutter#192496

## screenshot of afterwards capture

Notice the last thing is a resolve.

<img width="1674" height="903" alt="Screenshot 2026-09-25 133558"
src="https://github.com/user-attachments/assets/599449e8-57be-40c2-9cc9-fd1fc1c9217e"
/>

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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 in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

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

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[flutter/website]: https://github.com/flutter/website
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels. platform-windows Building on or for Windows specifically team-windows Owned by the Windows platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

audit swapchain composition on windows

3 participants