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

Conversation

@ColdPaleLight
Copy link
Member

@ColdPaleLight ColdPaleLight commented May 19, 2022

Fixes the textures portion of flutter/flutter#102262.

cc @chinmaygarde @dnfield

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the [CLA].
  • All existing and new tests are passing.

@flutter-dashboard
Copy link

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 Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on 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.

Copy link
Contributor

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

I don't think we should land this. Depending on the backend, a copy may or may not be necessary. And, if a copy is not necessary in the SetContents call but the API only takes mappings, then a caller who cannot transfer ownership of the data into the backend will have no choice but to perform a copy speculatively. If there are both APIs, the caller must prefer mapping but can provide raw pointers. And some backends will be able to avoid copies in those cases as well.

@ColdPaleLight
Copy link
Member Author

I don't think we should land this. Depending on the backend, a copy may or may not be necessary. And, if a copy is not necessary in the SetContents call but the API only takes mappings, then a caller who cannot transfer ownership of the data into the backend will have no choice but to perform a copy speculatively. If there are both APIs, the caller must prefer mapping but can provide raw pointers. And some backends will be able to avoid copies in those cases as well.

I got it, I changed this PR, replace raw pointers with mappings in some places to avoid unnecessary copies, WDYT?

@ColdPaleLight ColdPaleLight marked this pull request as draft June 9, 2022 16:16
@ColdPaleLight ColdPaleLight marked this pull request as ready for review June 14, 2022 02:12
Copy link
Contributor

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

This version of the patch makes sense and we should go ahead. I guess the commit message is misleading now though. Can you reword the commit to say something to the effect of "use mapping based SetContexts in image decoder and text render context"?

return nullptr;
}

const auto& pixmap = bitmap.pixmap();
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a missing null check here now.

Copy link
Member Author

@ColdPaleLight ColdPaleLight Jun 17, 2022

Choose a reason for hiding this comment

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

Done. It looks like the bitmap here must not be null, so I added a FML_DCHECK here.

@ColdPaleLight ColdPaleLight changed the title [impeller] Migrate 'Texture::SetContents' to take 'fml::Mappings' instead of raw pointers [impeller] Use mapping based 'Texture::SetContents' in image decoder and text render context Jun 17, 2022
@ColdPaleLight
Copy link
Member Author

This version of the patch makes sense and we should go ahead. I guess the commit message is misleading now though. Can you reword the commit to say something to the effect of "use mapping based SetContexts in image decoder and text render context"?

Done

@ColdPaleLight ColdPaleLight added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 22, 2022
@auto-submit auto-submit bot merged commit 48ef1f8 into flutter:main Jun 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller needs tests

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants