Skip to content

[wimp] MSAA support#183807

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
eyebrowsoffire:wimp_msaa
Mar 19, 2026
Merged

[wimp] MSAA support#183807
auto-submit[bot] merged 3 commits into
flutter:masterfrom
eyebrowsoffire:wimp_msaa

Conversation

@eyebrowsoffire
Copy link
Copy Markdown
Contributor

  • Use MSAA for default framebuffer by using the antialias flag when creating our WebGL context
  • Cache and reuse the MSAA resolve attachment for intermediate targets.
  • Use glInvalidateFramebuffer when it's available. We use the glDiscardFramebufferEXT when it's available, but that isn't available on WebGL, so we want to use glInvalidateFramebuffer in that case.

* Use MSAA for default framebuffer by using the antialias flag when creating our WebGL context
* Cache and reuse the MSAA resolve attachment for intermediate targets.
* Use `glInvalidateFramebuffer` when it's available. We use the `glDiscardFramebufferEXT` when
  it's available, but that isn't available on WebGL, so we want to use `glInvalidateFramebuffer`
  in that case.
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Mar 17, 2026
Copy link
Copy Markdown
Contributor

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

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 enhances Impeller's GLES backend by introducing support for glInvalidateFramebuffer, prioritizing it over glDiscardFramebufferEXT for more efficient framebuffer invalidation. It also optimizes multisample resolve operations by caching and reusing Framebuffer Objects (FBOs) to reduce overhead. Additionally, the changes enable dynamic control over antialiasing for GL contexts in Skwasm based on the skwasm_isWimp() flag. A minor improvement opportunity exists in mock_gles.cc where the logic for building g_extensions_string is duplicated across MockGLES::Init overloads, suggesting extraction into a helper function for better maintainability.

Comment on lines +342 to +347
g_extensions_string.clear();
for (const auto& ext : g_extensions) {
if (!g_extensions_string.empty())
g_extensions_string += " ";
g_extensions_string += ext;
}
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 logic to build g_extensions_string is duplicated across the two MockGLES::Init overloads (here and in the overload starting at line 355). To improve maintainability, you could extract this logic into a static helper function and call it from both Init methods.

@eyebrowsoffire eyebrowsoffire added the CICD Run CI/CD label Mar 17, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Mar 18, 2026
@eyebrowsoffire eyebrowsoffire added the CICD Run CI/CD label Mar 18, 2026
Copy link
Copy Markdown
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

Looks good to me! I just have one request to remove debug information from release builds since I worry about it incurring an extra cpu/gpu sync.

static std::vector<const char*> g_extensions;

static const char* g_version;
static std::string g_extensions_string;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no action required: technically static functions that are not trivially destructible are forbidden. (https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables)

Since this is test code and it already does it elsewhere this is fine. This is just an fyi.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, okay. Good to know.

return false;
}

auto status = gl.CheckFramebufferStatusDebug(GL_FRAMEBUFFER);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We probably don't want to call this in release builds, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It actually is a no-op in release builds thanks to Evan's work a while ago. See the definition here: https://github.com/flutter/flutter/blob/master/engine/src/flutter/impeller/renderer/backend/gles/proc_table_gles.cc#L451

@github-actions github-actions Bot removed the CICD Run CI/CD label Mar 18, 2026
@eyebrowsoffire eyebrowsoffire added the CICD Run CI/CD label Mar 18, 2026
@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 19, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Mar 19, 2026
Merged via the queue into flutter:master with commit ca573c0 Mar 19, 2026
190 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 20, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 21, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 21, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 21, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 22, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 22, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 23, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 23, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 23, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 23, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 24, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 24, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 24, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 24, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 24, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 24, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 25, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 25, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 25, 2026
mboetger pushed a commit to mboetger/flutter that referenced this pull request Mar 26, 2026
* Use MSAA for default framebuffer by using the antialias flag when
creating our WebGL context
* Cache and reuse the MSAA resolve attachment for intermediate targets.
* Use `glInvalidateFramebuffer` when it's available. We use the
`glDiscardFramebufferEXT` when it's available, but that isn't available
on WebGL, so we want to use `glInvalidateFramebuffer` in that case.
ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Apr 14, 2026
* Use MSAA for default framebuffer by using the antialias flag when
creating our WebGL context
* Cache and reuse the MSAA resolve attachment for intermediate targets.
* Use `glInvalidateFramebuffer` when it's available. We use the
`glDiscardFramebufferEXT` when it's available, but that isn't available
on WebGL, so we want to use `glInvalidateFramebuffer` in that case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants