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
Use the texture filtering hardware to reduce the number of sample operations in the blur shader. #3122
Conversation
Yeah, this looks bad. I'll try to match the existing rendering more closely. |
If then new blur is just as "correct" as the software reference blur, it's probably not worth making them match. It would be better to spend the time on making sure that WebRender is used for both the test and the reference (by making SVG filters go through WebRender.) |
I'm pretty confident this is correct--it's either just as accurate or more accurate than the current implementation--so it'll let me sort out which test failures, if any, from servo#3028 and servo#3122 are true regressions.
I'm pretty confident this is correct--it's either just as accurate or more accurate than the current implementation--so it'll let me sort out which test failures, if any, from servo#3028 and servo#3122 are true regressions.
Round blur support up to the nearest even number of pixels. I'm pretty confident this is correct--it's either just as accurate or more accurate than the current implementation--so it'll let me sort out which test failures, if any, from #3028 and #3122 are true regressions. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/3126) <!-- Reviewable:end -->
☔ The latest upstream changes (presumably #3126) made this pull request unmergeable. Please resolve the merge conflicts. |
4759586
to
58814ff
Compare
Much better now. Just one test has imperceptible differences, probably due to minor rounding differences introduced by algebraic manipulation. |
Just a few minor fuzziness differences on try. This looks good. r? @gw3583 |
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.
Reviewed 2 of 2 files at r1.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @gw3583)
Windows reftests are failing though. |
58814ff
to
6f52612
Compare
@pcwalton It looks like this was basically ready to go but then got overlooked. If that's the case, I guess rebasing and doing a try would be good to make sure it's still fine, and then we can get this merged? |
It was ready to go but I wasn't sure about try results. Let me try again. |
6f52612
to
5283e7d
Compare
@pcwalton Did you get a chance to kick off another try for this? |
5283e7d
to
02477fd
Compare
☔ The latest upstream changes (presumably #3384) made this pull request unmergeable. Please resolve the merge conflicts. |
From a quick look at the try run:
I think these changes are fine, but we should get @staktrace or @jrmuizel to double check. Also looks like it needs a rebase to fix the conflicting reftest image. |
Yes although I don't see these failures anywhere else so I'd like to see another try push rebased on central to confirm. And this try push was actually based on mozilla-beta rather than mozilla-central, so it may not even be accurate in terms of what it shows.
Agreed, with the caveat that these results are from mozilla-beta. If we get the same results on mozilla-central that's fine. |
@staktrace Thanks for double checking those. @pcwalton Looks like we need a try run against m-c, and to fix the rebase conflict above, then this should hopefully be good to go. |
Try looks good (although will get @staktrace to double check again). Just need to resolve that conflicting png above then this is ready, I think. |
Yup, try push looks good to me (I can adjust the reftest numbers on those two tests when I merge it to m-c). |
02477fd
to
3b42369
Compare
Patch updated. |
@bors-servo r+ |
📌 Commit 3b42369 has been approved by |
Use the texture filtering hardware to reduce the number of sample operations in the blur shader. Linear filtering allows us to evaluate the formula k₀c₀ + k₁c₁ (Equation 1) where c₀ and c₁ are the colors of adjacent texels and k₀ and k₁ are arbitrary factors (in this case, the results of evaluating the Gaussian function) with a single lookup. Linear filtering evaluates the following expression for some t between 0 and 1: lerp(c₀, c₁, t) It can be shown algebraically that Equation 1 is equivalent to: ⎛ k₁ ⎞ (k₀ + k₁)lerp⎜c₀, c₁, ───────⎟ ⎝ k₀ + k₁⎠ Which can be readily evaluated by letting `t = k₁/(k₀ + k₁)` and performing a texture lookup. This results in some minor visual differences because we always compute an even number of pixels on each side (i.e. the *support* is now always rounded up to the nearest even number of pixels), whereas before we might have evaluated an odd number of pixels. All differences should therefore be minor quality improvements. Don't merge this yet; I want to run tests and a try build. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/3122) <!-- Reviewable:end -->
💔 Test failed - status-taskcluster |
One of the reftest fails on Linux CI and will need fuzziness of ..... 1 pixel .... max difference 1 🤦♂️
|
…rations in the blur shader. Linear filtering allows us to evaluate the formula k₀c₀ + k₁c₁ (Formula 1) where c₀ and c₁ are the colors of adjacent texels and k₀ and k₁ are arbitrary factors (in this case, the results of evaluating the Gaussian function) with a single lookup. Linear filtering evaluates the following expression for some t between 0 and 1: lerp(c₀, c₁, t) It can be shown algebraically that Formula 1 is equivalent to: ⎛ k₁ ⎞ (k₀ + k₁)lerp⎜c₀, c₁, ───────⎟ ⎝ k₀ + k₁⎠ Which can be readily evaluated by letting `t = k₁/(k₀ + k₁)` and performing a texture lookup.
3b42369
to
38ec7db
Compare
Updated. |
@bors-servo r=gw3583 |
📌 Commit 38ec7db has been approved by |
Use the texture filtering hardware to reduce the number of sample operations in the blur shader. Linear filtering allows us to evaluate the formula k₀c₀ + k₁c₁ (Equation 1) where c₀ and c₁ are the colors of adjacent texels and k₀ and k₁ are arbitrary factors (in this case, the results of evaluating the Gaussian function) with a single lookup. Linear filtering evaluates the following expression for some t between 0 and 1: lerp(c₀, c₁, t) It can be shown algebraically that Equation 1 is equivalent to: ⎛ k₁ ⎞ (k₀ + k₁)lerp⎜c₀, c₁, ───────⎟ ⎝ k₀ + k₁⎠ Which can be readily evaluated by letting `t = k₁/(k₀ + k₁)` and performing a texture lookup. This results in some minor visual differences because we always compute an even number of pixels on each side (i.e. the *support* is now always rounded up to the nearest even number of pixels), whereas before we might have evaluated an odd number of pixels. All differences should therefore be minor quality improvements. Don't merge this yet; I want to run tests and a try build. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/3122) <!-- Reviewable:end -->
☀️ Test successful - status-appveyor, status-taskcluster |
…2b5ac5aeefe9 (WR PR #3122). r=kats servo/webrender#3122 Differential Revision: https://phabricator.services.mozilla.com/D13975 --HG-- extra : moz-landing-system : lando
…2b5ac5aeefe9 (WR PR #3122). r=kats servo/webrender#3122 Differential Revision: https://phabricator.services.mozilla.com/D13975
…2b5ac5aeefe9 (WR PR #3122). r=kats servo/webrender#3122 Differential Revision: https://phabricator.services.mozilla.com/D13975 UltraBlame original commit: 2a526099b1f4405dd3df6852d38d0666580f4542
…2b5ac5aeefe9 (WR PR #3122). r=kats servo/webrender#3122 Differential Revision: https://phabricator.services.mozilla.com/D13975 UltraBlame original commit: 2a526099b1f4405dd3df6852d38d0666580f4542
…2b5ac5aeefe9 (WR PR #3122). r=kats servo/webrender#3122 Differential Revision: https://phabricator.services.mozilla.com/D13975 UltraBlame original commit: 2a526099b1f4405dd3df6852d38d0666580f4542
Linear filtering allows us to evaluate the formula
where c₀ and c₁ are the colors of adjacent texels and k₀ and k₁ are arbitrary
factors (in this case, the results of evaluating the Gaussian function) with a
single lookup. Linear filtering evaluates the following expression for some t
between 0 and 1:
It can be shown algebraically that Equation 1 is equivalent to:
Which can be readily evaluated by letting
t = k₁/(k₀ + k₁)
and performing atexture lookup.
This results in some minor visual differences because we always compute an even
number of pixels on each side (i.e. the support is now always rounded up to
the nearest even number of pixels), whereas before we might have evaluated an
odd number of pixels. All differences should therefore be minor quality
improvements.
Don't merge this yet; I want to run tests and a try build.
This change is