2019-11-20 09:41:04 +01:00
# `iced_wgpu`
[][documentation]
[](https://crates.io/crates/iced_wgpu)
2021-12-23 09:34:37 +02:00
[](https://github.com/iced-rs/iced/blob/master/LICENSE)
2022-01-31 21:18:39 +07:00
[](https://discord.gg/3xZJ65GAhd)
2019-11-20 09:41:04 +01:00
2022-10-06 11:22:27 -07:00
`iced_wgpu` is a [`wgpu` ] renderer for [`iced_native` ]. For now, it is the default renderer of Iced on [native platforms].
2019-11-20 09:41:04 +01:00
2022-10-06 09:55:20 -07:00
[`wgpu` ] supports most modern graphics backends: Vulkan, Metal, and DX12 (OpenGL and WebGL are still WIP). Additionally, it will support the incoming [WebGPU API].
2019-11-20 09:41:04 +01:00
Currently, `iced_wgpu` supports the following primitives:
- Text, which is rendered using [`wgpu_glyph` ]. No shaping at all.
- Quads or rectangles, with rounded borders and a solid background color.
- Clip areas, useful to implement scrollables or hide overflowing content.
2020-04-01 02:32:01 +02:00
- Images and SVG, loaded from memory or the file system.
2020-04-02 03:11:16 +02:00
- Meshes of triangles, useful to draw geometry freely.
2019-11-20 09:41:04 +01:00
2020-11-26 07:39:00 +01:00
< p align = "center" >
< img alt = "The native target" src = "../docs/graphs/native.png" width = "80%" >
< / p >
2019-11-20 09:41:04 +01:00
[documentation]: https://docs.rs/iced_wgpu
[`iced_native` ]: ../native
2022-01-22 03:04:35 -06:00
[`wgpu` ]: https://github.com/gfx-rs/wgpu
2022-10-06 11:22:27 -07:00
[native platforms]: https://github.com/gfx-rs/wgpu#supported -platforms
2019-11-20 09:41:04 +01:00
[WebGPU API]: https://gpuweb.github.io/gpuweb/
[`wgpu_glyph` ]: https://github.com/hecrj/wgpu_glyph
2019-11-20 09:56:16 +01:00
## Installation
Add `iced_wgpu` as a dependency in your `Cargo.toml` :
```toml
2023-04-13 08:31:17 +02:00
iced_wgpu = "0.10"
2019-11-20 09:56:16 +01:00
```
__Iced moves fast and the `master` branch can contain breaking changes!__ If
you want to learn about a specific release, check out [the release list].
2021-12-23 09:34:37 +02:00
[the release list]: https://github.com/iced-rs/iced/releases
2019-11-20 09:56:16 +01:00
2019-11-20 09:41:04 +01:00
## Current limitations
2022-10-06 11:22:27 -07:00
The current implementation is quite naive; it uses:
2019-11-20 09:41:04 +01:00
- A different pipeline/shader for each primitive
- A very simplistic layer model: every `Clip` primitive will generate new layers
- _Many_ render passes instead of preparing everything upfront
- A glyph cache that is trimmed incorrectly when there are multiple layers (a [`glyph_brush` ] limitation)
Some of these issues are already being worked on! If you want to help, [get in touch!]
[get in touch!]: ../CONTRIBUTING.md
[`glyph_brush` ]: https://github.com/alexheretic/glyph-brush