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

Implement Gradient Shaders and Fragment Shaders in Skwasm#41144

Merged
auto-submit[bot] merged 14 commits into
flutter-team-archive:mainfrom
eyebrowsoffire:skwasm_shaders
Apr 13, 2023
Merged

Implement Gradient Shaders and Fragment Shaders in Skwasm#41144
auto-submit[bot] merged 14 commits into
flutter-team-archive:mainfrom
eyebrowsoffire:skwasm_shaders

Conversation

@eyebrowsoffire

@eyebrowsoffire eyebrowsoffire commented Apr 13, 2023

Copy link
Copy Markdown
Contributor

This implements gradient shaders (linear, radial, conical, and sweep) as well as custom fragment shaders in Skwasm.

Something is still up with the ShaderMask layer though, it doesn't quite render correctly on Skwasm.

Edit: fixed and it's rendering consistently with CanvasKit now.

@flutter-dashboard flutter-dashboard Bot added the platform-web Code specifically for the web engine label Apr 13, 2023
@eyebrowsoffire eyebrowsoffire marked this pull request as ready for review April 13, 2023 05:57

@jonahwilliams jonahwilliams left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with some nits

Comment on lines +135 to +144
Pointer<Float> convertDoublesToNative(Iterable<double> values) {
final Pointer<Float> pointer = allocFloatArray(values.length);
int i = 0;
for (final double value in values) {
pointer[i] = value;
i++;
}
return pointer;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Pointer<Float> convertDoublesToNative(Iterable<double> values) {
final Pointer<Float> pointer = allocFloatArray(values.length);
int i = 0;
for (final double value in values) {
pointer[i] = value;
i++;
}
return pointer;
}
Pointer<Float> convertDoublesToNative(List<double> values) {
final Pointer<Float> pointer = allocFloatArray(values.length);
for (int i = 0; i < values.length; i++) {
pointer[i] = value;
}
return pointer;
}

Comment on lines +208 to +213
int i = 0;
for (final SkwasmShader shader in _childShaders!) {
childShaders[i] = shader.handle;
i++;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

here and elsewhere, this pattern seems like the worst of both worlds - you still have all the bookkeeping of a for loop, but with no syntax help. And all the overhead of a for-of loop

@flutter-dashboard

Copy link
Copy Markdown

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #41144 at sha a2ecf48

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 13, 2023
@auto-submit auto-submit Bot merged commit d969030 into flutter-team-archive:main Apr 13, 2023
zhongwuzw pushed a commit to zhongwuzw/engine that referenced this pull request Apr 14, 2023
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 platform-web Code specifically for the web engine will affect goldens

Development

Successfully merging this pull request may close these issues.

2 participants