-
Notifications
You must be signed in to change notification settings - Fork 6k
[Windows] Improve texture format logic #54329
[Windows] Improve texture format logic #54329
Conversation
auto surface = SkSurfaces::WrapBackendTexture( | ||
context, // context | ||
backend_texture, // back-end texture | ||
kBottomLeft_GrSurfaceOrigin, // surface origin | ||
1, // sample count | ||
kN32_SkColorType, // color type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kN32_SkColorType
is either BGRA8
or RGBA8
depending on the machine that builds the engine. This caused Skia to reject RGBA8 textures if the engine was built on a machine where BGRA8 is the native color format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow - nice catch.
gl_->BindTexture(GL_TEXTURE_2D, 0); | ||
|
||
gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0_EXT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GL_COLOR_ATTACHMENT0
is the same value as GL_COLOR_ATTACHMENT0_EXT
but available in OpenGL ES 2.0.
b8df3c8
to
1b0afaa
Compare
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Since testing this is so tenuous, have you verified the fallback works locally? Just by assuming the extension is unavailable? |
Yup that's right, I edited the code to act as if my machine doesn't have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test-exempt: requires hardware that's not available in CI |
This looks good to go but we don't have a confirmation from a customer that this patch works on their devices. There does seem to be a conflict though so it would be good to resolve that so we can land this as soon as we hear back. |
But we've already tested example app in the issue flutter/flutter#150546 |
1b0afaa
to
5e60ca5
Compare
@chinmaygarde Updated! FYI, I didn't remove the @Kirill-21 There's a very large customer that can reproduce this issue. We'd like them to test this change to verify this doesn't have unexpected regressions. I recognize this delay is frustrating, we're trying to land this as fast as possible! |
Unfortunately, our partner hasn't verified this patch after 10 days. Several community members confirmed this fixed what appears to be the same issue. I will assume this fixes our partner's issue as well. |
…153313) flutter/engine@bcf2dcc...5d8ee52 2024-08-12 matej.knopp@gmail.com macOS: Fix crash in attributedSubstringForProposedRange with out of bounds range (flutter/engine#54469) 2024-08-12 737941+loic-sharma@users.noreply.github.com [Windows] Improve texture format logic (flutter/engine#54329) 2024-08-12 bdero@google.com Revert "[Impeller] remove scene3d support." (flutter/engine#54502) 2024-08-12 skia-flutter-autoroll@skia.org Roll Skia from f77adcef7c1c to ec7558d41b34 (1 revision) (flutter/engine#54507) 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 jsimmons@google.com,rmistry@google.com,zra@google.com 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
Failed to create CP due to merge conflicts. |
This improves Flutter Window's texture format logic: 1. **If the device has extension `GL_EXT_texture_format_BGRA8888`**: backing stores' texture will be created with format `GL_BGRA_EXT` instead of `GL_RGBA8`. This is what fixes flutter/flutter#150546. 2. **Otherwise**: backing stores' texture will be created with format `GL_RGBA` and the engine will use the color type `kRGBA_8888_SkColorType` when creating the `SkSurface`. Previously the engine always used color type `kN32_SkColorType`, which could be either RGBA or BGRA depending on the machine that compiled the engine. This caused Skia validation errors as the texture's format did not match the Skia surface's color type. I tested this by editing Flutter Windows to force it down this code path. Huge kudos to @chinmaygarde for the OpenGL expertise! Fixes: flutter/flutter#150546 > [!WARNING] > Unfortunately, we are unable to test this. > This bug appears to only affect older devices; none of our devices reproduce this issue. > We also do not have the infrastructure to do a native screenshot test on Windows. > I will get a test exemption for this change. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
…lutter#153313) flutter/engine@bcf2dcc...5d8ee52 2024-08-12 matej.knopp@gmail.com macOS: Fix crash in attributedSubstringForProposedRange with out of bounds range (flutter/engine#54469) 2024-08-12 737941+loic-sharma@users.noreply.github.com [Windows] Improve texture format logic (flutter/engine#54329) 2024-08-12 bdero@google.com Revert "[Impeller] remove scene3d support." (flutter/engine#54502) 2024-08-12 skia-flutter-autoroll@skia.org Roll Skia from f77adcef7c1c to ec7558d41b34 (1 revision) (flutter/engine#54507) 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 jsimmons@google.com,rmistry@google.com,zra@google.com 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
May I ask if there are any new developments. |
…lutter#153313) flutter/engine@bcf2dcc...5d8ee52 2024-08-12 matej.knopp@gmail.com macOS: Fix crash in attributedSubstringForProposedRange with out of bounds range (flutter/engine#54469) 2024-08-12 737941+loic-sharma@users.noreply.github.com [Windows] Improve texture format logic (flutter/engine#54329) 2024-08-12 bdero@google.com Revert "[Impeller] remove scene3d support." (flutter/engine#54502) 2024-08-12 skia-flutter-autoroll@skia.org Roll Skia from f77adcef7c1c to ec7558d41b34 (1 revision) (flutter/engine#54507) 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 jsimmons@google.com,rmistry@google.com,zra@google.com 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
This improves Flutter Window's texture format logic:
If the device has extension
GL_EXT_texture_format_BGRA8888
: backing stores' texture will be created with formatGL_BGRA_EXT
instead ofGL_RGBA8
. This is what fixes [Windows] Flutter does not render any GUI and shows black window instead flutter#150546.Otherwise: backing stores' texture will be created with format
GL_RGBA
and the engine will use the color typekRGBA_8888_SkColorType
when creating theSkSurface
.Previously the engine always used color type
kN32_SkColorType
, which could be either RGBA or BGRA depending on the machine that compiled the engine. This caused Skia validation errors as the texture's format did not match the Skia surface's color type.I tested this by editing Flutter Windows to force it down this code path.
Huge kudos to @chinmaygarde for the OpenGL expertise!
Fixes: flutter/flutter#150546
Warning
Unfortunately, we are unable to test this.
This bug appears to only affect older devices; none of our devices reproduce this issue.
We also do not have the infrastructure to do a native screenshot test on Windows.
I will get a test exemption for this change.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.