Closed Bug 1354946 Opened 7 years ago Closed 7 years ago

Fix passing Matrix4x4 across the FFI boundary

Categories

(Core :: Graphics: WebRender, enhancement, P3)

Other Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: kats, Assigned: kats)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(2 files)

Right now the FFI signature for wr_push_stacking_context takes a float* on the C++ side and accepts a LayoutTransform on the Rust side. However, LayoutTransform is not repr(C) which means there is no guarantee that it's layout is the same as a float array. This is potential bug, and something we need to fix for the binding generator to work properly.

I'm working on a patch for this right now. It adds a WrMatrix type that stores a float[16] and otherwise behaves much like the WrRect type.
Comment on attachment 8856298 [details] [diff] [review]
Patch

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

::: gfx/webrender_bindings/WebRenderAPI.cpp
@@ +534,5 @@
>  {
> +  WrMatrix transform;
> +  static_assert(sizeof(aTransform.components) == sizeof(transform.values),
> +      "Matrix components size mismatch!");
> +  memcpy(transform.values, aTransform.components, sizeof(transform.values));

Can we have a wr::ToWrMatrix function for this?
Updated patch to have a ToWrMatrix function. This try push has the updated patch: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f73793aad289b511b84c5a57832b909b519fe0b7
Comment on attachment 8856736 [details]
Bug 1354946 - Add an explicit WrMatrix type for passing 4x4 matrices across the FFI boundary.

Thanks!
Attachment #8856736 - Flags: review?(rhunt) → review+
Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/projects/graphics/rev/1bfa30d18fef
Add an explicit WrMatrix type for passing 4x4 matrices across the FFI boundary. r=rhunt
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: