Lighting and gaussian blur performance improvements
-
Lighting code changes:
- Merged diffuse and specular filter code, they were the same for the most part and it'd be inconvenient to apply changes to the code structure to both places at once.
- Unrolled the lighting normal computation, now it looks more like in WebKit.
- Optimized the common case of (0, 0, 1) normal (there's a comment in WebKit saying it's a common case, and also I checked the phone and it's indeed (0, 0, 1) for the most part).
- Moved some coordinate transformations which didn't need to be inside the loops out of the loops.
- Parallelized the computation with rayon.
- This dropped the phone from 7.6 to about 6 seconds IIRC.
-
Blur code changes:
- Parallelized with some hacks and rayon. More details in the comments.
- This dropped the phone to about 4 seconds.
- This also dropped the
box_blur
benchmarks by about 50%. - And also the
-p 1 -r 100
rsvg-bench onbugs/634324-blur-negative-transform.svg
is now about 1.3 seconds, it was 2.8 seconds after !99 (merged).
Edited by Ivan Molodetskikh