mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 16:25:31 +00:00
Switch back to Mutex<Vec<>> instead of MsQueue
This commit is contained in:
parent
a04f214715
commit
710dec40e5
@ -1 +1 @@
|
||||
Subproject commit eee9d536bc12eeeca6d57310d60cd05824960a62
|
||||
Subproject commit 4fbb8cb45e144ff63383b48fb1d3244522602438
|
@ -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<u32>,
|
||||
fence_pool: MsQueue<vk::Fence>,
|
||||
fence_pool: Mutex<Vec<vk::Fence>>,
|
||||
}
|
||||
|
||||
// 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<vk::Fence> {
|
||||
pub(crate) fn fence_pool(&self) -> &Mutex<Vec<vk::Fence>> {
|
||||
&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);
|
||||
|
@ -60,7 +60,8 @@ impl<D> Fence<D>
|
||||
/// 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<Fence<D>, 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<D> Drop for Fence<D>
|
||||
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());
|
||||
|
Loading…
Reference in New Issue
Block a user