Closed Bug 1331713 Opened 7 years ago Closed 7 years ago

Get 3D transforms working

Categories

(Core :: Graphics: WebRender, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: rhunt, Unassigned)

References

Details

Attachments

(1 file)

Currently we do not pass 3D transforms to webrender.
Here is my work in progress. It tries to cover passing 3D transforms to webrender, and also the trickiness of Extend3DContext.
Comment on attachment 8827589 [details] [diff] [review]
transform-preserve.patch

Review of attachment 8827589 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/wr/WebRenderBorderLayer.cpp
@@ +34,2 @@
>    Rect overflow(0, 0, relBounds.width, relBounds.height);
> +  Matrix4x4 transform = GetEffectiveTransform();

I believe we want to be using GetTransform() here instead of GetEffectiveTransform() as we want to use the the transform relative to our parent.
(In reply to Jeff Muizelaar [:jrmuizel] from comment #2)
> Comment on attachment 8827589 [details] [diff] [review]
> transform-preserve.patch
> 
> Review of attachment 8827589 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: gfx/layers/wr/WebRenderBorderLayer.cpp
> @@ +34,2 @@
> >    Rect overflow(0, 0, relBounds.width, relBounds.height);
> > +  Matrix4x4 transform = GetEffectiveTransform();
> 
> I believe we want to be using GetTransform() here instead of
> GetEffectiveTransform() as we want to use the the transform relative to our
> parent.

Yes in most cases we do. But when we are a 3D context leaf we need to combine our local transform with all of our parent layers that extend the 3D context. The 3D context leaf is drawn before it's parents because of SortChildrenBy3DZOrder, so it won't reside in it's parent's webrender stacking context.

I put the code to handle both those cases inside ComputeEffectiveTransforms. So usually EffectiveTransform is the same as GetTransform.

There could be a better way to do that, or it could be renamed.
I'm not sure we want to be using SortChildrenBy3DZOrder with Webrender. My understanding is that this sorting should be happening on the webrender side instead of on the gecko side. Does that make any sense?
Flags: needinfo?(rhunt)
Yes you're right this would be better done on the webrender side. SortChildrenBy3DZOrder was in use already, and I didn't think about where it should be implemented. 

I don't see any code related to extending a 3D context in webrender, so I'm guessing it will need to be added. I can look into that.
Flags: needinfo?(rhunt)
I've filed this as https://github.com/servo/webrender/issues/739 It's currently blocked on some coordinate space reworks.

Given that we're going to push preserve-3d handling into webrender does it make sense to just use GetTransform() now?
Flags: needinfo?(rhunt)
Yes that makes sense to me.
Flags: needinfo?(rhunt)
We pass GetTransform() into WebRender now, so it has access to 3D transforms.

Closing this, as the work will be done on the WebRender side.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: