Add WebGPU Wasm bindings and BitonicSortWasm demo#73
Merged
Conversation
I'm not sure if we actually need @js macros here yet.
There is nothing JavaScriptKit-dependent about these, so we'll want a better strategy for generating these later.
Some depend on GPU types we haven't created yet. Those will be next.
Not sure this is still required, but we needed it at some point.
…emo code. Note that some are decorated with @_spi(Experimental) to work around build issues. This also results in demo code needing to import things with the same decoration.
Currently doesn't properly render.
…Layout list must be an empty array if ommitted, not nil.
…at were previously required.
cuberoot
reviewed
Feb 22, 2026
|
|
||
| ## Why these files are committed | ||
|
|
||
| The `bridge-js` plugin is a development-time tool, not a build-time plugin. It does not run automatically during `swift build`. If the generated files aren't checked in, anyone cloning the repo would need to run the plugin manually before they could build the `WebGPUWasm` target. |
Collaborator
There was a problem hiding this comment.
For other projects to use Swan as a dependency, we need the files checked in. I'm wondering if there's any way we can detect when they are out-of-date in CI or something?
Collaborator
Author
There was a problem hiding this comment.
Yes, these are checked in. I'd like to see how the workflow ends up working for folks before adding more automation, but I agree that it may be necessary.
cuberoot
approved these changes
Feb 22, 2026
Collaborator
cuberoot
left a comment
There was a problem hiding this comment.
This looks like a great step forward. Unifying the APIs will be challenging, but it's great to have this stepping stone.
daskruegge
approved these changes
Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@JSClass/@JSFunction/@JSGettermacros to wrap browser WebGPU APIs (device, pipelines, buffers, encoders, bind groups, textures, etc.). Note that these are manually-coded bindings, and we may migrate to codegen'd bindings in the future. This is just enough to get the demo working.BitonicSortWasmdemo, ported from the nativeBitonicSortdemo. This demo can be built and run via:WebGPUWasminto the existingWebGPUumbrella target, so consumers canimport WebGPUon both native and WasmNote that the BitonicSortWasm code is copied-and-tweaked from the native version. Next step is to unify the code between the two as much as possible.
Types of changes
Checklist: