perspective transforms and box shadow from css orange doesn't draw correctly
Categories
(Core :: Graphics: WebRender, defect, P2)
Tracking
()
People
(Reporter: acupsa, Assigned: kvark)
References
Details
Attachments
(7 files)
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Comment 1•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 3•6 years ago
|
||
Comment 4•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Comment 5•6 years ago
|
||
Comment 6•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 7•6 years ago
|
||
Comment 8•6 years ago
|
||
Comment 9•6 years ago
|
||
Assignee | ||
Comment 10•6 years ago
|
||
Also looking at this...
Assignee | ||
Comment 11•6 years ago
|
||
stealing since :emilio is busy with more important stuff atm
Comment 12•6 years ago
|
||
Dzmitry has debugged this enough to understand that it is rare. Demoting to P4
Assignee | ||
Comment 13•6 years ago
|
||
I think the issue comes from the way we interpolate clip UV coordinates for the case where the clip space is perspective-transformed. Our current approach involves special code for 2D un-projection of a local point into the clip plane ("get_node_pos" in shaders), and one of the following may be happening:
- the un-projection code doesn't work with perspective: it assumes the space is just a rotated/scaled plane, which isn't exactly the case here
- these UV coordinates aren't interpolated with perspective correction
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Comment 14•6 years ago
|
||
Attaching a simple yaml demonstrating how we mess up box-shadows in perspective so I can easily run this on different machines.
Comment 15•6 years ago
|
||
Comment 16•6 years ago
|
||
Ok so dug through this a bit and we seem to have figured this out. Basically, we are currently overly relying on "preserve-3d" to force us to render things in local space / intermediates. Notably, the "CS" family of shaders aren't supposed to be run with perspective -- they're supposed to be drawn in local space and then have the perspective applied with brush_image.
The case in question draws a box shadow inside a perspective transform without any preserve_3ds. The pipeline then concludes nothing needs to be composited and we get messed up shadows. The attached test-case demonstrates that just adding a preserve-3d node fixes everything. But we can't rely on users adding these, so we need to add some more robust automatic detection.
kvark has suggested this should be done when we're allocating render tasks.
Assignee | ||
Comment 17•6 years ago
|
||
To clarify on my suggestion, in the render task chain Primitive -> BoxShadow -> Output, when there is perspective transformation involved we are currently doing the transform in Primitive -> BoxShadow step, which is done via a "cs_" shader that doesn't support perspective, while BoxShadow -> Output is done via an image (or blend) brush without transformation. Instead, we should be doing Primitive -> BoxShadow without transformation and then apply the perspective to the image/blend shader in the second step.
Comment 18•6 years ago
|
||
handing back to kvark since the fix is too subtle for my understanding of these subsystems.
Just to add extra information that has led to some confusion:
:gw asserted that the cs_clip family of shaders should be handling this case correctly. The shader does seem to be partially perspective aware, just not perspective-interpolation aware, in the BRUSH_FLAG_PERSPECTIVE_INTERPOLATION sense.
So this can be either regarded as a bug that we're letting perspective get all the way to this shader, or that the shader is failing to handle perspective interpolation.
ni?gw just to get their two cents on which is the "right" fix.
Assignee | ||
Comment 19•6 years ago
|
||
lemme look at it on my (magical) machine first before ni? gw
Assignee | ||
Comment 20•5 years ago
|
||
Set up position W of clip rendering,
such that everything is perspective-interpolated in clip space.
Comment 21•5 years ago
|
||
Did you mean to only attach the reftest with no code changes?
Assignee | ||
Comment 22•5 years ago
|
||
I actually wanted to attach the code only, but thought it could cause issues if we land the test case separately. It would be great if you could land that reftest disabled, so that I can just flip the switch in my PR.
Updated•5 years ago
|
Comment 24•5 years ago
|
||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 25•5 years ago
|
||
bugherder |
Comment 26•5 years ago
|
||
Comment 27•5 years ago
|
||
bugherder |
Assignee | ||
Comment 28•5 years ago
|
||
a follow-up to the actual fix and the reftest
Comment 29•5 years ago
|
||
Comment 30•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 32•5 years ago
|
||
(In reply to Julien Cristau [:jcristau] from comment #31)
Is this something we should uplift?
Assignee | ||
Comment 33•5 years ago
|
||
Julien,
It could be, but I don't think it manifests a lot on real pages, so there is no urgency to ship it.
Comment 34•5 years ago
|
||
Thanks!
Updated•5 years ago
|
Comment 35•5 years ago
|
||
Hello!
Reproduced the issue using Firefox 63.0a1 (20180709221247) on Windows 10x64.
The issue is verified fixed with Firefox 69.0b8 (20190723212625) on Windows 10.x64, macOS 10.14 and Ubuntu 18.04, the image is rendered as expected while using WebRender.
Description
•