Crate iced::widget::shader::wgpu

Available on crate feature wgpu only.
Expand description

A cross-platform graphics and compute library based on WebGPU.

To start using the API, create an Instance.

§Feature flags


⚠️ WIP: Not all backends can be manually configured today. On Windows & Linux the Vulkan & GLES backends are always enabled. See #3514 for more details.

  • dx12 (enabled by default) — Enables the DX12 backend on Windows.
  • metal (enabled by default) — Enables the Metal backend on macOS & iOS.
  • webgpu (enabled by default) — Enables the WebGPU backend on Wasm. Disabled when targeting emscripten.
  • angle — Enables the GLES backend via ANGLE on macOS.
  • vulkan-portability — Enables the Vulkan backend on macOS & iOS.
  • webgl — Enables the GLES backend on Wasm.
    • ⚠️ WIP: Currently will also enable GLES dependencies on any other targets.

Note: In the documentation, if you see that an item depends on a backend, it means that the item is only available when that backend is enabled and the backend is supported on the current platform.

§Shading language support

  • wgsl (enabled by default) — Enable accepting WGSL shaders as input.
  • spirv — Enable accepting SPIR-V shaders as input.
  • glsl — Enable accepting GLSL shaders as input.
  • naga-ir — Enable accepting Naga IR shaders as input.

§Logging & Tracing

The following features do not have any effect on the WebGPU backend.

  • strict_asserts — Apply run-time checks, even in release builds. These are in addition to the validation carried out at public APIs in all builds.
  • api_log_info — Log all API entry points at info instead of trace level.
  • trace — Allow writing of trace capture files. See Adapter::request_device.
  • replay — Allow deserializing of trace capture files that were written with the trace feature. To replay a trace file use the wgpu player.


  • fragile-send-sync-non-atomic-wasm — Implement Send and Sync on Wasm, but only if atomics are not enabled.

    WebGL/WebGPU objects can not be shared between threads. However, it can be useful to artificially mark them as Send and Sync anyways to make it easier to write cross-platform code. This is technically very unsafe in a multithreaded environment, but on a wasm binary compiled without atomics we know we are definitely not in a multithreaded environment.

§Feature Aliases

These features aren’t actually features on the crate itself, but a convenient shorthand for complicated cases.

  • wgpu_core — Enabled when there is any non-webgpu backend enabled on the platform.
  • naga –– Enabled when any non-wgsl shader input is enabled.


  • This library safely implements WebGPU on native platforms. It is designed for integration into browsers, as well as wrapping into other language-specific user-friendly libraries.
  • This library describes the internal unsafe graphics abstraction API. It follows WebGPU for the most part, re-using wgpu-types, with the following deviations:
  • Interoperability library for Rust Windowing applications.
  • Utility structures and functions that are built on top of the main wgpu API.






Type Aliases§