1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

eframe support for wgpu on the web (#2107)

* basic working wgpu @ webgl on websys

* fix glow compile error

* introduced WebPainter trait, provide wgpu renderstate

* WebPainterWgpu destroy implemented

* make custom3d demo work on wgpu backend

* changelog entry for wgpu support eframe wasm

* remove temporary logging hack

* stop using pollster for web
we're actually not allowed to block - this only worked because wgpu on webgl doesn't actually cause anything blocking. However, when trying webgpu this became an issue

* revert cargo update

* compile error if neither glow nor wgpu features are enabled

* code cleanup

* Error handling

* Update changelog with link

* Make sure --all-features work

* Select best framebuffer format from the available ones

* update to wasm-bindgen 0.2.83

* Fix typo

* Clean up Cargo.toml

* Log about using the wgpu painter

* fixup wgpu labels

* fix custom3d_wgpu_shader ub padding

* remove duplicated uniforms struct in wgsl shader for custom3d

* Update docs: add async/await to the web 'start' function

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
Andreas Reich
2022-10-05 20:14:18 +02:00
committed by GitHub
parent c441f33ecf
commit c2a37f4bd8
20 changed files with 432 additions and 211 deletions

View File

@@ -57,7 +57,7 @@ screen_reader = [
## Use [`wgpu`](https://docs.rs/wgpu) for painting (via [`egui-wgpu`](https://github.com/emilk/egui/tree/master/crates/egui-wgpu)).
## This overrides the `glow` feature.
wgpu = ["dep:wgpu", "egui-wgpu"]
wgpu = ["dep:wgpu", "dep:egui-wgpu"]
[dependencies]
@@ -72,23 +72,23 @@ tracing = { version = "0.1", default-features = false, features = ["std"] }
document-features = { version = "0.2", optional = true }
egui_glow = { version = "0.19.0", path = "../egui_glow", optional = true, default-features = false }
egui-wgpu = { version = "0.19.0", path = "../egui-wgpu", optional = true, features = ["winit"] }
glow = { version = "0.11", optional = true }
ron = { version = "0.8", optional = true, features = ["integer128"] }
serde = { version = "1", optional = true, features = ["derive"] }
wgpu = { version = "0.13", optional = true }
# -------------------------------------------
# native:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
dark-light = { version = "0.2.1", optional = true }
egui-winit = { version = "0.19.0", path = "../egui-winit", default-features = false, features = ["clipboard", "links"] }
glutin = { version = "0.29.0" }
winit = "0.27.2"
# optional native:
puffin = { version = "0.13", optional = true }
dark-light = { version = "0.2.1", optional = true }
directories-next = { version = "2", optional = true }
egui-wgpu = { version = "0.19.0", path = "../egui-wgpu", optional = true, features = ["winit"] } # if wgpu is used, use it with winit
puffin = { version = "0.13", optional = true }
wgpu = { version = "0.13", optional = true }
# -------------------------------------------
# web:
@@ -142,6 +142,7 @@ web-sys = { version = "0.3.58", features = [
"Window",
] }
# optional
# feature screen_reader
# optional web:
egui-wgpu = { version = "0.19.0", path = "../egui-wgpu", optional = true } # if wgpu is used, use it without (!) winit
tts = { version = "0.20", optional = true } # Can't use 0.21-0.24 due to compilation problems on linux
wgpu = { version = "0.13", optional = true, features = ["webgl"] }