Skip to main content

Crate agpu

Crate agpu 

Source
Expand description

§agpu — Standalone Agentic-First GPU Backend

A standalone wgpu replacement with built-in ontology for agent discoverability. Supports Vulkan (preferred), OpenGL/GLES, and platform-default backends with automatic fallback.

§Architecture

┌────────────────────────────────────────────────┐
│  AgpuApp<M: Model>                             │
│  ├── GpuContext (instance/adapter/device/queue) │
│  ├── ShapeRenderer (batched 2D geometry)        │
│  ├── TextEngine (glyphon GPU text)              │
│  ├── AgpuPainter (Painter trait impl)           │
│  └── OntologyRegistry (agent discoverability)   │
└────────────────────────────────────────────────┘

§Quick Start

use agpu::prelude::*;

struct MyApp;
// impl Model for MyApp { ... }

fn main() {
    AgpuApp::new(MyApp).run().unwrap();
}

Re-exports§

pub use core::Color;
pub use core::FontWeight;
pub use core::Margin;
pub use core::Position;
pub use core::Rect;
pub use core::Size;
pub use core::TextStyle;
pub use context::GpuContext;
pub use context::GpuError;
pub use types::BackendPreference;
pub use resource::GpuBindGroup;
pub use resource::GpuBindGroupLayout;
pub use resource::GpuBuffer;
pub use resource::GpuComputePipeline;
pub use resource::GpuPipelineLayout;
pub use resource::GpuQuerySet;
pub use resource::GpuRenderPipeline;
pub use resource::GpuSampler;
pub use resource::GpuShaderModule;
pub use resource::GpuTexture;
pub use resource::GpuTextureView;
pub use resource::ShaderSourceKind;
pub use command::GpuCommandBuffer;
pub use command::GpuCommandEncoder;
pub use command::GpuComputePass;
pub use command::GpuRenderPass;
pub use surface::GpuSurface;
pub use surface::GpuSurfaceTexture;
pub use app::AgpuApp;
pub use event::convert_window_event;
pub use ontology::gpu::AgpuAppOntology;
pub use ontology::gpu::PipelineOntology;
pub use ontology::gpu::ShapeRendererOntology;
pub use ontology::gpu::SurfaceOntology;
pub use ontology::gpu::TextEngineOntology;
pub use painter::AgpuPainter;
pub use renderer::ShapeRenderer;
pub use text::TextEngine;
pub use vertex::Vertex;
pub use ontology::Accessibility;
pub use ontology::AgentAction;
pub use ontology::AgentCapability;
pub use ontology::Discoverable;
pub use ontology::NodeBounds;
pub use ontology::OntologyRegistry;
pub use ontology::SemanticRole;
pub use ontology::UiNode;
pub use ontology::UiTree;
pub use ontology::WidgetSchema;
pub use paint::Gradient;
pub use paint::GradientStop;
pub use paint::ImageHandle;
pub use paint::NullPainter;
pub use paint::Painter;
pub use paint::Shadow;
pub use runtime::CancellationToken;
pub use runtime::Command;
pub use runtime::Frame;
pub use runtime::Model;
pub use runtime::ProgramOptions;
pub use runtime::Router;
pub use runtime::Subscription;
pub use event::DragDropEvent;
pub use event::DragDropKind;
pub use event::DragPayload;
pub use event::Event;
pub use event::HitMap;
pub use event::KeyCode;
pub use event::KeyEvent;
pub use event::KeyEventKind;
pub use event::KeyModifiers;
pub use event::MouseButton;
pub use event::MouseEvent;
pub use event::MouseEventKind;
pub use types::*;

Modules§

accessibility
Accessibility — platform accessibility integration.
animation
Animation framework — declarative animations with easing functions.
app
Application runner — the agpu equivalent of eframe’s run_native.
command
Command encoding — wrappers for command encoder, render pass, and compute pass that keep the API within the agpu type system.
compute
Compute shader support — general-purpose GPU compute through the ontology.
context
GPU context — Vulkan-first device initialisation and resource factory.
core
Core geometry and style types for agpu.
event
Event system and winit conversion for agpu.
layout
Layout engine for agpu — composable layout algorithms.
multiwindow
Multi-window support — manage multiple windows from a single application.
ontology
Ontology — Agent Discoverability System
paint
Backend-agnostic 2D painting interface.
painter
AgpuPainter — implements crate::paint::Painter using wgpu.
plugin
Plugin system — loadable extensions for widgets and renderers.
prelude
Prelude — import everything commonly needed.
renderer
2D shape renderer — batches geometry into vertex/index buffers.
resource
GPU resource wrappers — first-class agpu types for every GPU object.
runtime
Elm-architecture runtime for agpu applications.
scene3d
Basic 3D scene support — camera, meshes, and lighting.
surface
GPU surface — the swapchain / presentation target wrapping the platform window surface.
text
Text rendering via glyphon — GPU-accelerated glyph rasterisation.
theme
Theming — complete theme system with dark/light modes and custom palettes.
types
Core GPU types — agpu’s own type system replacing direct wgpu dependency.
vertex
Vertex types for the agpu shape renderer.
widget
Widget library for agpu — reusable UI components.