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

Conversation

@jonahwilliams
Copy link
Contributor

The native engine needs to hold a strong reference to fragment programs. So the dart side holding a weak ref is more or less pointless

@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 "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use 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.

@jonahwilliams jonahwilliams requested a review from dnfield January 18, 2024 18:21
@jonahwilliams
Copy link
Contributor Author

Lets see if any tests fail.....

@jonahwilliams jonahwilliams changed the title [ui] hold a storng reference to fragment program objects. [ui] hold a strong reference to fragment program objects. Jan 18, 2024
@jonahwilliams
Copy link
Contributor Author

they did not.

@dnfield
Copy link
Contributor

dnfield commented Jan 18, 2024

This fixes flutter/flutter#141490 right?

@dnfield
Copy link
Contributor

dnfield commented Jan 18, 2024

I wonder if this also breaks some programs out there? For example, I think the following used to work but now wouldn't:

  1. Load a fragment program.
  2. Get the shader, set some uniforms using setFloat.
  3. Render.
  4. Drop all references to the fragment program. Load it again.
  5. Uniforms are not zeroed out now because of (2).

@jonahwilliams
Copy link
Contributor Author

But the fragmentShader has the uniforms, not the program

@dnfield
Copy link
Contributor

dnfield commented Jan 19, 2024

Ok. I thought I saw this but we can fix it separately if it's an issue.

I think a test should be possible for this, e.g. load FragmentProgram.fromAsset twice and make sure they objects are identical. Although that doesn't encode whether it's weakly or strongly held, and maybe for that we'd need a GC...

@jonahwilliams
Copy link
Contributor Author

I added a test that checks if two loaded programs are identical, which at least verifies there is a cache. It can't verify the GC behavior obvs.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 24, 2024
@auto-submit auto-submit bot merged commit 8fc28ae into flutter:main Jan 24, 2024
@jonahwilliams jonahwilliams deleted the remove_weak_ref branch January 24, 2024 00:11
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 24, 2024
…142098)

flutter/engine@220416c...da96f9d

2024-01-24 skia-flutter-autoroll@skia.org Roll Skia from c396b2171b16 to be4b398b4f2e (2 revisions) (flutter/engine#49988)
2024-01-24 skia-flutter-autoroll@skia.org Roll Dart SDK from 5646ac9669f8 to 838cd732e56a (3 revisions) (flutter/engine#49982)
2024-01-24 jonahwilliams@google.com [ui] hold a strong reference to fragment program objects. (flutter/engine#49868)
2024-01-23 skia-flutter-autoroll@skia.org Roll Skia from 4e42423c7f6f to c396b2171b16 (1 revision) (flutter/engine#49987)
2024-01-23 skia-flutter-autoroll@skia.org Roll Skia from e7d10257ffb5 to 4e42423c7f6f (4 revisions) (flutter/engine#49985)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants