Impeller: Allows R32G32B32A32_SFLOAT images#177959
Impeller: Allows R32G32B32A32_SFLOAT images#177959auto-submit[bot] merged 36 commits intoflutter:masterfrom
Conversation
78430bf to
2a8b146
Compare
ccfe85c to
b6ed3d7
Compare
chinmaygarde
left a comment
There was a problem hiding this comment.
The major thing I didn't quite get was how incoming pixel format could be "optimal".
| kR32G32B32A32Float, | ||
| }; | ||
|
|
||
| struct Options { |
There was a problem hiding this comment.
Nit: Perhaps rename this to DecodeOptions?
| const std::shared_ptr<SkBitmap>& bitmap, | ||
| std::shared_ptr<ImpellerAllocator> bitmap_allocator, | ||
| const std::shared_ptr<impeller::Allocator>& allocator) { | ||
| if (bitmap->alphaType() != SkAlphaType::kUnpremul_SkAlphaType) { |
There was a problem hiding this comment.
Add a trace event here?
| impeller::PixelFormat format = impeller::PixelFormat::kUnknown; | ||
| }; | ||
|
|
||
| struct DecompressResult { |
There was a problem hiding this comment.
Ditto on StatusOr instead instead of an error field.
| struct DecompressResult { | ||
| std::shared_ptr<impeller::DeviceBuffer> device_buffer; | ||
| ImageInfo image_info; | ||
| std::optional<SkImageInfo> resize_info = std::nullopt; |
There was a problem hiding this comment.
Optionals are auto initialized to std::nullopt.
|
|
||
| using ImageResult = std::function<void(sk_sp<DlImage>, std::string)>; | ||
|
|
||
| enum PixelFormat { |
There was a problem hiding this comment.
Can this be called TargetPixelFormat or DecodedPixelFormat? Also, what is kUnknown? Is it the same as kOptimal or kDontCare? Perhaps add some docstrings?
There was a problem hiding this comment.
Instead of kOptimal, I like kDontCare instead. With optimal, you have to explain how its optimal. With kDontCare, you are leaving it up to the implementation. Which is whats happening here.
| std::shared_ptr<impeller::DeviceBuffer> buffer = | ||
| scaled_allocator->GetDeviceBuffer(); | ||
| if (!buffer) { | ||
| return {.decode_error = "Unable to get device buffer"}; |
|
|
||
| /// This is an unspecified pixel format that leaves it to Flutter's discretion | ||
| /// to choose the optimal pixel format. | ||
| optimal, |
There was a problem hiding this comment.
How about kDontCare.
Whatever name you choose, perhaps also specify when someone might want to use this. Something like "Use this when the image is going to be sampled the application doesn't care about the exact format."
There was a problem hiding this comment.
Wait, this can't be right. This struct is given to decodeImageFromPixels. This isn't the target pixel format, its the incoming pixel format. How can Flutter divine this format?
There was a problem hiding this comment.
Don't Care sounds a bit judgmental, like you've given up on your expectations from a pesky implementation.
kImplementationDependent?
kAny?
kBestForConditions?
kUnspecified?
Or how about just leaving it null to mean "do what you want"? You only set this when you care.
It couldn't be, that would result in a runtime error. The PixelFormat type has 2 uses, it defines the input format for decoding pixels and it defines the target pixel format for the texture. Not all values are valid for for each of those inputs. Alternatively we could have made a different enum "TargetPixelFormat"? |
Ooh. I really like that idea. Instead of conflating the two ideas. |
chinmaygarde
left a comment
There was a problem hiding this comment.
The new updates LGTM. I had a concern about device capability checks that I think we can document our way out of.
| case kBGR_101010x_XR_SkColorType: | ||
| return impeller::PixelFormat::kB10G10R10XR; | ||
| case kRGBA_F32_SkColorType: | ||
| return impeller::PixelFormat::kR32G32B32A32Float; |
There was a problem hiding this comment.
I am pretty sure this requires a capability check (or am I mistaken). At least for the GL backend I'd think. Perhaps we should fallback to the DontCare case?
There was a problem hiding this comment.
Not according to my investigation in gpuinfo.org. I have that in the design doc. I think it says something like 95% compatibility but it also says that for r8g8b8a8. It doesn't seem to go to 100%
|
@chinmaygarde thanks for giving it another look, i responded to all your comments but I forgot to hit "submit" then github lost them. |
|
autosubmit label was removed for flutter/flutter/177959, because - The status or check suite Linux analyzer_benchmark has failed. Please fix the issues identified (or deflake) before re-applying this label.
|
|
autosubmit label was removed for flutter/flutter/177959, because - The status or check suite Linux analyzer_benchmark has failed. Please fix the issues identified (or deflake) before re-applying this label.
|
|
autosubmit label was removed for flutter/flutter/177959, because - The status or check suite Linux analyzer_benchmark has failed. Please fix the issues identified (or deflake) before re-applying this label.
|
fixes flutter#141289 design doc: https://docs.google.com/document/d/1zpkMutZkqo2GVdMhiKzFURpgN8JDZTjtIVwwqqHKM90/edit?tab=t.0 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
fixes flutter#141289 design doc: https://docs.google.com/document/d/1zpkMutZkqo2GVdMhiKzFURpgN8JDZTjtIVwwqqHKM90/edit?tab=t.0 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
fixes flutter#141289 design doc: https://docs.google.com/document/d/1zpkMutZkqo2GVdMhiKzFURpgN8JDZTjtIVwwqqHKM90/edit?tab=t.0 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
fixes #141289
design doc: https://docs.google.com/document/d/1zpkMutZkqo2GVdMhiKzFURpgN8JDZTjtIVwwqqHKM90/edit?tab=t.0
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.