-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Impeller] Switch to uniform arrays for gradient data on non-SSBO hardware #56294
base: main
Are you sure you want to change the base?
Conversation
float tile_mode; | ||
vec4 decal_border_color; | ||
float alpha; | ||
int colors_length; |
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.
GLES 2.0 requires that we use a float for this 😨
highp vec2 start_to_end; | ||
float alpha; | ||
float tile_mode; | ||
int colors_length; |
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.
Same here
float tile_mode; | ||
vec4 decal_border_color; | ||
float alpha; | ||
int colors_length; |
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.
Same here
@@ -53,6 +53,10 @@ class LinearGradientContents final : public ColorSourceContents { | |||
const Entity& entity, |
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.
Can we also remove RenderTexture in this patch?
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.
Eventually, I want to leave the old stuff around while I get the new stuff working and then I can run comparisons for testing/benchmarking.
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.
SGTM
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.
Per other discussions I think we decided it would stay in case we get more than 256 colors. Eventually we hope to have a vertex tiling solution that works efficiently on all platforms, but until then we'll still have the issue with zero-length stops on older platforms, but only if there are more than 256 stops total...
/** | ||
* @brief Populate 2 arrays with the colors and stop data for a gradient | ||
* | ||
* The color data is simple converted to a vec4 format, but the stop data |
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.
Nice!
FYI - The latest push uses the Uniform versions of the shaders for all types as long as there are fewer than 256 colors. References to the old shaders are commented out for now just as a test run to test the new shaders as much as possible. If the test results are fine then I'll restore and finalize the code. |
@@ -145,4 +145,30 @@ vec3 IPComputeFixedGradientValues(float t, float colors_length) { | |||
return vec3(lower_index, upper_index, scale); | |||
} | |||
|
|||
vec4 IPComputeColorFromTables(vec4 colors[256], |
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 don't think this is used any more as the call overhead swamped everything else. I'll delete when I finalize the code.
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. |
3dc79ba
to
75874d3
Compare
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). 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. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
I just noticed the golden diffs from the previous round of testing. It looks like I have more testing/debugging to do. |
Golden file changes are available for triage from new commit, Click here to view. |
I've fixed the problem that was causing the golden failures (I believe) and restored the code that forces the new Uniform variant of the shaders to do another test run. While testing this version I was seeing memory corruption issues in my local testing. I'll file a related bug for review by a wider audience. |
AFAICT, the golden diffs on the last commit were due to:
|
Currently the most generalized form of the Impeller gradient shaders uses an SSBO to store the gradient information, but SSBO data is not supported on older platforms. To make the capability more general we introduce variants of the gradient shaders that uses uniform arrays which are more widely supported.