Skip to main content

agpu/
lib.rs

1//! # agpu — Standalone Agentic-First GPU Backend
2//!
3//! A standalone wgpu replacement with built-in ontology for agent
4//! discoverability. Supports Vulkan (preferred), OpenGL/GLES, and
5//! platform-default backends with automatic fallback.
6//!
7//! ## Architecture
8//!
9//! ```text
10//! ┌────────────────────────────────────────────────┐
11//! │  AgpuApp<M: Model>                             │
12//! │  ├── GpuContext (instance/adapter/device/queue) │
13//! │  ├── ShapeRenderer (batched 2D geometry)        │
14//! │  ├── TextEngine (glyphon GPU text)              │
15//! │  ├── AgpuPainter (Painter trait impl)           │
16//! │  └── OntologyRegistry (agent discoverability)   │
17//! └────────────────────────────────────────────────┘
18//! ```
19//!
20//! ## Quick Start
21//!
22//! ```rust,ignore
23//! use agpu::prelude::*;
24//!
25//! struct MyApp;
26//! // impl Model for MyApp { ... }
27//!
28//! fn main() {
29//!     AgpuApp::new(MyApp).run().unwrap();
30//! }
31//! ```
32
33pub mod accessibility;
34pub mod animation;
35pub mod app;
36pub mod command;
37pub mod compute;
38pub mod context;
39pub mod core;
40pub mod event;
41pub mod layout;
42pub mod multiwindow;
43pub mod ontology;
44pub mod paint;
45pub mod painter;
46pub mod plugin;
47pub mod renderer;
48pub mod resource;
49pub mod runtime;
50pub mod scene3d;
51pub mod surface;
52pub mod text;
53pub mod theme;
54pub mod types;
55pub mod vertex;
56pub mod widget;
57
58// ── Public API re-exports ───────────────────────────────────────────
59
60// Core geometry and style types
61pub use core::{Color, FontWeight, Margin, Position, Rect, Size, TextStyle};
62
63// Core context and errors
64pub use context::{GpuContext, GpuError};
65pub use types::BackendPreference;
66
67// Resource types
68pub use resource::{
69    GpuBindGroup, GpuBindGroupLayout, GpuBuffer, GpuComputePipeline, GpuPipelineLayout,
70    GpuQuerySet, GpuRenderPipeline, GpuSampler, GpuShaderModule, GpuTexture, GpuTextureView,
71    ShaderSourceKind,
72};
73
74// Command encoding
75pub use command::{GpuCommandBuffer, GpuCommandEncoder, GpuComputePass, GpuRenderPass};
76
77// Surface
78pub use surface::{GpuSurface, GpuSurfaceTexture};
79
80// Type re-exports (users import from agpu instead of wgpu)
81pub use types::*;
82
83// Application and rendering
84pub use app::AgpuApp;
85pub use event::convert_window_event;
86pub use ontology::gpu::{
87    AgpuAppOntology, PipelineOntology, ShapeRendererOntology, SurfaceOntology, TextEngineOntology,
88};
89pub use painter::AgpuPainter;
90pub use renderer::ShapeRenderer;
91pub use text::TextEngine;
92pub use vertex::Vertex;
93
94// Ontology (agent discoverability)
95pub use ontology::{
96    Accessibility, AgentAction, AgentCapability, Discoverable, NodeBounds, OntologyRegistry,
97    SemanticRole, UiNode, UiTree, WidgetSchema,
98};
99
100// Paint trait
101pub use paint::{Gradient, GradientStop, ImageHandle, NullPainter, Painter, Shadow};
102
103// Runtime (Elm architecture)
104pub use runtime::{CancellationToken, Command, Frame, Model, ProgramOptions, Router, Subscription};
105
106// Event system
107pub use event::{
108    DragDropEvent, DragDropKind, DragPayload, Event, HitMap, KeyCode, KeyEvent, KeyEventKind,
109    KeyModifiers, MouseButton, MouseEvent, MouseEventKind,
110};
111
112/// Prelude — import everything commonly needed.
113pub mod prelude {
114    pub use crate::app::AgpuApp;
115    pub use crate::core::{Color, FontWeight, Margin, Position, Rect, Size, TextStyle};
116    pub use crate::event::{
117        Event, KeyCode, KeyEvent, KeyModifiers, MouseButton, MouseEvent, MouseEventKind,
118    };
119    pub use crate::ontology::{
120        AgentAction, AgentCapability, Discoverable, OntologyRegistry, SemanticRole, UiNode,
121        WidgetSchema,
122    };
123    pub use crate::paint::{NullPainter, Painter, Shadow};
124    pub use crate::runtime::{Command, Frame, Model, ProgramOptions};
125    pub use crate::types::BackendPreference;
126}