Skip to content

Conversation

@walley892
Copy link
Contributor

@walley892 walley892 commented Nov 18, 2025

Rendering to an offscreen texture on platforms without implicit MSAA resolve causes the creation of a framebuffer each frame and a subsequent call to glCheckFramebufferStatus.

This call can cause a full [GPU round trip] (https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#avoid_blocking_api_calls_in_production).

This change creates a function in the proc table that only actually makes the glCheckFramebufferStatus check in debug builds, and changes the calls in render_pass_gles to use this function instead.

An alternate way of doing this would be to directly wrap the callsites with ifdef checks, but this way was more easily testable and seemed cleaner.

Also removes a redundant call to CheckFramebufferStatus.

Fixes #175522

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] I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • [ x] All existing and new tests are passing.

@github-actions github-actions bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Nov 18, 2025
Copy link
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 introduces a performance optimization by avoiding calls to glCheckFramebufferStatus in release builds, as this can cause a GPU round-trip. A new function, CheckFramebufferStatusDebug, is added to ProcTableGLES, which conditionally calls glCheckFramebufferStatus only in debug builds. This new function is now used in RenderPassGLES. The changes also include a new unit test to verify this conditional behavior. Additionally, a latent bug in RenderPassGLES where glCheckFramebufferStatus was called twice has been fixed. My review includes suggestions to improve type safety and consistency by using GLenum instead of int for the new function's signature, and a minor style fix.

@walley892 walley892 force-pushed the wrap-status branch 2 times, most recently from 23ee855 to 5414f90 Compare November 18, 2025 07:18
Copy link
Contributor

@eyebrowsoffire eyebrowsoffire left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for tackling this!

@walley892 walley892 added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 19, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Nov 19, 2025
Merged via the queue into flutter:master with commit 664da1f Nov 19, 2025
181 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 20, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Nov 20, 2025
flutter/flutter@de4be4f...9f383e0

2025-11-20 [email protected] Roll Dart SDK from 331595776540 to 5b21f8a7d5d3 (1 revision) (flutter/flutter#178861)
2025-11-20 [email protected] Roll ICU from f27805b7d7d8 to a86a32e67b8d (1 revision) (flutter/flutter#178859)
2025-11-20 [email protected] Roll Dart SDK from d6f9477a2d9f to 331595776540 (1 revision) (flutter/flutter#178851)
2025-11-20 [email protected] Roll Skia from 5bdda9a41db9 to 6284b4f09e14 (3 revisions) (flutter/flutter#178849)
2025-11-20 [email protected] Roll Skia from 24c28206d912 to 5bdda9a41db9 (2 revisions) (flutter/flutter#178845)
2025-11-20 [email protected] Roll Dart SDK from 7506c64a5117 to d6f9477a2d9f (1 revision) (flutter/flutter#178844)
2025-11-20 [email protected] Roll Skia from fd41f3650729 to 24c28206d912 (2 revisions) (flutter/flutter#178841)
2025-11-20 [email protected] Use WidgetsBinding.instance.platformDispatcher in windowing instead of PlatformDispatcher.instance (flutter/flutter#178799)
2025-11-20 [email protected] [Impeller] Adds support for r32float textures (flutter/flutter#178418)
2025-11-20 [email protected] Roll Skia from a283da7a6b6c to fd41f3650729 (2 revisions) (flutter/flutter#178838)
2025-11-20 [email protected] [Impeller] Deny-list Adreno 640 and 650 for Vulkan eligibility. (flutter/flutter#178833)
2025-11-19 [email protected] Roll Skia from b5dc8c3494ac to a283da7a6b6c (8 revisions) (flutter/flutter#178832)
2025-11-19 [email protected] Roll Dart SDK from f7e9bd245fd9 to 7506c64a5117 (3 revisions) (flutter/flutter#178828)
2025-11-19 [email protected] Allow the `RawAutocomplete` to display the options even when one is selected (flutter/flutter#177705)
2025-11-19 [email protected] [web] Skip flaky service worker test (flutter/flutter#178820)
2025-11-19 [email protected] Only call glCheckFrameBufferStatus in the render pass in debug builds (flutter/flutter#178707)
2025-11-19 [email protected] Manual pub roll (flutter/flutter#178687)
2025-11-19 [email protected] Document that `error` parameter must be initialized (flutter/flutter#177730)
2025-11-19 [email protected] Update `_CircularProgressIndicatorState` to use `transform` directly (flutter/flutter#178569)
2025-11-19 [email protected] Fix layout for macOS frameworks for code assets (flutter/flutter#178625)
2025-11-19 [email protected] Roll Packages from 34746bb to 8f72e4b (7 revisions) (flutter/flutter#178800)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
okorohelijah pushed a commit to okorohelijah/flutter that referenced this pull request Nov 21, 2025
…flutter#178707)

Rendering to an offscreen texture on platforms without implicit MSAA
resolve causes the creation of a framebuffer each frame and a subsequent
call to glCheckFramebufferStatus.

This call can cause a full [GPU round trip]
(https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#avoid_blocking_api_calls_in_production).

This change creates a function in the proc table that only actually
makes the glCheckFramebufferStatus check in debug builds, and changes
the calls in render_pass_gles to use this function instead.

An alternate way of doing this would be to directly wrap the callsites
with `ifdef` checks, but this way was more easily testable and seemed
cleaner.

Also removes a redundant call to CheckFramebufferStatus.

Fixes flutter#175522

## 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] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ x] All existing and new tests are passing.
IvoneDjaja pushed a commit to IvoneDjaja/flutter that referenced this pull request Nov 22, 2025
…flutter#178707)

Rendering to an offscreen texture on platforms without implicit MSAA
resolve causes the creation of a framebuffer each frame and a subsequent
call to glCheckFramebufferStatus.

This call can cause a full [GPU round trip]
(https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#avoid_blocking_api_calls_in_production).

This change creates a function in the proc table that only actually
makes the glCheckFramebufferStatus check in debug builds, and changes
the calls in render_pass_gles to use this function instead.

An alternate way of doing this would be to directly wrap the callsites
with `ifdef` checks, but this way was more easily testable and seemed
cleaner.

Also removes a redundant call to CheckFramebufferStatus.

Fixes flutter#175522

## 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] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ x] All existing and new tests are passing.
mboetger pushed a commit to mboetger/flutter that referenced this pull request Dec 2, 2025
…flutter#178707)

Rendering to an offscreen texture on platforms without implicit MSAA
resolve causes the creation of a framebuffer each frame and a subsequent
call to glCheckFramebufferStatus.

This call can cause a full [GPU round trip]
(https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#avoid_blocking_api_calls_in_production).

This change creates a function in the proc table that only actually
makes the glCheckFramebufferStatus check in debug builds, and changes
the calls in render_pass_gles to use this function instead.

An alternate way of doing this would be to directly wrap the callsites
with `ifdef` checks, but this way was more easily testable and seemed
cleaner.

Also removes a redundant call to CheckFramebufferStatus.

Fixes flutter#175522

## 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] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ x] All existing and new tests are passing.
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…flutter#178707)

Rendering to an offscreen texture on platforms without implicit MSAA
resolve causes the creation of a framebuffer each frame and a subsequent
call to glCheckFramebufferStatus.

This call can cause a full [GPU round trip]
(https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#avoid_blocking_api_calls_in_production).

This change creates a function in the proc table that only actually
makes the glCheckFramebufferStatus check in debug builds, and changes
the calls in render_pass_gles to use this function instead.

An alternate way of doing this would be to directly wrap the callsites
with `ifdef` checks, but this way was more easily testable and seemed
cleaner.

Also removes a redundant call to CheckFramebufferStatus.

Fixes flutter#175522

## 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] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ x] All existing and new tests are passing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

[impeller] OpenGL ES backend calls glCheckFramebufferStatus multiple times per frame

2 participants