Fix passing Matrix4x4 across the FFI boundary

RESOLVED FIXED in Firefox 55

Status

()

P3
normal
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: kats, Assigned: kats)

Tracking

Other Branch
mozilla55
Points:
---

Firefox Tracking Flags

(firefox55 fixed)

Details

(Whiteboard: [gfx-noted])

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(2 attachments)

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.
Attachment #8856298 - Flags: review?(rhunt)

Comment 3

a year ago
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?
Comment hidden (mozreview-request)
Updated patch to have a ToWrMatrix function. This try push has the updated patch: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f73793aad289b511b84c5a57832b909b519fe0b7

Comment 6

a year ago
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+

Updated

a year ago
Attachment #8856298 - Flags: review?(rhunt)

Comment 7

a year ago
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
Last Resolved: a year ago
Resolution: --- → FIXED
status-firefox55: --- → fixed
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.