-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Faster display list recording / paint passing. #168019
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
flar
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.
Math still not right
| const Matrix& transform) const { | ||
| return TRect::MakeOriginSize( | ||
| GetOrigin() + TPoint<float>(transform.m[12], transform.m[13]), // | ||
| GetSize().Scale(transform.m[0], transform.m[5]) // |
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.
This is not correct. You have to scale all 4 points.
Also, if there is a negative scale it can mess things up - your rect will be upside down.
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.
Update the unit tests with lots of cases of rects at origin or not at origin, various sizes, and various scales and translates and make sure the answer is the same as the full transform.
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.
ty!
| matrix_ = matrix_ * DlMatrix::MakeSkew(skx, sky); | ||
| } | ||
| void rotate(DlRadians angle) { | ||
| is_translate_scale_ = false; |
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.
90 degree rotations might be common and they can be optimized as well, but it isn't as simple as the new method. Also, unfortunately, rotate(radians) is hard to detect a quadrant rotation because the quadrant angles are all transcendental by being related to pi.
| return false; | ||
| impeller::Rect dl_intersected = dl_mapped.FastIntersection(cull_rect_); | ||
| *mapped = dl_intersected; | ||
| return true; |
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.
return not IsEmpty
| *mapped = dl_intersected; | ||
| return true; | ||
| } | ||
| return false; |
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.
You leave the mapped value undefined here. Set it to empty.
|
The SkMatrix class has a classifier field that tells them if it is just a scale/translate so they can do more optimal work. I originally developed a similar DlTransform class (see below) that also classified its state for the same purpose, but ditched that in favor of just working on the Impeller classes. Unfortunately, when I looked at the performance of the impeller::Matrix class it seemed as if it could do the work of the "case-optimized" transform classes faster by not checking and just letting the compiler do its magic, but it's been a while since I've worked on that. See https://github.com/flar/engine/blob/dl-geometry-classes/display_list/geometry/dl_transform.h and https://github.com/flar/engine/blob/dl-geometry-classes/display_list/geometry/dl_transform.cc |
Split off of #168019 Worst case allocation performance for dl is fairly bad as we end up copying the data many more times than something like an STL vector would. At the cost of more memory usage, we can improve the case where the display list grows quite large.
Split off of flutter#168019 Worst case allocation performance for dl is fairly bad as we end up copying the data many more times than something like an STL vector would. At the cost of more memory usage, we can improve the case where the display list grows quite large.
Split off of flutter#168019 Worst case allocation performance for dl is fairly bad as we end up copying the data many more times than something like an STL vector would. At the cost of more memory usage, we can improve the case where the display list grows quite large.
Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.
List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.