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 Aug 15, 2022

fix flutter/flutter#109384

1gVJHESiCG

vN2g9eoqos

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.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@ColdPaleLight ColdPaleLight self-assigned this Aug 15, 2022
@ColdPaleLight ColdPaleLight changed the title Support 'matrix' parameter for color sources [Impeller] Support 'matrix' parameter for color sources Aug 15, 2022
Copy link
Member

@bdero bdero left a comment

Choose a reason for hiding this comment

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

This is looking great, thanks! Just a few comments about shader lib conventions and vertex shaders.

void main() {
gl_Position = vert_info.mvp * vec4(position, 0.0, 1.0);
v_texture_coords = texture_coords;
interpolated_vertices = position;
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I know this convention wasn't introduced by this PR, but here and everywhere else: Maybe just call this v_position instead of interpolated_vertices? I've been replacing "vertex" in shaders lately with less ambiguous terms.

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.

#ifndef TRANSFORM_GLSL_
#define TRANSFORM_GLSL_

vec2 transform(mat4 matrix, vec2 point) {
Copy link
Member

Choose a reason for hiding this comment

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

Please follow the naming convention present in blending.glsl for utilities with type variation. I'd recommend: IPVec2TransformPosition to distinguish from, say, IPVec3TransformDirection, which would be similar except with 0 for the homogeneous coordinate. Also, please add a doc string for all functions added to the shader library.

Copy link
Member Author

Choose a reason for hiding this comment

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

Renaming is complete.

Would you mind giving me a doc string? Since I'm not a native speaker, I'm not sure how to describe it.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, something like this would be good:

/// Returns the Cartesian coordinates of `position` in `transform` space.
IPVec2TransformPosition(mat4 transform, vec2 position) {


void main() {
float len = length(interpolated_vertices - gradient_info.center);
vec2 transformed_vertices = transform(gradient_info.matrix, interpolated_vertices);
Copy link
Member

@bdero bdero Aug 16, 2022

Choose a reason for hiding this comment

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

Here and everywhere else, this transform could just be done in the vertex shader before throwing it over to the fragment shader.

Copy link
Member

Choose a reason for hiding this comment

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

Also, it seems the gradient vertex shaders have turned out to be identical. If they continue being identical, consider deleting radial_gradient_fill and sweep_gradient_fill and just use the gradient_fill vertex shader for all of the pipelines.

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.

@ColdPaleLight ColdPaleLight requested a review from bdero August 16, 2022 07:29
Copy link
Member

@bdero bdero left a comment

Choose a reason for hiding this comment

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

LGTM!

@ColdPaleLight ColdPaleLight added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 17, 2022
@auto-submit auto-submit bot merged commit fa91de4 into flutter:main Aug 17, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 17, 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

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

[Impeller] Support 'matrix' parameter in all color source contents

2 participants