Skip to content

Start migration from cbindgen to bindgen - #85

Merged
bors[bot] merged 3 commits into
gfx-rs:masterfrom
ncharlton02:rewrite
Apr 2, 2021
Merged

Start migration from cbindgen to bindgen#85
bors[bot] merged 3 commits into
gfx-rs:masterfrom
ncharlton02:rewrite

Conversation

@ncharlton02

@ncharlton02 ncharlton02 commented Mar 28, 2021

Copy link
Copy Markdown
Collaborator

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

Comment thread ffi/webgpu.h Outdated
@kvark

kvark commented Mar 29, 2021

Copy link
Copy Markdown
Member

@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

kvark commented Apr 1, 2021

Copy link
Copy Markdown
Member

Is this ready to go?

@ncharlton02

Copy link
Copy Markdown
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

@kvark kvark left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

bors r+

@bors

bors Bot commented Apr 2, 2021

Copy link
Copy Markdown
Contributor

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