//! Compile-time constraints that dictate how inference is threaded. //! //! `blade_graphics::Context` is `Send + Sync` — it guards its queue, //! memory manager, and XR session state behind mutexes — so an //! `Arc` can be shared with a worker thread. //! //! `meganeura::Session` is **not** `Send`: it owns a //! `blade_graphics::CommandEncoder`. The single offending field is //! `ScratchBuffer::mapped`, a raw pointer into a persistently mapped //! allocation — everything else is Vulkan handles, which are fine. (Rust has //! no stable way to *assert* a negative, hence a comment not a test.) //! //! That is why [`dinovision::inference`] hands the worker an //! `Arc` and has it construct the session in place. A one-line //! `unsafe impl Send for ScratchBuffer` in blade lifts the constraint — //! verified, and on the `command-encoder-send` branch there. fn assert_send() {} fn assert_sync() {} #[test] fn context_can_be_shared_across_threads() { assert_send::(); assert_sync::(); // Buffer handles carry explicit `unsafe impl Send/Sync`, so GPU-side // results can be published to the render thread by handle. assert_send::(); assert_sync::(); }