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

Fix surface creation cfgs in example framework. #3246

Merged

Conversation

jimblandy
Copy link
Member

@jimblandy jimblandy commented Nov 29, 2022

Expand CI coverage so that we try building wgpu/examples/framework.rs on Emscripten.

The framework.rs library used to check:

#[cfg(not(target_arch = "wasm32"))]

to decide whether to call instance.create_surface or attempt to support creating a surface from an offscreen canvas. This is not correct: emscripten should be be treated as a non-web target; the instance doesn't have a create_surface_from_offscreen_canvas method.

Instead, framework.rs should check:

#[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))]

to treat the Emscripten target like a native target.

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
Link to the issues addressed by this PR, or dependent PRs in other repositories

Description
Describe what problem this is solving, and how it's solved.

Testing
Explain how this change is tested.

@jimblandy jimblandy added the type: bug Something isn't working label Nov 29, 2022
@codecov-commenter
Copy link

codecov-commenter commented Nov 29, 2022

Codecov Report

Merging #3246 (6690567) into master (6d025a9) will increase coverage by 18.48%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           master    #3246       +/-   ##
===========================================
+ Coverage   46.92%   65.40%   +18.48%     
===========================================
  Files          82       82               
  Lines       39422    39451       +29     
===========================================
+ Hits        18499    25804     +7305     
+ Misses      20923    13647     -7276     
Impacted Files Coverage Δ
wgpu-core/src/hub.rs 60.98% <0.00%> (+0.08%) ⬆️
wgpu-core/src/device/queue.rs 70.69% <0.00%> (+0.11%) ⬆️
wgpu-core/src/device/mod.rs 66.62% <0.00%> (+0.25%) ⬆️
wgpu-core/src/instance.rs 65.92% <0.00%> (+0.74%) ⬆️
wgpu-hal/src/lib.rs 26.21% <0.00%> (+0.97%) ⬆️
wgpu-types/src/lib.rs 88.06% <0.00%> (+2.61%) ⬆️
wgpu-core/src/track/buffer.rs 92.14% <0.00%> (+7.27%) ⬆️
wgpu-core/src/track/texture.rs 80.99% <0.00%> (+21.49%) ⬆️
wgpu-hal/src/vulkan/instance.rs 37.60% <0.00%> (+36.56%) ⬆️
wgpu-hal/src/gles/egl.rs 38.00% <0.00%> (+38.00%) ⬆️
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jimblandy jimblandy force-pushed the emscripten-framework-create-surface branch from ebb34ab to c1eacaf Compare November 29, 2022 22:53
Expand CI coverage so that we try building `wgpu/examples/framework.rs` on
Emscripten.

The `framework.rs` library used to check:

    #[cfg(not(target_arch = "wasm32"))]

to decide whether to call `instance.create_surface` or attempt to
support creating a surface from an offscreen canvas. This is not
correct: `emscripten` should be be treated as a non-web target; the
instance doesn't have a `create_surface_from_offscreen_canvas` method.

Instead, `framework.rs` should check:

    #[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))]

to treat the Emscripten target like a native target.
@jimblandy jimblandy force-pushed the emscripten-framework-create-surface branch from c1eacaf to 6690567 Compare November 30, 2022 02:35
@cwfitzgerald cwfitzgerald merged commit 9c6a60d into gfx-rs:master Nov 30, 2022
@jimblandy jimblandy deleted the emscripten-framework-create-surface branch December 13, 2022 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants