This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] force software resize usage for GLES backend. #56511
Merged
Merged
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9187475
force gles to use software resize.
9874f49
invert condition.
1ccba5c
Merge branch 'main' of github.com:flutter/engine into use_software_re…
abde368
Fix unittests.
aec6be9
update unittests.
d11c8de
check caps.
acf8b3f
++
e27de09
fix caps.
83280c8
update doc comment.
4b2f2f5
++
cbd7afa
Merge branch 'main' into use_software_resize
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
||
| ASSERT_TRUE(decompressed.has_value()); | ||
| ASSERT_EQ(decompressed->image_info.colorType(), kRGBA_8888_SkColorType); | ||
| ASSERT_EQ(decompressed->image_info.colorSpace(), nullptr); | ||
|
|
@@ -473,7 +474,8 @@ TEST_F(ImageDecoderFixtureTest, ImpellerPixelConversion32F) { | |
| 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); | ||
|
|
||
| ASSERT_TRUE(decompressed.has_value()); | ||
| ASSERT_EQ(decompressed->image_info.colorType(), kRGBA_F16_SkColorType); | ||
|
|
@@ -501,7 +503,7 @@ TEST_F(ImageDecoderFixtureTest, ImpellerWideGamutDisplayP3Opaque) { | |
| std::optional<DecompressResult> wide_result = | ||
| ImageDecoderImpeller::DecompressTexture( | ||
| descriptor.get(), SkISize::Make(100, 100), {100, 100}, | ||
| /*supports_wide_gamut=*/true, allocator); | ||
| /*supports_wide_gamut=*/true, /*force_cpu_resize=*/false, allocator); | ||
|
|
||
| ASSERT_TRUE(wide_result.has_value()); | ||
| ASSERT_EQ(wide_result->image_info.colorType(), kBGR_101010x_XR_SkColorType); | ||
|
|
@@ -526,7 +528,7 @@ TEST_F(ImageDecoderFixtureTest, ImpellerWideGamutDisplayP3Opaque) { | |
| std::optional<DecompressResult> narrow_result = | ||
| ImageDecoderImpeller::DecompressTexture( | ||
| descriptor.get(), SkISize::Make(100, 100), {100, 100}, | ||
| /*supports_wide_gamut=*/false, allocator); | ||
| /*supports_wide_gamut=*/false, /*force_cpu_resize=*/false, allocator); | ||
|
|
||
| ASSERT_TRUE(narrow_result.has_value()); | ||
| ASSERT_EQ(narrow_result->image_info.colorType(), kRGBA_8888_SkColorType); | ||
|
|
@@ -553,7 +555,7 @@ TEST_F(ImageDecoderFixtureTest, ImpellerNonWideGamut) { | |
| std::optional<DecompressResult> result = | ||
| ImageDecoderImpeller::DecompressTexture( | ||
| descriptor.get(), SkISize::Make(600, 200), {600, 200}, | ||
| /*supports_wide_gamut=*/true, allocator); | ||
| /*supports_wide_gamut=*/true, /*force_cpu_resize=*/false, allocator); | ||
|
|
||
| ASSERT_TRUE(result.has_value()); | ||
| ASSERT_EQ(result->image_info.colorType(), kRGBA_8888_SkColorType); | ||
|
|
@@ -808,25 +810,32 @@ TEST(ImageDecoderTest, VerifySimpleDecoding) { | |
| std::make_shared<impeller::TestImpellerAllocator>(); | ||
| auto result_1 = ImageDecoderImpeller::DecompressTexture( | ||
| descriptor.get(), SkISize::Make(6, 2), {1000, 1000}, | ||
| /*supports_wide_gamut=*/false, allocator); | ||
| /*supports_wide_gamut=*/false, /*force_cpu_resize=*/false, allocator); | ||
| EXPECT_EQ(result_1.sk_bitmap->width(), 75); | ||
| EXPECT_EQ(result_1.sk_bitmap->height(), 25); | ||
|
|
||
| // Bitmap sizes reflect the scaled size if the source size is larger than | ||
| // max texture size even if destination size isn't max texture size. | ||
| auto result_2 = ImageDecoderImpeller::DecompressTexture( | ||
| descriptor.get(), SkISize::Make(6, 2), {10, 10}, | ||
| /*supports_wide_gamut=*/false, allocator); | ||
| /*supports_wide_gamut=*/false, /*force_cpu_resize=*/false, allocator); | ||
| EXPECT_EQ(result_2.sk_bitmap->width(), 6); | ||
| EXPECT_EQ(result_2.sk_bitmap->height(), 2); | ||
|
|
||
| // If the destination size is larger than the max texture size the image | ||
| // is scaled down. | ||
| auto result_3 = ImageDecoderImpeller::DecompressTexture( | ||
| descriptor.get(), SkISize::Make(60, 20), {10, 10}, | ||
| /*supports_wide_gamut=*/false, allocator); | ||
| /*supports_wide_gamut=*/false, /*force_cpu_resize=*/false, allocator); | ||
| EXPECT_EQ(result_3.sk_bitmap->width(), 10); | ||
| EXPECT_EQ(result_3.sk_bitmap->height(), 10); | ||
|
|
||
| // CPU resize is forced. | ||
| auto result_4 = ImageDecoderImpeller::DecompressTexture( | ||
| descriptor.get(), SkISize::Make(6, 2), {1000, 1000}, | ||
| /*supports_wide_gamut=*/false, /*force_cpu_resize=*/true, allocator); | ||
| EXPECT_EQ(result_4.sk_bitmap->width(), 6); | ||
| EXPECT_EQ(result_4.sk_bitmap->height(), 2); | ||
| #endif // IMPELLER_SUPPORTS_RENDERING | ||
| } | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Can we make this more apropos? Can it just check if the backend is opengles?
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.
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
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.
SupportsTextureToTextureBlits()appears to be true only for the Metal backend. We wouldn't want this for Vulkan, no?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.
https://github.com/flutter/engine/blob/main/impeller/renderer/backend/vulkan/capabilities_vk.cc#L623-L625
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.
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.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.
Right, I mean why wasn't CapabilitiesGLES like this:
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 inCapabilitiesGLES::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.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.
Because blit framebuffer is still misconfigured for the reisze path. Once that is fixed we can update the capabilities gles to do that.
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.
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.
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.
Done
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.
flutter/flutter#158523