Skip to main content

pebble/wgpu/
mod.rs

1//! A ready-to-use `wgpu` [`Backend`](crate::rendering::backend::Backend)
2//! implementation ([`backend::WGPUPlugin`]), plus a higher-level
3//! descriptor-based material/mesh/texture/compute layer built on top of it
4//! so most apps never touch raw `wgpu` types directly.
5//!
6//! Building something this layer doesn't already cover (a camera, a custom
7//! compute buffer, anything constructed by hand inside a
8//! [`LazyResource`](crate::assets::singleton_asset::LazyResource)/
9//! [`Asset`](crate::assets::upload::Asset) impl)? Start with
10//! [`prelude`] — `use pebble::wgpu::prelude::*;` — rather than reaching
11//! straight for `backend.device.create_*`/`wgpu::*Descriptor`: the
12//! [`binding`] and [`buffers`] modules it re-exports are all builders
13//! (`BindGroupLayoutBuilder`, `BufferBuilder`, `BindGroupBuilder`, ...)
14//! producing opaque types ([`buffer::Buffer`], [`textures::GPUTexture`],
15//! [`samplers::Sampler`], ...) instead of raw `wgpu` ones — chained
16//! `.method(...)` calls that fold in bookkeeping (duplicate `@binding(N)`
17//! detection, dynamic-offset alignment) a hand-written descriptor won't give
18//! you for free.
19//!
20//! **Not yet opaque** (raw `wgpu` types still appear in these signatures):
21//! [`mesh::GPUMesh`]'s vertex/index buffers, [`material::GPUMaterial`]/
22//! [`compute::GPUCompute`]'s pipelines, [`instance::GPUBindingInstance`]'s
23//! bind group, and pass/dispatch recording itself
24//! (`active.begin_pass(...)` still hands back a raw `wgpu::RenderPass`).
25//! All of these flow directly into `wgpu::RenderPass`/`wgpu::ComputePass`
26//! calls, which aren't wrapped yet — wrapping the resources that feed them
27//! without also wrapping the pass-recording API itself would leave no way
28//! to actually use them. Tracked as a follow-up phase.
29
30pub mod backend;
31pub mod binding;
32pub mod buffer;
33pub mod buffers;
34pub mod compute;
35pub mod cubemap;
36mod gpu_context;
37pub mod instance;
38pub mod layout;
39pub mod material;
40pub mod mesh;
41pub mod mipmap;
42mod plugin_macros;
43#[cfg(feature = "profiler")]
44pub mod profiler;
45pub mod prelude;
46pub mod samplers;
47pub mod texture_array;
48pub mod textures;
49#[cfg(test)]
50pub(crate) mod test_util;
51pub mod window;