summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
Diffstat (limited to 'wgpu')
-rw-r--r--wgpu/Cargo.toml3
-rw-r--r--wgpu/README.md4
-rw-r--r--wgpu/src/image/raster.rs2
-rw-r--r--wgpu/src/text.rs10
-rw-r--r--wgpu/src/window/compositor.rs9
5 files changed, 19 insertions, 9 deletions
diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml
index f4c4fa2c..b4173413 100644
--- a/wgpu/Cargo.toml
+++ b/wgpu/Cargo.toml
@@ -2,7 +2,7 @@
name = "iced_wgpu"
version = "0.4.0"
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
-edition = "2018"
+edition = "2021"
description = "A wgpu renderer for Iced"
license = "MIT AND OFL-1.1"
repository = "https://github.com/iced-rs/iced"
@@ -25,6 +25,7 @@ canvas = ["iced_graphics/canvas"]
qr_code = ["iced_graphics/qr_code"]
default_system_font = ["iced_graphics/font-source"]
spirv = ["wgpu/spirv"]
+webgl = ["wgpu/webgl"]
[dependencies]
wgpu = "0.12"
diff --git a/wgpu/README.md b/wgpu/README.md
index eda0ba46..50440baf 100644
--- a/wgpu/README.md
+++ b/wgpu/README.md
@@ -2,7 +2,7 @@
[![Documentation](https://docs.rs/iced_wgpu/badge.svg)][documentation]
[![Crates.io](https://img.shields.io/crates/v/iced_wgpu.svg)](https://crates.io/crates/iced_wgpu)
[![License](https://img.shields.io/crates/l/iced_wgpu.svg)](https://github.com/iced-rs/iced/blob/master/LICENSE)
-[![project chat](https://img.shields.io/badge/chat-on_zulip-brightgreen.svg)](https://iced.zulipchat.com)
+[![Discord Server](https://img.shields.io/discord/628993209984614400?label=&labelColor=6A7EC2&logo=discord&logoColor=ffffff&color=7389D8)](https://discord.gg/3xZJ65GAhd)
`iced_wgpu` is a [`wgpu`] renderer for [`iced_native`]. For now, it is the default renderer of Iced in native platforms.
@@ -21,7 +21,7 @@ Currently, `iced_wgpu` supports the following primitives:
[documentation]: https://docs.rs/iced_wgpu
[`iced_native`]: ../native
-[`wgpu`]: https://github.com/gfx-rs/wgpu-rs
+[`wgpu`]: https://github.com/gfx-rs/wgpu
[WebGPU API]: https://gpuweb.github.io/gpuweb/
[`wgpu_glyph`]: https://github.com/hecrj/wgpu_glyph
diff --git a/wgpu/src/image/raster.rs b/wgpu/src/image/raster.rs
index e13987b4..ec5e911f 100644
--- a/wgpu/src/image/raster.rs
+++ b/wgpu/src/image/raster.rs
@@ -163,8 +163,6 @@ impl Operation {
where
R: std::io::BufRead + std::io::Seek,
{
- use std::convert::TryFrom;
-
let exif = exif::Reader::new().read_from_container(reader)?;
Ok(exif
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs
index 336696ee..45f1f2de 100644
--- a/wgpu/src/text.rs
+++ b/wgpu/src/text.rs
@@ -48,11 +48,15 @@ impl Pipeline {
.expect("Load fallback font")
});
- let draw_brush =
+ let draw_brush_builder =
wgpu_glyph::GlyphBrushBuilder::using_font(font.clone())
.initial_cache_size((2048, 2048))
- .draw_cache_multithread(multithreading)
- .build(device, format);
+ .draw_cache_multithread(multithreading);
+
+ #[cfg(target_arch = "wasm32")]
+ let draw_brush_builder = draw_brush_builder.draw_cache_align_4x4(true);
+
+ let draw_brush = draw_brush_builder.build(device, format);
let measure_brush =
glyph_brush::GlyphBrushBuilder::using_font(font).build();
diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs
index 3b264475..6feb795b 100644
--- a/wgpu/src/window/compositor.rs
+++ b/wgpu/src/window/compositor.rs
@@ -48,6 +48,13 @@ impl Compositor {
.as_ref()
.and_then(|surface| surface.get_preferred_format(&adapter))?;
+ #[cfg(target_arch = "wasm32")]
+ let limits = wgpu::Limits::downlevel_webgl2_defaults()
+ .using_resolution(adapter.limits());
+
+ #[cfg(not(target_arch = "wasm32"))]
+ let limits = wgpu::Limits::default();
+
let (device, queue) = adapter
.request_device(
&wgpu::DeviceDescriptor {
@@ -57,7 +64,7 @@ impl Compositor {
features: wgpu::Features::empty(),
limits: wgpu::Limits {
max_bind_groups: 2,
- ..wgpu::Limits::default()
+ ..limits
},
},
None,