Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRemove manual interpolation of local space in transform shaders. #2069
Conversation
|
r? @kvark New passes in Servo: New passes in Gecko: Gecko try is here (looks to be all green except for the PASS above and intermittents): |
|
There's clearly some more tidy up that can be done as a follow up with this change (e.g. we could unify |
|
|
|
Rebased over the rotated text PR. |
|
I really like where this is going! Reviewed 14 of 14 files at r1. webrender/res/prim_shared.glsl, line 652 at r1 (raw file):
can we just clamp to webrender/res/prim_shared.glsl, line 665 at r1 (raw file):
I'm still a bit confused about webrender/res/prim_shared.glsl, line 665 at r1 (raw file):
TODO (possibly, for myself): use webrender/res/prim_shared.glsl, line 688 at r1 (raw file):
interesting, so this is changing the semantics: before we had translation to the target space followed by webrender/res/prim_shared.glsl, line 704 at r1 (raw file):
why is this changed? webrender/res/prim_shared.glsl, line 823 at r1 (raw file):
sweeet! webrender/res/ps_image.glsl, line 87 at r1 (raw file):
hmm, this would give us a different position, wouldn't it? wrench/reftests/transforms/perspective.png, line 0 at r1 (raw file): Comments from Reviewable |
|
Review status: 11 of 15 files reviewed at latest revision, 8 unresolved discussions. webrender/res/prim_shared.glsl, line 652 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/res/prim_shared.glsl, line 665 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
It's a bit of extra work to determine if we have a super-simple case that needs a minimal extrude (this is only in the transform path, so a simple case with no rotation etc is already going through the path with no-extrude at all). I dropped it to 2 pixels for now, which seems to still give good results on weird perspective transforms, but reduce the extra edge pixels. I think a 2 pixel edge in the case of a rotation / perspective is OK to pay for now, as a conservative approximation, since we don't pay the cost for non-transformed primitives? webrender/res/prim_shared.glsl, line 688 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Oops, fixed. webrender/res/prim_shared.glsl, line 704 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
I think this was a bug - it meant that images weren't using the local rect to get AA edges for. This was causing the extra edge drawing on the perspective reftest below. Unless I'm misunderstanding something? webrender/res/prim_shared.glsl, line 823 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/res/ps_image.glsl, line 87 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
I don't think so - that value should now be perspective interpolated, right? Since we provide the W value from the vertex shader? wrench/reftests/transforms/perspective.png, line at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
There's a few tiny differences in the pixel output, but mostly this was due to the fix of the default mask value you commented on above. Comments from Reviewable |
|
@kvark Thanks for the review. I've fixed up or answered those items. I'll hold off on a try run until the discussions above are resolved (not sure if those answer your questions or if more changes are needed). Once I get r=you, then I'll do a try run and merge if green. |
Instead, for vertex transform shaders we now write out: (world.xy, z * world.w, world.w) This gives us constant Z across the polygon for draw ordering. It also means we can use the hardware interpolators instead of manually dividing by Z in the fragment shader for local_pos. This is mostly preparation work for switching shaders over to be brush primitives, but has the happy side effect of: * Fixing a small number of Gecko + Servo reftests. * Simpler and faster code.
|
@kvark I did a follow up try with those changes: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d3e1167029802cc03f329358cabbb671ad2eabd4 All green. |
|
Reviewed 4 of 4 files at r3. webrender/res/prim_shared.glsl, line 665 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
strictly speaking, webrender/res/prim_shared.glsl, line 704 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
1.0 means using instance rect for clipping, 0.0 means using the primitive rect webrender/res/ps_image.glsl, line 87 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
I forgot that old Comments from Reviewable |
|
Great stuff, and thanks for addressing the comments! |
|
|
Remove manual interpolation of local space in transform shaders. Instead, for vertex transform shaders we now write out: (world.xy, z * world.w, world.w) This gives us constant Z across the polygon for draw ordering. It also means we can use the hardware interpolators instead of manually dividing by Z in the fragment shader for local_pos. This is mostly preparation work for switching shaders over to be brush primitives, but has the happy side effect of: * Fixing a small number of Gecko + Servo reftests. * Simpler and faster code. <!-- 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/2069) <!-- Reviewable:end -->
|
|
0aebe2b
into
servo:master
|
@glennw This PR caused some regressions on the gecko side, I confirmed the range for https://bugzilla.mozilla.org/show_bug.cgi?id=1420748 and https://bugzilla.mozilla.org/show_bug.cgi?id=1420754 but likely https://bugzilla.mozilla.org/show_bug.cgi?id=1421526 is also the same problem. |
|
Thanks @staktrace ! I moved this into a separate issue #2133 |
glennw commentedNov 21, 2017
•
edited by larsbergstrom
Instead, for vertex transform shaders we now write out:
(world.xy, z * world.w, world.w)
This gives us constant Z across the polygon for draw ordering.
It also means we can use the hardware interpolators instead of
manually dividing by Z in the fragment shader for local_pos.
This is mostly preparation work for switching shaders over to
be brush primitives, but has the happy side effect of:
This change is