Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] Fix GL depth state. #51040

Merged
merged 5 commits into from
Feb 28, 2024
Merged

Conversation

bdero
Copy link
Member

@bdero bdero commented Feb 28, 2024

Resolves flutter/flutter#136322.

This patch fixes problems with GL depth (in service of #50856):

  • The depth + stencil masks weren't being set prior to clearing.
  • When the driver identifies as desktop GL rather than ES, use glClearDepth and glDepthRange rather than glClearDepthf and glDepthRangef.

@bdero bdero changed the title [Impeller] Fix GLES depth state. [Impeller] Fix GL depth state. Feb 28, 2024
// https://github.com/flutter/flutter/issues/136322
#if !FML_OS_MACOSX
gl.ClearDepthf(pass_data.clear_depth);
#endif
Copy link
Member Author

@bdero bdero Feb 28, 2024

Choose a reason for hiding this comment

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

This was one of the issues for OpenGLES playground runs on MacOS. OpenGL defaults the depth clear value to 1. But my new depth clipping scheme relies on clearing to 0.

And so not being able to modify the depth clear value meant nothing could draw in subpasses that had a depth attachment.

@@ -242,6 +241,9 @@ struct RenderPassData {
gl.Disable(GL_CULL_FACE);
gl.Disable(GL_BLEND);
gl.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
gl.DepthMask(GL_TRUE);
gl.StencilMaskSeparate(GL_FRONT, 0xFFFFFFFF);
gl.StencilMaskSeparate(GL_BACK, 0xFFFFFFFF);
Copy link
Member Author

Choose a reason for hiding this comment

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

When depth buffer clipping + StC is enabled, the depth mask toggles very frequently, so we need to make sure it's on before clearing.

We've yet to utilize the stencil mask in the 2D renderer, which is why we haven't noticed this problem up until now.

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@bdero bdero merged commit 6de390b into flutter:main Feb 28, 2024
23 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 28, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 28, 2024
…144338)

flutter/engine@91898e3...c9381fb

2024-02-28 [email protected] Revert "Bump everything to Android 21" (flutter/engine#51056)
2024-02-28 [email protected] Roll Skia from 0c294ee206e8 to 93f245da0097 (2 revisions) (flutter/engine#51055)
2024-02-28 [email protected] [Android] update fallback and rendering state to combine impeller + android backend. (flutter/engine#51008)
2024-02-28 [email protected] [Impeller] Fix GL depth state. (flutter/engine#51040)
2024-02-28 [email protected] Roll buildroot to 7b537de78ac2239982ace130d1845374e5dcf113 (flutter/engine#51053)
2024-02-28 [email protected] Roll Skia from d935943bedcd to 0c294ee206e8 (3 revisions) (flutter/engine#51051)
2024-02-28 [email protected] When run_tests.py is in --quiet mode, write verbose logs to a file (flutter/engine#51029)
2024-02-28 [email protected] Roll Skia from fe34002ee826 to d935943bedcd (1 revision) (flutter/engine#51049)
2024-02-28 [email protected] Bump everything to Android 21 (flutter/engine#51032)
2024-02-28 [email protected] Add flutter prefix to import (flutter/engine#51042)
2024-02-28 [email protected] Roll Skia from d591703635b0 to fe34002ee826 (1 revision) (flutter/engine#51048)

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 [email protected],[email protected],[email protected] 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Impeller] OpenGL: Use glClearDepth and glDepthRange on desktop GL.
2 participants