Fix surface creation cfgs in example framework. (#3246)

This commit is contained in:
Jim Blandy 2022-11-30 13:46:24 -08:00 committed by GitHub
parent a9d33193b3
commit 9c6a60d97c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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)

View File

@ -163,9 +163,9 @@ async fn setup<E: Example>(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");