Expand description
GPU rendering with ordered scenes, reusable renderers, and window/offscreen targets.
Collect changing objects in a Scene, then draw through Target::render_iter.
For unchanged content, Scene::bake produces a BakedScene that reuses its
instance buffers across frames and cameras. See those types for painter order,
resource lifetimes, and rebaking rules.
Target::camera supplies aspect-correct coordinates; Target::physical_camera
uses physical pixels. AutoScene provides automatic rendering on normal drop.
Target::viewport borrows a clipped rectangle with its own camera coordinates
for previews, split-screen views, and nested drawing areas.
§Custom and headless rendering
Use Graphics::device and Graphics::queue for direct wgpu access. Implement
Renderer<C> to encode drawing in a supplied render pass and Context for
shared bindings. Target abstracts window frames and Offscreen textures.
Graphics::new wraps a supplied adapter/device/queue for headless applications.
The facade’s raw_wgpu example demonstrates a custom pipeline.
Modules§
Macros§
Structs§
- Auto
Scene - A scene borrowing its target and rendering on normal drop.
Use
Self::renderfor an explicit boundary orSelf::discardto abandon it. Panic unwinding does not render. Finish the scene’s borrow before presenting the enclosing frame. - Baked
Scene - Renderer snapshot with fixed instance buffers and resource bindings.
- Camera
- Config
- Surface presentation and GPU device requirements.
- Depth
Buffer - Reusable depth attachment. Recreate it when the target size changes. Clear to 1 before its first use and at the beginning of each new scene/frame.
- Error
- The
Errortype, a wrapper around a dynamic error type. - Frame
- Graphics
- Offscreen
- Reusable render target without a window. Submitted pixels can be sampled or
copied from
Offscreen::texture. Resize by constructing a new target. - Ordered
- Scene
- Painter-ordered collection of drawing instances.
- Surface
- Viewport
- A borrowed rectangle of a render target, created by
Target::viewport.
Enums§
- Depth
Mode - Depth policy for a drawable. Smaller projected depth is nearer.
- Present
Mode - Timing and queueing with which frames are actually displayed to the user.
- Viewport
Error - Invalid viewport rectangle. The parent remains usable after an error.
Constants§
- DEPTH_
FORMAT - Depth format used by built-in targets and pipelines (including WebGL2).
Traits§
- AnyResource
- AnyStorage
- Context
- Instance
- Single instance to draw.
- Instance
Visitor - Object
- Renderer
- Encodes drawing in a target-configured pass. Custom renderers must preserve its viewport and scissor state so borrowed targets retain their bounds.
- Resource
- Shared resource required to draw an instance.
- Storage
- Target
- Color and depth render target. All built-in targets use
crate::DEPTH_FORMAT.clearresets color and depth; successive render calls share depth. Clear depth explicitly when starting an independent camera/overlay scene. Custom pipelines used byrendermust declare the same depth format, even when ignoring depth (seecrate::DepthMode::Overlay). Borrow aViewportto draw into a smaller rectangle without allocating another render texture.