Remove 'static + Send + Sync requirements for the MemoryPool

This commit is contained in:
Pierre Krieger 2017-05-13 16:48:15 +02:00
parent ed0b85a484
commit 4c4218e6a8
2 changed files with 7 additions and 9 deletions

View File

@ -164,7 +164,7 @@ pub struct DeviceLocalBufferAccess<P>(P);
unsafe impl<T: ?Sized, A> Buffer for Arc<DeviceLocalBuffer<T, A>>
where T: 'static + Send + Sync,
A: MemoryPool
A: MemoryPool + 'static
{
type Access = DeviceLocalBufferAccess<Arc<DeviceLocalBuffer<T, A>>>;
@ -181,7 +181,7 @@ 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
A: MemoryPool + 'static
{
type Content = T;
}
@ -189,7 +189,7 @@ unsafe impl<T: ?Sized, A> TypedBuffer for Arc<DeviceLocalBuffer<T, A>>
unsafe impl<P, T: ?Sized, A> BufferAccess for DeviceLocalBufferAccess<P>
where P: SafeDeref<Target = DeviceLocalBuffer<T, A>>,
T: 'static + Send + Sync,
A: MemoryPool
A: MemoryPool + 'static
{
#[inline]
fn inner(&self) -> BufferInner {
@ -220,7 +220,7 @@ unsafe impl<P, T: ?Sized, A> BufferAccess for DeviceLocalBufferAccess<P>
unsafe impl<P, T: ?Sized, A> TypedBufferAccess for DeviceLocalBufferAccess<P>
where P: SafeDeref<Target = DeviceLocalBuffer<T, A>>,
T: 'static + Send + Sync,
A: MemoryPool
A: MemoryPool + 'static
{
type Content = T;
}
@ -228,7 +228,7 @@ unsafe impl<P, T: ?Sized, A> TypedBufferAccess for DeviceLocalBufferAccess<P>
unsafe impl<P, T: ?Sized, A> DeviceOwned for DeviceLocalBufferAccess<P>
where P: SafeDeref<Target = DeviceLocalBuffer<T, A>>,
T: 'static + Send + Sync,
A: MemoryPool
A: MemoryPool + 'static
{
#[inline]
fn device(&self) -> &Arc<Device> {

View File

@ -24,8 +24,7 @@ mod non_host_visible;
mod pool;
/// Pool of GPU-visible memory that can be allocated from.
// TODO: remove 'static + Send + Sync
pub unsafe trait MemoryPool: 'static + Send + Sync {
pub unsafe trait MemoryPool {
/// Object that represents a single allocation. Its destructor should free the chunk.
type Alloc: MemoryPoolAlloc;
@ -49,8 +48,7 @@ pub unsafe trait MemoryPool: 'static + Send + Sync {
}
/// Object that represents a single allocation. Its destructor should free the chunk.
// TODO: remove 'static + Send + Sync
pub unsafe trait MemoryPoolAlloc: 'static + Send + Sync {
pub unsafe trait MemoryPoolAlloc {
/// Returns the memory object from which this is allocated. Returns `None` if the memory is
/// not mapped.
fn mapped_memory(&self) -> Option<&MappedDeviceMemory>;