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.
This is reimplementation of #2233
--
Added new feature "emscripten", this feature can be used in combination with --target wasm32-unknown-emscripten to build wgpu for emscripten.
raw-gles.rs example now works also with emscripten, to run it:
This PR also adds a workflow to check emscripten build. I think that raw-gles example is only needed example for emscripten integration it also can be a test, but it hard to do it automatically because need to install emcc. I think not worth to doing it.
Typical usage of wgpu and emscripten will be through external gles integration like in raw-gles.rs. Because windows management (like winit) crate not exists for emscripten, so it will be used with some native library like SDL/2+wgpu. SDL will initialize context and controls window/events and wgpu will be used as renderer library.
--
There is 2 identical comments in 2233 that I can't solve:
Ideally we can remove this
#[cfg
because lastelse
is what we actually need. But I can't find good way to jump into last else branch when feature emscripten is set. And egl::EGL1_5 is not defined when feature is emscripten.raw-gles.rs in browser (tested in Chrome an FF):