iris/gpu/mod.rs
1/// Custom GPU pipeline/kernel compilation abstractions (e.g. for WebGPU or CUDA).
2pub struct GpuContext {
3 pub enabled: bool,
4}
5
6impl GpuContext {
7 #[must_use]
8 pub fn new() -> Self {
9 Self { enabled: true }
10 }
11
12 /// Queries if acceleration is supported by the active device.
13 #[must_use]
14 pub fn is_accelerated(&self) -> bool {
15 self.enabled
16 }
17}
18
19impl Default for GpuContext {
20 fn default() -> Self {
21 Self::new()
22 }
23}
24
25#[cfg(test)]
26mod tests {
27 use super::*;
28
29 #[test]
30 fn test_gpu_context() {
31 let ctx = GpuContext::default();
32 assert!(ctx.is_accelerated());
33 }
34}