From bb49a22996f39e32c3ced0c2d80c2137aed7a0ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Mon, 4 Sep 2023 03:28:45 +0200 Subject: [PATCH 1/2] Enable WebGPU backend in `wgpu` by default instead of WebGL Instead, we expose a new `webgl` feature. --- Cargo.toml | 2 ++ renderer/Cargo.toml | 1 + wgpu/Cargo.toml | 4 +--- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 71484b7a86..3b2ef547f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,6 +39,8 @@ palette = ["iced_core/palette"] system = ["iced_winit/system"] # Enables broken "sRGB linear" blending to reproduce color management of the Web web-colors = ["iced_renderer/web-colors"] +# Enables the WebGL backend, replacing WebGPU +webgl = ["iced_renderer/webgl"] # Enables the advanced module advanced = [] diff --git a/renderer/Cargo.toml b/renderer/Cargo.toml index 89326d7367..2c88cf31e1 100644 --- a/renderer/Cargo.toml +++ b/renderer/Cargo.toml @@ -17,6 +17,7 @@ svg = ["iced_tiny_skia/svg", "iced_wgpu?/svg"] geometry = ["iced_graphics/geometry", "iced_tiny_skia/geometry", "iced_wgpu?/geometry"] tracing = ["iced_wgpu?/tracing"] web-colors = ["iced_wgpu?/web-colors"] +webgl = ["iced_wgpu?/webgl"] [dependencies] raw-window-handle = "0.5" diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index b0f70220c8..49c626738f 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -12,6 +12,7 @@ geometry = ["iced_graphics/geometry", "lyon"] image = ["iced_graphics/image"] svg = ["resvg"] web-colors = ["iced_graphics/web-colors"] +webgl = ["wgpu/webgl"] [dependencies] wgpu = "0.17" @@ -24,9 +25,6 @@ once_cell = "1.0" rustc-hash = "1.1" log = "0.4" -[target.'cfg(target_arch = "wasm32")'.dependencies] -wgpu = { version = "0.17", features = ["webgl"] } - [dependencies.twox-hash] version = "1.6" default-features = false From 685e44587c8c89be455838d6b96f3b762da836f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Mon, 4 Sep 2023 03:46:41 +0200 Subject: [PATCH 2/2] Enable unstable `web-sys` APIs on CI --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a9a9b3f9ee..ac8d27f91a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,6 +25,8 @@ jobs: web: runs-on: ubuntu-latest + env: + RUSTFLAGS: --cfg=web_sys_unstable_apis steps: - uses: hecrj/setup-rust-action@v1 with: