Skip to main content

Crate frust_gpu

Crate frust_gpu 

Source
Expand description

The wgpu adapter/device/surface substrate the render engine builds on.

frust-gpu owns nothing rendering-specific — no scene display list, no strip pipeline, no glifo dependency. Its whole job is the layer directly above wgpu itself: probing what an adapter can actually do (caps::TierCaps) and turning that into the instance, device, surfaces and pooled GPU resources a renderer built on top of it consumes without re-deriving adapter capabilities itself. context::RenderContext is that foundation, and the one frust-render re-exports to its shells.

caps::TierCaps::probe is the only place a real wgpu::Adapter is consulted; every decision built on top of it takes the plain caps::TierCaps value instead, so it stays testable with caps::TierCaps::fake and no GPU in the loop. surface and lifecycle follow the same split: every policy decision they make is a pure function over plain values, and only a handful of named entry points touch a live wgpu::Device or a real window handle.

Re-exports§

pub use arena::BufferSlice;
pub use arena::BufferUploader;
pub use arena::HostBuffer;
pub use caps::DownlevelProfile;
pub use caps::TierCaps;
pub use context::ContextOptions;
pub use context::DeviceHandle;
pub use context::RenderContext;
pub use context::test_device_limits;
pub use diag::GpuFrameSpans;
pub use diag::TimestampRing;
pub use effects::ShaderEffects;
pub use encoder::CommandBuffer;
pub use headless::HeadlessTarget;
pub use lifecycle::AcquireAction;
pub use lifecycle::AcquireOutcome;
pub use lifecycle::AcquireStatus;
pub use lifecycle::EncodeOutcome;
pub use lifecycle::FrameOutcome;
pub use lifecycle::SurfaceEvent;
pub use lifecycle::SurfacePhase;
pub use lint::LintError;
pub use lint::check_limits_against_webgl2;
pub use lint::lint_pipeline_layout;
pub use lint::lint_wgsl_dir;
pub use pipeline::PipelineCache;
pub use pipeline::RenderPipelineDesc;
pub use pipeline::VertexLayout;
pub use pool::PoolKey;
pub use pool::PoolStats;
pub use pool::PooledTexture;
pub use pool::TextureAllocator;
pub use pool::TexturePool;
pub use shader::ShaderId;
pub use shader::ShaderLibrary;
pub use surface::ConfiguredSurface;
pub use surface::DetachedSurface;
pub use surface::SURFACE_FORMATS;
pub use surface::SurfaceAlphaRequest;
pub use surface::SurfaceFactory;
pub use surface::compositor_expects_premultiplied;
pub use texture::Attachment;
pub use texture::ColorAttachment;
pub use texture::DepthAttachment;
pub use texture::RenderTarget;
pub use texture::SceneTextureId;
pub use texture::Texture;
pub use texture::TextureDesc;
pub use texture::TextureId;
pub use texture::TextureRegistry;

Modules§

arena
The per-frame bump arena every small GPU upload goes through: HostBuffer, the BufferSlice it hands back, and the BufferUploader seam that keeps both host-testable.
caps
Adapter capability probing: TierCaps and DownlevelProfile.
context
Instance, adapter and lazy logical-device creation: RenderContext and DeviceHandle.
diag
GPU-side frame diagnostics: TimestampRing, real GPU time per pass.
effects
Offscreen WGSL fragment-shader effects: the GPU half of the shader-showcase feature.
encoder
The seam a 3D pass and the 2D engine share when recording GPU work: CommandBuffer, a thin wrapper around one wgpu::CommandEncoder.
headless
An offscreen render target with no swapchain and no wgpu::Surface: HeadlessTarget, for tests and tooling that need to render through this crate’s own seams (crate::encoder::CommandBuffer) with no window.
lifecycle
Surface lifecycle state machine.
lint
Design rule enforcement: WGSL shader linting and GPU descriptor validation.
pipeline
Render-pipeline variants and the cache that builds them predictably.
pipeline_cache
Framing + validation for a persisted wgpu::PipelineCache blob.
pool
A recycling pool for the short-lived textures a frame renders into: TexturePool, the PooledTexture it hands out, and the TextureAllocator seam that keeps both host-testable.
shader
The WGSL shader module registry: ShaderLibrary and ShaderId.
surface
Swapchain surfaces: creation, cross-thread hand-off, alpha-mode policy and configuration.
texture
Texture handles and render-target descriptors: TextureDesc, Texture, RenderTarget/Attachment, and the two id types a texture crosses a layer boundary under.