Implement TypedBuffer everywhere

This commit is contained in:
Pierre Krieger 2017-04-25 09:32:11 +02:00
parent 329f4da90e
commit ddd666e087
4 changed files with 29 additions and 0 deletions

View File

@ -35,6 +35,7 @@ use buffer::sys::Usage;
use buffer::traits::BufferAccess;
use buffer::traits::BufferInner;
use buffer::traits::Buffer;
use buffer::traits::TypedBuffer;
use buffer::traits::TypedBufferAccess;
use device::Device;
use device::DeviceOwned;
@ -301,6 +302,12 @@ unsafe impl<T: ?Sized, A> Buffer for Arc<CpuAccessibleBuffer<T, A>>
}
}
unsafe impl<T: ?Sized, A> TypedBuffer for Arc<CpuAccessibleBuffer<T, A>>
where T: 'static + Send + Sync, A: MemoryPool
{
type Content = T;
}
unsafe impl<T: ?Sized, A> BufferAccess for CpuAccessibleBuffer<T, A>
where T: 'static + Send + Sync, A: MemoryPool
{

View File

@ -25,6 +25,7 @@ use buffer::sys::Usage;
use buffer::traits::BufferAccess;
use buffer::traits::BufferInner;
use buffer::traits::Buffer;
use buffer::traits::TypedBuffer;
use buffer::traits::TypedBufferAccess;
use device::Device;
use device::DeviceOwned;
@ -392,6 +393,12 @@ unsafe impl<T: ?Sized, A> Buffer for CpuBufferPoolSubbuffer<T, A>
}
}
unsafe impl<T: ?Sized, A> TypedBuffer for CpuBufferPoolSubbuffer<T, A>
where A: MemoryPool, T: 'static
{
type Content = T;
}
impl<T: ?Sized, A> Clone for CpuBufferPoolSubbuffer<T, A> where A: MemoryPool {
fn clone(&self) -> CpuBufferPoolSubbuffer<T, A> {
let old_val = self.buffer.subbuffers[self.subbuffer_index].num_cpu_accesses.fetch_add(1, Ordering::SeqCst);

View File

@ -27,6 +27,7 @@ use buffer::sys::Usage;
use buffer::traits::BufferAccess;
use buffer::traits::BufferInner;
use buffer::traits::Buffer;
use buffer::traits::TypedBuffer;
use buffer::traits::TypedBufferAccess;
use device::Device;
use device::DeviceOwned;
@ -178,6 +179,13 @@ unsafe impl<T: ?Sized, A> Buffer for Arc<DeviceLocalBuffer<T, A>>
}
}
unsafe impl<T: ?Sized, A> TypedBuffer for Arc<DeviceLocalBuffer<T, A>>
where T: 'static + Send + Sync,
A: MemoryPool
{
type Content = T;
}
unsafe impl<P, T: ?Sized, A> BufferAccess for DeviceLocalBufferAccess<P>
where P: SafeDeref<Target = DeviceLocalBuffer<T, A>>,
T: 'static + Send + Sync,

View File

@ -31,6 +31,7 @@ use buffer::sys::Usage;
use buffer::traits::BufferAccess;
use buffer::traits::BufferInner;
use buffer::traits::Buffer;
use buffer::traits::TypedBuffer;
use buffer::traits::TypedBufferAccess;
use device::Device;
use device::DeviceOwned;
@ -172,6 +173,12 @@ unsafe impl<T: ?Sized, A> Buffer for Arc<ImmutableBuffer<T, A>>
}
}
unsafe impl<T: ?Sized, A> TypedBuffer for Arc<ImmutableBuffer<T, A>>
where T: 'static + Send + Sync, A: MemoryPool
{
type Content = T;
}
unsafe impl<T: ?Sized, A> BufferAccess for ImmutableBuffer<T, A>
where T: 'static + Send + Sync, A: MemoryPool
{