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 Sep 14, 2022

fix flutter/flutter#111534

The value of coods x should range from the center of the first texel to the center of the last texel. However, the current implementation goes from the left of the first texel to the right of the last texel.

For example, if the gradient only has start color and end color, the value range of coods x is from 0.25 to 0.75.

cc @jonahwilliams @bdero @dnfield

It is base on the flowing image
image

without patch

jbfdwDQRvz

with patch

vcNKoRn634

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.

);
float t = dot / (len * len);
frag_color = IPSampleWithTileMode(
if ((t < 0.0 || t >= 1.0) && gradient_info.tile_mode == kTileModeDecal) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this an issue we should fix in IPSampleWithTileMode?

Copy link
Contributor

Choose a reason for hiding this comment

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

if not, I think we should still probably pull this functionality into a helper in texture.glsl so that we don't need to repeat it for all 3 gradient types

Copy link
Member

@bdero bdero Sep 15, 2022

Choose a reason for hiding this comment

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

This is specifically a problem for linear sampling, so maybe we should have IPSampleLinear and IPSampleLinearWithTileMode, which is basically the same as the non-linear variants but with an extra half_texel param? We need to make this fix almost any time we do linear sampling (as @flar pointed out a couple of weeks back), so these utilities will probably get a good amount of use.

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. IPSampleLinear and IPSampleLinearWithTileMode have been added.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 15, 2022
@auto-submit auto-submit bot merged commit 06fe761 into flutter:main Sep 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 15, 2022
zanderso pushed a commit to flutter/flutter that referenced this pull request Sep 15, 2022
…111696)

* 06fe761f6 [Impeller] Make gradients work as expected (flutter/engine#36140)

* f18d17ba8 Roll Skia from 962fd1f9abfc to 6e0e0a9f6cbf (3 revisions) (flutter/engine#36174)

* 5e6b0d813 Enable dart null-safety (flutter/engine#36154)

* ccba311e2 Fix typo (flutter/engine#36167)

* b828d3079 [lint] Enforce kCamelCase for global constants (flutter/engine#36175)

* 9a6caba29 Roll Skia from 6e0e0a9f6cbf to 7c2dc625d01e (2 revisions) (flutter/engine#36178)
Oleh-Sv pushed a commit to Oleh-Sv/engine that referenced this pull request Sep 28, 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.

[Impeller] gradients are not working as expected

4 participants