diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec707a12a6..1ef5164276 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -141,7 +141,11 @@ jobs: set -e # build for Emscripten/WebGL - cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features --features webgl,emscripten + cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal \ + --no-default-features --features webgl,emscripten + + # build cube example + cargo clippy --target ${{ matrix.target }} --example cube --features webgl,emscripten # build raw-gles example cargo clippy --target ${{ matrix.target }} --example raw-gles --features webgl,emscripten diff --git a/CHANGELOG.md b/CHANGELOG.md index 416bc11a66..100cddbe3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -130,6 +130,10 @@ Additionally `Surface::get_default_config` now returns an Option and returns Non zero, rather than treating that as "until the end of the buffer". By @jimblandy in [#3171](https://github.com/gfx-rs/wgpu/pull/3171) +#### Emscripten + +- Let the wgpu examples `framework.rs` compile again under Emscripten. By @jimblandy in [#3246](https://github.com/gfx-rs/wgpu/pull/3246) + ### Examples - Log adapter info in hello example on wasm target by @JolifantoBambla in [#2858](https://github.com/gfx-rs/wgpu/pull/2858) diff --git a/wgpu/examples/framework.rs b/wgpu/examples/framework.rs index 76d2c425ee..122c88170d 100644 --- a/wgpu/examples/framework.rs +++ b/wgpu/examples/framework.rs @@ -163,9 +163,9 @@ async fn setup(title: &str) -> Setup { let (size, surface) = unsafe { let size = window.inner_size(); - #[cfg(not(target_arch = "wasm32"))] + #[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))] let surface = instance.create_surface(&window); - #[cfg(target_arch = "wasm32")] + #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] let surface = { if let Some(offscreen_canvas_setup) = &offscreen_canvas_setup { log::info!("Creating surface from OffscreenCanvas");