//! DINOv3 inference on Meta Quest, via Blade for graphics and Meganeura //! for the network. //! //! The camera image is encoded to DINOv3 patch features and those features //! are turned back into something viewable, so the user sees the world //! through a DINO roundtrip. //! //! # Layout //! //! * [`dinov3`] — the encoder as a meganeura graph, plus its config. //! * [`preprocess`] — image to patch tensor, with the flattening order the //! folded patch-embedding matmul requires. //! * [`weights`] — binding a HuggingFace checkpoint to graph parameters. //! * [`bench`] — throughput measurement, shared by the desktop and //! on-device entry points. //! //! # Sharing one GPU context //! //! The renderer and the network run on a *single* //! `blade_graphics::Context`, created here and handed to meganeura through //! `SessionConfig::gpu`. That is why this crate pins the same //! blade-graphics revision meganeura does — two copies of the crate would //! make the `Arc` types incompatible. It also means no //! external-memory interop is needed: `Session::input_buffer` hands back a //! `BufferPiece` a render pass can write to directly. pub mod bench; #[cfg(target_os = "android")] pub mod camera; pub mod decoder; pub mod dinov3; pub mod inference; pub mod pca; pub mod preprocess; pub mod render; pub mod source; pub mod weights; use std::sync::Arc; /// Create the GPU context that both the renderer and inference will share. /// /// `xr` stays `None` for headless compute (the benchmark); the XR path /// fills in an `XrDesc` and everything downstream is unchanged. pub fn init_context( xr: Option, ) -> Result, blade_graphics::NotSupportedError> { let context = unsafe { blade_graphics::Context::init(blade_graphics::ContextDesc { presentation: false, xr, ray_tracing: false, // Validation layers are not present on a retail Quest, and // they cost real time where we can least afford it. validation: cfg!(debug_assertions) && !cfg!(target_os = "android"), timing: false, capture: false, overlay: false, device_id: None, }) }?; let info = context.device_information(); log::info!( "GPU: {} ({}), driver {}", info.device_name, info.driver_name, info.driver_info ); Ok(Arc::new(context)) }