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//! 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`], [`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. `backend.device`/
26//! `backend.queue` are still there for the handful of operations this
27//! module doesn't wrap (submitting an encoder built some other way, a
28//! resource shape [`texture_view::TextureBuilder`] doesn't cover) — but
29//! everything that's a *handle* (buffer, texture, sampler, pipeline, bind
30//! group, layout, pass, encoder) is opaque.
31
32pub mod backend;
33pub mod binding;
34pub mod buffer;
35pub mod buffers;
36pub mod compute;
37pub mod compute_pass;
38pub mod cubemap;
39mod gpu_context;
40pub mod instance;
41pub mod layout;
42pub mod material;
43pub mod mesh;
44pub mod mipmap;
45mod plugin_macros;
46#[cfg(feature = "profiler")]
47pub mod profiler;
48pub mod prelude;
49pub mod render_pass;
50pub mod samplers;
51pub mod texture_array;
52pub mod texture_view;
53pub mod textures;
54#[cfg(test)]
55pub(crate) mod test_util;
56pub mod window;