Skip to content

egui-wgpu missing wgpu webgpu feature #4123

@ctaggart

Description

@ctaggart

I'm targeting wasm32 and when upgrading the eframe 0.26, it does not compile.

The .cargo/config

[build]
target = "wasm32-unknown-unknown"
rustflags = "--cfg=web_sys_unstable_apis"

From Cargo.toml

eframe = { version = "0.26", default-features = false, features = ["wgpu"] }

Errors with:

   Compiling eframe v0.26.2
error[E0599]: no variant or associated item named `Canvas` found for enum `SurfaceTarget` in the current scope
   --> /Users/cameron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/eframe-0.26.2/src/web/web_painter_wgpu.rs:168:50
    |
168 |             .create_surface(wgpu::SurfaceTarget::Canvas(canvas.clone()))
    |                                                  ^^^^^^ variant or associated item not found in `SurfaceTarget<'_>`

For more information about this error, try `rustc --explain E0599`.

Also the latest from master

eframe = { git = "https://github.com/emilk/egui", branch = "master", default-features = false, features = [
  "wgpu",
] }

Gives the same error:

    Checking eframe v0.26.2 (https://github.com/emilk/egui?branch=master#e29022ef)
error[E0599]: no variant or associated item named `Canvas` found for enum `SurfaceTarget` in the current scope
   --> /Users/cameron/.cargo/git/checkouts/egui-5e4507fa4153be06/e29022e/crates/eframe/src/web/web_painter_wgpu.rs:168:50
    |
168 |             .create_surface(wgpu::SurfaceTarget::Canvas(canvas.clone()))
    |                                                  ^^^^^^ variant or associated item not found in `SurfaceTarget<'_>`
For more information about this error, try `rustc --explain E0599`.

It looks like the webgpu feature of the wgpu crate is no longer selected from egui-wgpu:

https://docs.rs/crate/egui-wgpu/0.26.2/source/Cargo.toml
https://docs.rs/crate/egui-wgpu/0.26.0/source/Cargo.toml

[dependencies.wgpu]
default-features = false
features = ["fragile-send-sync-non-atomic-wasm", "wgsl"]
version = "0.19.1"

Prior, it was not setting default-features = false.

https://docs.rs/crate/egui-wgpu/0.25.0/source/Cargo.toml

[dependencies.wgpu]
features = ["fragile-send-sync-non-atomic-wasm"]
version = "0.18.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions