-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add documentation on fragment program API and usage #7902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| @@ -0,0 +1,228 @@ | |||
| --- | |||
| title: Writing and using Fragment Shaders | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBD: how do I link this from elsewhere in the website?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To link TO this page, you would use the following text:
For more information, check out [Writing and using fragment shaders][fragment-shaders]
[fragment-shaders]: {{site.url}}/development/ui/advanced/shaders
| ## Canvas API | ||
|
|
||
| Fragment shaders can be used with most Canvas APIs that accept either solid | ||
| colors or gradients via a [Paint] object. And will cover an area determined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the first two sentences here. Not sure what they're saying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what I'm trying to say is:
You can use shaders with most canvas APIs.
The shader works in the same way that a solid color or gradient works when applied to a shape
It doesn't work with certain APIs, like how a LinearGradient is ignored if set on the paint passed to drawImage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you make this change, @jonahwilliams? The suggested text is clearer.
| ### Performance Considerations | ||
|
|
||
| When targeting the Skia backend loading the shader may be expensive, since it | ||
| must be compiled to the appropriate platform specific shader. If you intend to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| must be compiled to the appropriate platform specific shader. If you intend to | |
| must be compiled to the appropriate platform specific shader at runtime. If you intend to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
|
||
| ``` | ||
|
|
||
| ## Authoring Shaders |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe frontload pointers to tutorials on writing shaders?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this will get a generated table of contents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering what kind of tutorials you mean, @zanderso
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ones listed down under "Other resources". My thought was to make it clear that this doc isn't intended to be a general tutorial on writing shaders.
Co-authored-by: Zachary Anderson <[email protected]>
|
@sfshaza2 PTAL. I'd like to merge this change before the next stable so that I can update some class documentation in the flutter repo to point to it |
sfshaza2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phew! This one was a doozy!
| @@ -0,0 +1,228 @@ | |||
| --- | |||
| title: Writing and using Fragment Shaders | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To link TO this page, you would use the following text:
For more information, check out [Writing and using fragment shaders][fragment-shaders]
[fragment-shaders]: {{site.url}}/development/ui/advanced/shaders
sfshaza2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, as this is a new page, can you add it to the sidenav? To do that, edit src/_data/sidenav.yml.
Co-authored-by: Shams Zakhour (ignore Sfshaza) <[email protected]>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <[email protected]>
|
@sfshaza2 I've updated this PR with most of your suggestions + a few comments/questions |
Co-authored-by: Loïc Sharma <[email protected]>
sfshaza2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few minor quibbles, but nothing to hold up landing this, when you're ready. LGTM
Co-authored-by: Shams Zakhour (ignore Sfshaza) <[email protected]>
|
Thanks for all of the help on this one @sfshaza2 ! |
Adds documentation on usage of the fragment program API.
Fixes flutter/flutter#107929
Presubmit checklist