gecko0307 / bindbc-wgpu

WebGPU for D
Boost Software License 1.0
26 stars 5 forks source link

Generating bindings automatically #10

Open chances opened 4 years ago

chances commented 4 years ago

@gecko0307 From your comment in #7, the wgpu function declarations are being hand-written?

Alternatives

https://wiki.dlang.org/Bindings#Binding_generators

moon-chilled commented 4 years ago

I think a better alternative would be hooking rust's own bindgen functionality to generate d bindings.

chances commented 4 years ago

Perhaps an abstraction of cbindgen that transforms its Intermediate Representation into a D module with the necessary externs and whatnot?

cbindgen's Internals

moon-chilled commented 4 years ago

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.

chances commented 4 years ago

I just updated the bindings manually for #12 (ugh, 😝️).

@moon-chilled Have you made any progress experimenting with cbindgen?

cyrusmsk commented 2 years ago

Finally available with ImportC? https://github.com/chances/wgpu-d

chances commented 2 years ago

@cyrusmsk Exactly, though wgpu-d is still quite verbose in its "idiomatic" wrapping.

ImportC is magic. 😄

kassane commented 1 month ago

D support (WiP) - w/cpp_compat

I'm still tweaking functors support and some fixes to the order of opaque structure templates.