Closed Bug 1354944 (wr-binding) Opened 3 years ago Closed 3 years ago

Autogenerate (much of) the webrender_ffi.h file

Categories

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

Other Branch
defect

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: kats, Assigned: kats)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file)

The FFI boundary for webrender has gfx/webrender_bindings/src/bindings.rs on the rust side and gfx/webrender_bindings/webrender_ffi.h on the C++ side. However right now any changes in one have to be manually reflected in the other, which is error-prone.

We now have a binding generator at https://github.com/jrmuizel/wr-binding which is getting close to done. The binding generator can take as input the rust code, and can generate a large subset of the stuff in webrender_ffi.h. This bug is tracking the remaining work needed to put it into production use.

The goal here is to have the wr-bindings generator generate a bindings file which is then checked in at gfx/webrender_bindings/webrender_ffi_autogen.h and #include'd into gfx/webrender_bindings/webrender_ffi.h. If changes are made to bindings.rs or any of the rust code it depends on, the binding generator will need to be run manually. This will produce a new webrender_ffi_autogen.h file which can then be checked in along with the rest of the changes.

There are a few things missing before we can get this done, I'll file other bugs hanging off this one for those items.
There's also going to be some fixes in wr-bindings needed, so I'll add those as issues on the github repo. e.g. jrmuizel/wr-binding#2
Putting THIS FILE IS GENERATED! DO NOT MODIFY MANUALLY! See https://github.com/jrmuizel/wr-binding! on every function seems a little aggressive.
It is a little aggressive, yeah. But the function signatures are large enough that the warning only shows up every few lines. And in my experience a single warning at the top is usually not sufficient to stop people. But I can reduce it to one warning per "block" (i.e. one for structs, one for functions, etc). Also I should rename the file to be _generated.h instead of _autogen.h since it's technically not "auto"-generated.
Assignee: nobody → bugmail
Comment on attachment 8857219 [details]
Bug 1354944 - Plug in the generated FFI header.

https://reviewboard.mozilla.org/r/129156/#review131678
Attachment #8857219 - Flags: review?(jmuizelaar) → review+
Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/projects/graphics/rev/199dd7c4179f
Plug in the generated FFI header. r=jrmuizel
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.