Open-Source Wikis

/

wgpu

/

Crates

/

wgpu-macros

gfx-rs/wgpu

wgpu-macros

wgpu-macros (wgpu-macros/) is a tiny proc-macro crate that re-exports the macro helpers used by the wgpu crate. It exists primarily because proc macros must live in their own crate; in practice the macros are very small.

Purpose

  • Provide compile-time helpers consumed by wgpu/src/macros.rs and wgpu/src/macros/.
  • Keep the macro implementation separate from the main wgpu crate so it doesn't pollute the user-facing dependency surface.

Directory layout

wgpu-macros/
├── Cargo.toml
└── src/                # small, single-file crate

What's inside

The macros are small and focused. They support code generation for vertex layouts and a few include_wgsl!-shaped helpers. The published wgpu::include_wgsl! macro is declared in wgpu/src/macros.rs and may use this crate as a helper.

Integration points

  • Above: wgpu (wgpu/src/macros/ and wgpu/src/macros.rs re-export and use these macros).
  • Below: proc-macro2, quote, syn — the standard proc-macro toolchain.

Entry points for modification

If you need a new macro for wgpu, decide whether it can be implemented as a macro_rules! in wgpu/src/macros.rs (preferred). Procedural macros require a recompilation of this crate even on small edits, so use them sparingly.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

wgpu-macros – wgpu wiki | Factory