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

Update WebGPU #1968

Closed
wants to merge 1 commit into from
Closed

Update WebGPU #1968

wants to merge 1 commit into from

Conversation

525c1e21-bd67-4735-ac99-b4b0e5262290
Copy link

@525c1e21-bd67-4735-ac99-b4b0e5262290 525c1e21-bd67-4735-ac99-b4b0e5262290 commented Jan 21, 2020

Purpose

This PR equips web-sys with an updated WebGPU.webidl (and related interfaces).

The current WebGPU bindings provided by web-sys are severely outdated and should be brought closer into alignment with the draft spec.

Implications

The bindings are working well for me the development of a handful of games and apps and whilst I have not encountered issues using the changes present in this PR, these changes impact the Window and Navigator interfaces and as such are breaking.

Process

  1. Clone latest wasm-bindgen
git clone https://github.com/rustwasm/wasm-bindgen.git
  1. Extract WebGPU.webidl using the tool against the Bikeshed doc. Both are available at https://github.com/gpuweb/gpuweb/blob/master/spec
git clone https://github.com/gpuweb/gpuweb.git
./extract-idl.py gpuweb/spec/index.bs > ~/wasm-bindgen/crates/web-sys/webidls/enabled/WebGPU.idl
  1. Delete crates/web-sys/webidls/enabled/WebGPUExtras.webidl

This was only ever merely an artefact of Mozilla's incomplete implementation.

  1. Remove the WebGPUProvider include from crates/web-sys/webidls/enabled/Window.webidl

WebGPU now exists on the navigator interface as .gpu

  1. Dump an updated list of features
cd ~/wasm-bindgen
__WASM_BINDGEN_DUMP_FEATURES=foo cargo build

This dump is then stitched into wasm-bindgen/creates/web-sys/Cargo.toml

Caveats

I'm not certain the following unintended changes are inert. The eventual merger of this PR should ensure they're not impactful.

  • HtmlHyperlinkElementUtils feature has disappeared
  • WorkletOptions feature has appeared
  • All "WebGPU" interfaces now lack the "Web" prefix

I chose not to continue to use Mozilla's webidl since, whilst it was extracted from the draft using a similar process, their current implementation is incomplete and as such it has been heavily modified (many interfaces commented out, etc.) by hand and isn't useful for targeting the more complete implementations available in Chrome and Safari.

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.

None yet

1 participant