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 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//! for a hand-written `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`], [`material::RenderPipeline`], [`buffers::BindGroup`],
16//! ...) instead of raw `wgpu` ones — chained `.method(...)` calls that fold
17//! in bookkeeping (duplicate `@binding(N)` detection, dynamic-offset
18//! alignment) a hand-written descriptor won't give you for free.
19//!
20//! Pass and dispatch recording are opaque too:
21//! [`ActiveFrame::begin_pass`](crate::rendering::active_frame::ActiveFrame::begin_pass)
22//! hands back a [`render_pass::RenderPass`] (not a raw `wgpu::RenderPass`),
23//! and [`WGPUBackend::create_command_encoder`](backend::WGPUBackend::create_command_encoder)/
24//! [`CommandEncoder::compute_pass`](compute_pass::CommandEncoder::compute_pass)
25//! cover standalone compute dispatch the same way. `WGPUBackend`'s
26//! `device`/`queue`/`surface` fields are `pub(crate)` — every builder here
27//! takes `&WGPUBackend` directly instead — and even the *value* types
28//! (texture formats, shader stages, buffer/texture usage flags, blend and
29//! depth/stencil state, vertex formats) are mirrored as Pebble's own types
30//! ([`texture_format::TextureFormat`], [`flags::ShaderStages`], ...)
31//! rather than re-exporting `wgpu`'s. Nothing in this module's public
32//! surface names a raw `wgpu::*` type.
33
34pub mod backend;
35pub mod binding;
36pub mod buffer;
37pub mod buffers;
38pub mod compute;
39pub mod compute_pass;
40pub mod cubemap;
41pub mod flags;
42mod gpu_context;
43pub mod instance;
44pub mod layout;
45pub mod material;
46pub mod mesh;
47pub mod mipmap;
48mod plugin_macros;
49#[cfg(feature = "profiler")]
50pub mod profiler;
51pub mod prelude;
52pub mod render_bundle;
53pub mod render_pass;
54pub mod samplers;
55pub mod texture_array;
56pub mod texture_format;
57pub mod texture_view;
58pub mod textures;
59#[cfg(test)]
60pub(crate) mod test_util;
61pub mod vertex_format;
62pub mod window;