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 building wgpu with --no-default-feautures on web (wasm32-unknown-unknown) #6946

Merged
merged 4 commits into from
Jan 18, 2025

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Jan 18, 2025

Connections

Description
When building with --no-default-features on web, we have neither wgpu_core nor webgpu meta features enabled. This causes the match expressions not to compile.

A nicer way to solve this would be an empty backend as previously proposed here where @daxpedda made a good case for it.
I was pushing against it back then because of yet-another-place-naming-all-interfaces, but I think I changed my mind on this and this would actually be really useful to have - we could automatically enable the empty-backend when neither webgpu or wgc are enabled and allow it to be added via feature & created explicitly etc.
.... but more on that in another PR. For now I wanted this one to be usable in a patch release!

Testing
Added previously failing check to ci

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@Wumpf Wumpf added the PR: needs back-porting PR with a fix that needs to land on crates label Jan 18, 2025
@Wumpf Wumpf requested a review from a team as a code owner January 18, 2025 14:23
@Wumpf Wumpf changed the title Fix building wgpu --no-default-feautures on web (wasm32-unknown-unknown) builds Fix building wgpu with --no-default-feautures on web (wasm32-unknown-unknown) Jan 18, 2025
@Wumpf Wumpf force-pushed the fix-no-default-features-build branch from c05d6ad to b2550a4 Compare January 18, 2025 14:25
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@cwfitzgerald cwfitzgerald merged commit e2d14c6 into gfx-rs:trunk Jan 18, 2025
30 checks passed
@Wumpf Wumpf deleted the fix-no-default-features-build branch January 18, 2025 21:31
cwfitzgerald pushed a commit that referenced this pull request Jan 23, 2025
…nown-unknown`) (#6946)

* Fix wasm build without features

* silence unused warnings if wgc & webgpu are disabled

* add no-features check for web ci

* add changelog entry
# Conflicts:
#	CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: needs back-porting PR with a fix that needs to land on crates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants