Generating bindings automatically
@gecko0307 From your comment in #7, the wgpu function declarations are being hand-written?
Alternatives
https://wiki.dlang.org/Bindings#Binding_generators
- cbindgen @moon-chilled's common format issue: eqrion/cbindgen#616
-
dpp
I was seeing success using it with
wgpu.hCon: It generates a bloated D file. - dstep
- ~~htod~~
Unmaintained and doesn't work with
wgpu.h
I think a better alternative would be hooking rust's own bindgen functionality to generate d bindings.
Perhaps an abstraction of cbindgen that transforms its Intermediate Representation into a D module with the necessary externs and whatnot?
Actually, upon thinking about the matter a bit more, I think even better would be for cbindgen to dump its internal representation into some common format—json or similar—which can be consumed by any language. (Like how bindings are automatically generated for xcb and opengl based on xml specs.) I'll file a ticket on cbindgen later.
I just updated the bindings manually for #12 (ugh, 😝️).
@moon-chilled Have you made any progress experimenting with cbindgen?
Finally available with ImportC? https://github.com/chances/wgpu-d
@cyrusmsk Exactly, though wgpu-d is still quite verbose in its "idiomatic" wrapping.
ImportC is magic. 😄
D support (WiP) - w/cpp_compat
- https://github.com/mozilla/cbindgen/issues/866
I'm still tweaking functors support and some fixes to the order of opaque structure templates.