1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// SPDX-License-Identifier: MIT OR Apache-2.0
//! # scry-gpu
//!
//! Lightweight GPU compute for Rust — dispatch shaders without the graphics baggage.
//!
//! scry-gpu is a compute-only GPU abstraction. No render passes, no swapchains,
//! no framebuffers. Upload data, dispatch a WGSL shader, read results back.
//!
//! ## Quick start
//!
//! ```ignore
//! use scry_gpu::Device;
//!
//! let gpu = Device::auto()?;
//!
//! let input = gpu.upload(&[1.0f32, 2.0, 3.0, 4.0])?;
//! let output = gpu.alloc::<f32>(4)?;
//!
//! gpu.dispatch("@group(0) @binding(0) var<storage, read> input: array<f32>;
//! @group(0) @binding(1) var<storage, read_write> output: array<f32>;
//! @compute @workgroup_size(64)
//! fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
//! let i = gid.x;
//! if i < arrayLength(&input) {
//! output[i] = input[i] * 2.0;
//! }
//! }", &[&input, &output], 4)?;
//!
//! let result: Vec<f32> = output.download()?;
//! assert_eq!(result, vec![2.0, 4.0, 6.0, 8.0]);
//! ```
//!
//! ## Design principles
//!
//! - **Compute only.** No graphics API surface. This keeps the dependency tree
//! small and the API surface minimal.
//! - **Auto-dispatch.** Workgroup dimensions are calculated from your invocation
//! count and the shader's `@workgroup_size`. No manual `ceil(n / 64)`.
//! - **Typed buffers.** `Buffer<f32>` uploads `&[f32]` and downloads `Vec<f32>`.
//! Staging, alignment, and synchronization are handled internally.
//! - **Backend abstraction.** Vulkan today, Metal tomorrow. The public API
//! doesn't change.
pub use Batch;
pub use ;
pub use ;
pub use DispatchConfig;
pub use ;
pub use Kernel;
pub use Ticket;