Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start migration from cbindgen to bindgen #85

Merged
merged 3 commits into from
Apr 2, 2021
Merged

Conversation

ncharlton02
Copy link
Collaborator

@ncharlton02 ncharlton02 commented Mar 28, 2021

Fix for #78 - has rust types generated by the header instead of vice-versa. Currently still needs a lot of work (most of the original codebase is deleted 😞 ) but I am slowly reimplementing everything with the generated types. Currently the triangle and compute examples should work on Windows and Linux. Anyways, thought I would post this here to get initial thoughts before I finished adding everything.

Big changes

  • all of the header types are generated at build time and inserted into the crate::native module
  • enums are mapped from their c types to wgt using a macro (map_enum!)
  • two c headers (ffi/webgpu.h for things in the webgpu-native headers, and ffi/wgpu.h for stuff unique to wgpu-native)

Small Notes

  • auto-generated bindings are modified at build time to change all of the *Impl to Ids (BindGroupImpl -> wgc::id::BindGroupId)
  • libclang now required to build (required by bindgen)
  • enum constants are i32 on windows and are u32 on macos/linux
  • example shaders are now written in WGSL
  • Had to change some of the makefiles for windows c development (if anyone has a better way to write makefiles please let me know 😄)

Stuff that still needs to be added

  • MacOS Surfaces
  • Wayland Surfaces
  • most commands
  • undelete / update the capture example
  • logging
  • Textures
  • Fix IOS
  • Include webgpu.h in release CI

ffi/webgpu.h Outdated Show resolved Hide resolved
@kvark
Copy link
Member

kvark commented Mar 29, 2021

@devorc this is absolutely critical work, even if it's very routine. I don't know how to express the gratitude to you for doing this! 🥇

@kvark
Copy link
Member

kvark commented Apr 1, 2021

Is this ready to go?

@ncharlton02
Copy link
Collaborator Author

Almost - need to finish porting some of the functions. Will probably be ready by tonight or tomorrow.

@ncharlton02 ncharlton02 marked this pull request as ready for review April 1, 2021 23:26
Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 2, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants