mirror of
https://github.com/mii443/rust-openvr.git
synced 2025-08-22 16:25:36 +00:00
More Send/Sync
This commit is contained in:
@ -28,6 +28,8 @@ pub mod vulkan {
|
|||||||
pub format: u32,
|
pub format: u32,
|
||||||
pub sample_count: u32,
|
pub sample_count: u32,
|
||||||
}
|
}
|
||||||
|
unsafe impl Send for Texture{}
|
||||||
|
unsafe impl Sync for Texture{}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
11
src/lib.rs
11
src/lib.rs
@ -52,9 +52,7 @@ pub unsafe fn init(ty: ApplicationType) -> Result<Context, InitError> {
|
|||||||
sys::EVRInitError_VRInitError_Init_InterfaceNotFound,
|
sys::EVRInitError_VRInitError_Init_InterfaceNotFound,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
Ok(Context {
|
Ok(Context { live: AtomicBool::new(true) })
|
||||||
live: Cell::new(true),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct System(&'static sys::VR_IVRSystem_FnTable);
|
pub struct System(&'static sys::VR_IVRSystem_FnTable);
|
||||||
@ -67,9 +65,7 @@ pub struct Chaperone(&'static sys::VR_IVRChaperone_FnTable);
|
|||||||
/// At most one of this object may exist at a time.
|
/// At most one of this object may exist at a time.
|
||||||
///
|
///
|
||||||
/// See safety notes in `init`.
|
/// See safety notes in `init`.
|
||||||
pub struct Context {
|
pub struct Context { live: AtomicBool }
|
||||||
live: Cell<bool>,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn load<T>(suffix: &[u8]) -> Result<*const T, InitError> {
|
fn load<T>(suffix: &[u8]) -> Result<*const T, InitError> {
|
||||||
let mut magic = Vec::from(b"FnTable:".as_ref());
|
let mut magic = Vec::from(b"FnTable:".as_ref());
|
||||||
@ -116,9 +112,10 @@ impl Context {
|
|||||||
/// attempting to free graphics resources.
|
/// attempting to free graphics resources.
|
||||||
///
|
///
|
||||||
/// No calls to other OpenVR methods may be made after this has been called unless a new `Context` is first
|
/// No calls to other OpenVR methods may be made after this has been called unless a new `Context` is first
|
||||||
|
|
||||||
/// constructed.
|
/// constructed.
|
||||||
pub unsafe fn shutdown(&self) {
|
pub unsafe fn shutdown(&self) {
|
||||||
if self.live.replace(false) {
|
if self.live.swap(false, Ordering::Acquire) {
|
||||||
sys::VR_ShutdownInternal();
|
sys::VR_ShutdownInternal();
|
||||||
INITIALIZED.store(false, Ordering::Release);
|
INITIALIZED.store(false, Ordering::Release);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user