Repository navigation
Starts flipping content on windows to avoid full screen renders - #193133
Conversation
87311a0 to
538a303
Compare
| attributes.push_back(EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE); | ||
| attributes.push_back(EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| FML_LOG(WARNING) << "EGL_ANGLE_surface_orientation is unavailable. " | ||
| "Falling back to a bottom-left surface origin."; |
There was a problem hiding this comment.
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)).
| 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.\"; |
| std::shared_ptr<RenderPass> CreateWrappedFBORenderPass( | ||
| const std::shared_ptr<ContextGLES>& context, | ||
| const std::shared_ptr<ReactorGLES>& reactor, | ||
| const std::shared_ptr<CommandBuffer>& command_buffer) { |
There was a problem hiding this comment.
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) {| std::shared_ptr<RenderPass> render_pass = | ||
| CreateWrappedFBORenderPass(ctx.context, reactor, ctx.command_buffer); |
| std::shared_ptr<RenderPass> render_pass = | ||
| CreateWrappedFBORenderPass(ctx.context, reactor, ctx.command_buffer); |
b-luk
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
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. |
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.
…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
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.
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-assistbot 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.