Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] force software resize usage for GLES backend. #56511

Merged
merged 11 commits into from
Nov 14, 2024

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Nov 11, 2024

Should fix some of the wonderous bugs by avoiding the usage of gl blitframebuffer altogether.

Fixes flutter/flutter#158391

@flutter-dashboard

This comment was marked as off-topic.

Copy link
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.

FYI this sidesteps all the texture issues I'm seeing on the Pixel4a. The textures aren't upside down or missing.

The code looks good, I'd like a more apropos condition for the fallback and I'd like a golden image test that goes down this path. If the condition is just checking for opengles we'll get the golden image easily. If it's capabilities based we should mock out the capabilities to force this flow.

supports_wide_gamut, context->GetResourceAllocator());
/*supports_wide_gamut=*/supports_wide_gamut,
/*force_cpu_resize=*/
!context->GetCapabilities()->SupportsTextureToTextureBlits(),
Copy link
Member

@gaaclarke gaaclarke Nov 12, 2024

Choose a reason for hiding this comment

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

Can we make this more apropos? Can it just check if the backend is opengles?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is the right check. if we fix the texture blit issues then this lets us conditionally enable it for devices that support blit framebuffer

Copy link
Member

Choose a reason for hiding this comment

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

SupportsTextureToTextureBlits() appears to be true only for the Metal backend. We wouldn't want this for Vulkan, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Okay, so this check is essentially a check for opengles. Why is this a different check than gl.BlitFramebuffer.IsAvailable()? Seems like they should be the same.

Copy link
Member

Choose a reason for hiding this comment

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

Right, I mean why wasn't CapabilitiesGLES like this:

bool CapabilitiesGLES::SupportsTextureToTextureBlits() const {
  return gl.BlitFramebuffer.IsAvailable();
}

Or a version check for version 3? I think this code looks good considering everything, and since the Capabilities is just hardcoded to false we should be getting test coverage (assuming there is a golden test for this). But if the reason CapabilitiesGLES::SupportsTextureToTextureBlits() is false is because of these weird issues we should explain it in a comment in CapabilitiesGLES::SupportsTextureToTextureBlits(). I'm happy to write it, I'm just trying to understand why it was hardcoded to false before we identified these issues to make sure I understand everything.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, I mean why wasn't CapabilitiesGLES like this:

Because blit framebuffer is still misconfigured for the reisze path. Once that is fixed we can update the capabilities gles to do that.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, sounds good. Can we add a TODO to capabilities_gles.cc then? We can mark this PR as fixing the thing I've been looking into (and the upside-down textures I think). The TODO can point to an issue that is a performance improvement, not a bug.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Member Author

Choose a reason for hiding this comment

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

@jonahwilliams
Copy link
Member Author

It looks like we'd need to set up the entire engine to actually create an ImageDecodeImpeller instance, hence why all the existing unit tests just call one of the static methods. I'd prefer to have an integration test for this, which would require us to run a devicelab test.

@jonahwilliams
Copy link
Member Author

I can cheat a bit and pass the capabilities into one of the static methods and have it do the determination though.

@gaaclarke
Copy link
Member

It looks like we'd need to set up the entire engine to actually create an ImageDecodeImpeller instance, hence why all the existing unit tests just call one of the static methods. I'd prefer to have an integration test for this, which would require us to run a devicelab test.

There are decoder unit tests in ui_unittests, checkout image_decoder_unittests.cc. I had to add some there when I started decoding wide gamut images.

@jonahwilliams
Copy link
Member Author

I did update those tests, the use the static methods of image decode impeller to avoid setting up the full engine. Anyway, I think the test I added which checks the capabilities is sufficient.

@@ -446,7 +446,8 @@ TEST_F(ImageDecoderFixtureTest, ImpellerNullColorspace) {
std::optional<DecompressResult> decompressed =
ImageDecoderImpeller::DecompressTexture(
descriptor.get(), SkISize::Make(100, 100), {100, 100},
/*supports_wide_gamut=*/true, allocator);
/*supports_wide_gamut=*/true,
/*force_cpu_resize=*/false, allocator);
Copy link
Member

Choose a reason for hiding this comment

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

Heads up, these weren't migrated to the new signature that takes in Capabilties.

Copy link
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.

lgtm, modulo an addition to the TODO just to make sure someone doesn't look on a phone that doesn't have issues and turns it on by mistake.

Comment on lines 161 to 162
// TODO(158388): switch this to true for improved performance
// on GLES 3.0+ devices.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// TODO(158388): switch this to true for improved performance
// on GLES 3.0+ devices.
// TODO(158388): Switch this to true for improved performance
// on GLES 3.0+ devices. Note that this wasn't enabled because
// there were some rendering issues on some devices.

Copy link
Member

@gaaclarke gaaclarke Nov 12, 2024

Choose a reason for hiding this comment

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

Also, I think this should point to a new issue. Then we can close out the 2 related to the weird blit behavior (since it won't show up anymore after this).

Copy link
Member Author

Choose a reason for hiding this comment

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

@gaaclarke
Copy link
Member

gaaclarke commented Nov 12, 2024

I'm still seeing instances where images aren't loading. I'm not sure if this is the same issue just diminished or if it is a different issue.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 13, 2024
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 13, 2024
Copy link
Contributor

auto-submit bot commented Nov 13, 2024

auto label is removed for flutter/engine/56511, due to - The status or check suite Mac mac_clang_tidy has failed. Please fix the issues identified (or deflake) before re-applying this label.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 13, 2024
@auto-submit auto-submit bot merged commit 96a932d into flutter:main Nov 14, 2024
37 checks passed
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 14, 2024
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Nov 16, 2024
…159015)

Roll Flutter Engine from 619804c0fbb7 to f649330affa8 (47 revisions)

flutter/engine@619804c...f649330

2024-11-16 [email protected] Roll Skia from 1ef3b910e064 to
6b0f264bde33 (6 revisions) (flutter/engine#56635)
2024-11-16 [email protected] Revert "Remove
`android_jit_release_x86`." (flutter/engine#56634)
2024-11-15 [email protected] Move SetRenderTargetType to
EmbedderTestCompositor (flutter/engine#56626)
2024-11-15 [email protected] Roll Dart SDK from
b62dadb14d82 to eccb15756020 (2 revisions) (flutter/engine#56630)
2024-11-15 [email protected] [TextInput] Add
TextInputType.webSearch (#15762) (flutter/engine#56428)
2024-11-15 [email protected] [web] Send the correct view ID with
semantics actions (flutter/engine#56595)
2024-11-15 [email protected] [macos] early
return to suppress clang-tidy warning (flutter/engine#56588)
2024-11-15 [email protected] [Impeller] libImpeller: Tinker on the
README to cross reference the SDK and the example.
(flutter/engine#56623)
2024-11-15 [email protected] [fuchsia] MaybeRunInitialVsyncCallback
should only called once (flutter/engine#56429)
2024-11-15 [email protected] Move mac clangd build from x64 to arm
(flutter/engine#56567)
2024-11-15 [email protected] Added assert for
opengles thread safety (flutter/engine#56585)
2024-11-15 [email protected] [Impeller] enable OpenGL fallback on
Android. (flutter/engine#56591)
2024-11-15 [email protected] [Impeller] Maintain
separate queues of GLES operations for each thread in the reactor
(flutter/engine#56573)
2024-11-15 [email protected] Roll Dart SDK from
abe86ca4eb01 to b62dadb14d82 (2 revisions) (flutter/engine#56615)
2024-11-15 [email protected] Roll Skia from b730eb340852 to
1ef3b910e064 (4 revisions) (flutter/engine#56613)
2024-11-15 [email protected] Roll Fuchsia Linux SDK from
JkpuAsLzcmYLzf1iX... to UpSQzyXGUhMfedYIh... (flutter/engine#56611)
2024-11-15 [email protected] Roll Dart SDK from
bf0eeb9d929c to abe86ca4eb01 (1 revision) (flutter/engine#56610)
2024-11-15 [email protected] Roll Skia from e5fda8472b21 to
b730eb340852 (1 revision) (flutter/engine#56608)
2024-11-15 [email protected] Roll Skia from 8ff65da4b8bf to
e5fda8472b21 (1 revision) (flutter/engine#56603)
2024-11-15 [email protected] Move TestMetalContext/Surface to testing
namespace (flutter/engine#56602)
2024-11-15 [email protected] Roll Dart SDK from
343b9fc6eafe to bf0eeb9d929c (1 revision) (flutter/engine#56604)
2024-11-15 [email protected] [Impeller] Don't enable KHR_debug on
Angle. (flutter/engine#56601)
2024-11-15 [email protected] [Impeller] libImpeller: Reset the GL
state when transitioning control back to the embedder.
(flutter/engine#56597)
2024-11-15 [email protected] Roll Skia from 8946ea477b42 to
8ff65da4b8bf (2 revisions) (flutter/engine#56600)
2024-11-14 [email protected] [Impeller] Put test components in the
testing namespace. (flutter/engine#56594)
2024-11-14 [email protected] [Impeller] libImpeller: Add a warning
about OpenGL state being trampled. (flutter/engine#56599)
2024-11-14 [email protected] Embedder: Refactor EmbedderConfigBuilder by
backend (flutter/engine#56598)
2024-11-14 [email protected] Migrate Metal translation units to Obj-C++
(flutter/engine#56592)
2024-11-14 [email protected] Roll Dart SDK from
db4d7d52db48 to 343b9fc6eafe (1 revision) (flutter/engine#56590)
2024-11-14 [email protected] iOS,macOS: Build/test
test_metal_surface_unittests (flutter/engine#56586)
2024-11-14 [email protected] Roll Skia from 3222456e63dc to
8946ea477b42 (2 revisions) (flutter/engine#56587)
2024-11-14 [email protected] Roll Skia from 16178bf63de7 to
3222456e63dc (3 revisions) (flutter/engine#56584)
2024-11-14 [email protected] [Android] Fix Slider semantics double
tap behaviors (flutter/engine#56452)
2024-11-14 [email protected] Roll Dart SDK from
a3b6652100c8 to db4d7d52db48 (1 revision) (flutter/engine#56581)
2024-11-14 [email protected] Move Vulkan context to
EmbedderTestContextVulkan (flutter/engine#56571)
2024-11-14 [email protected] Roll Skia from a076435073fc to
16178bf63de7 (1 revision) (flutter/engine#56579)
2024-11-14 [email protected] Roll Skia from 70553189e4e8 to
a076435073fc (1 revision) (flutter/engine#56577)
2024-11-14 [email protected] Roll Skia from fa52f2c1ddba to
70553189e4e8 (1 revision) (flutter/engine#56576)
2024-11-14 [email protected] Roll Dart SDK from
3f05b3540cb2 to a3b6652100c8 (3 revisions) (flutter/engine#56575)
2024-11-14 [email protected] Roll Skia from ddbd8d1cb8d8 to
fa52f2c1ddba (3 revisions) (flutter/engine#56574)
2024-11-14 [email protected] [Android] choose 24 bit depth
buffer. (flutter/engine#56553)
2024-11-14 [email protected] Roll Skia from 3750b8939c7f to
ddbd8d1cb8d8 (1 revision) (flutter/engine#56562)
2024-11-14 [email protected] Move FlMouseCursorHandler from
FlView to FlEngine (flutter/engine#56026)
2024-11-14 [email protected] [Impeller] force software resize
usage for GLES backend. (flutter/engine#56511)
2024-11-14 [email protected] Roll Dart SDK from
66ab1774bfe9 to 3f05b3540cb2 (2 revisions) (flutter/engine#56564)
2024-11-14 [email protected] Embedder: Refactor EmbedderTestContext
creation (flutter/engine#56563)
...
nick9822 pushed a commit to nick9822/flutter that referenced this pull request Dec 18, 2024
…ine#56511)

Should fix some of the wonderous bugs by avoiding the usage of gl blitframebuffer altogether.

Fixes flutter#158391
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[impeller:opengles] wonderous sometimes has upside down images
2 participants