Closed Bug 1354951 Opened 5 years ago Closed 5 years ago

Add type aliases in to have the type names match the C++ side exactly


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

Other Branch



Tracking Status
firefox55 --- fixed


(Reporter: kats, Assigned: kats)



(Whiteboard: [gfx-noted])


(1 file)

The binding generator (see bug 1354944) currently doesn't hard-code any mapping of type names. However, there are type name mismatches across our existing bindings. By this I mean that we have a function signature using e.g. PipelineId on the Rust side but WrPipelineId on the C++ side. I added some support in the binding generator to handle this with type aliases. So if we add `type WrPipelineId = PipelineId;` on the Rust side, and use WrPipelineId in the function signatures, then the binding generator will know to generate a C struct called WrPipelineId but using the definition from the PipelineId repr(C) struct in Rust.

So the upshot of this is we need to update to add these type aliases and use the right types in the function signatures for the generated bindings to come out right. I have a patch locally that does this although it will probably rot quite fast.
Comment on attachment 8856295 [details] [diff] [review]

Review of attachment 8856295 [details] [diff] [review]:

This is mostly a straightforward search-and-replace type of patch. The only interesting replacement is WrRenderedEpochs which maps to a Vec of tuples. That one is opaque on the C++ side ( and the binding generator won't generate anything for it.
Attachment #8856295 - Flags: review?(rhunt)
Attachment #8856295 - Flags: review?(rhunt) → review+
Apparently type aliases don't work exactly how I expected. We can do stuff like use `WrMixBlendMode::Normal` in Instead we have to use `MixBlendMode::Normal`. I'm not sure why it compiled for me locally but the former failed on try, so I changed it to the latter.

Green try push at, will land with that change. It doesn't affect the binding side of things.
Pushed by
Add some typedefs in to make the rust function signatures better match the signatures in webrender_ffi.h. r=rhunt
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.