diff --git a/glsl-to-spirv/glslang b/glsl-to-spirv/glslang index eee9d536..4fbb8cb4 160000 --- a/glsl-to-spirv/glslang +++ b/glsl-to-spirv/glslang @@ -1 +1 @@ -Subproject commit eee9d536bc12eeeca6d57310d60cd05824960a62 +Subproject commit 4fbb8cb45e144ff63383b48fb1d3244522602438 diff --git a/vulkano/src/device.rs b/vulkano/src/device.rs index 04d5d387..129c37b0 100644 --- a/vulkano/src/device.rs +++ b/vulkano/src/device.rs @@ -89,7 +89,6 @@ //! //! TODO: write -use crossbeam::sync::MsQueue; use fnv::FnvHasher; use smallvec::SmallVec; use std::collections::HashMap; @@ -135,7 +134,7 @@ pub struct Device { features: Features, extensions: DeviceExtensions, allocation_count: Mutex, - fence_pool: MsQueue, + fence_pool: Mutex>, } // The `StandardCommandPool` type doesn't implement Send/Sync, so we have to manually reimplement @@ -309,7 +308,7 @@ impl Device { }, extensions: (&extensions).into(), allocation_count: Mutex::new(0), - fence_pool: MsQueue::new(), + fence_pool: Mutex::new(Vec::new()), }); // Iterator for the produced queues. @@ -435,7 +434,7 @@ impl Device { &self.allocation_count } - pub(crate) fn fence_pool(&self) -> &MsQueue { + pub(crate) fn fence_pool(&self) -> &Mutex> { &self.fence_pool } } @@ -460,7 +459,7 @@ impl Drop for Device { #[inline] fn drop(&mut self) { unsafe { - while let Some(raw_fence) = self.fence_pool.try_pop() { + for &raw_fence in self.fence_pool.lock().unwrap().iter() { self.vk.DestroyFence(self.device, raw_fence, ptr::null()); } self.vk.DeviceWaitIdle(self.device); diff --git a/vulkano/src/sync/fence.rs b/vulkano/src/sync/fence.rs index ca97b87e..0204ddd8 100644 --- a/vulkano/src/sync/fence.rs +++ b/vulkano/src/sync/fence.rs @@ -60,7 +60,8 @@ impl Fence /// For most applications, using the fence pool should be preferred, /// in order to avoid creating new fences every frame. pub fn from_pool(device: D) -> Result, OomError> { - match device.fence_pool().try_pop() { + let maybe_raw_fence = device.fence_pool().lock().unwrap().pop(); + match maybe_raw_fence { Some(raw_fence) => { unsafe { // Make sure the fence isn't signaled @@ -332,7 +333,7 @@ impl Drop for Fence unsafe { if self.must_put_in_pool { let raw_fence = self.fence; - self.device.fence_pool().push(raw_fence); + self.device.fence_pool().lock().unwrap().push(raw_fence); } else { let vk = self.device.pointers(); vk.DestroyFence(self.device.internal_object(), self.fence, ptr::null());