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 7 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
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
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); | ||
|
@@ -802,31 +804,46 @@ TEST(ImageDecoderTest, VerifySimpleDecoding) { | |
EXPECT_EQ(compressed_image->alphaType(), kOpaque_SkAlphaType); | ||
|
||
#if IMPELLER_SUPPORTS_RENDERING | ||
std::shared_ptr<impeller::Capabilities> capabilities = | ||
impeller::CapabilitiesBuilder() | ||
.SetSupportsTextureToTextureBlits(true) | ||
.Build(); | ||
std::shared_ptr<impeller::Capabilities> capabilities_no_blit = | ||
impeller::CapabilitiesBuilder() | ||
.SetSupportsTextureToTextureBlits(false) | ||
.Build(); | ||
// Bitmap sizes reflect the original image size as resizing is done on the | ||
// GPU if the src size is smaller than the max texture size. | ||
std::shared_ptr<impeller::Allocator> allocator = | ||
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, capabilities, 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, capabilities, 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, capabilities, 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, capabilities_no_blit, 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.
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.
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.
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).
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.
Filled flutter/flutter#158523