Add Buffer::size()

This commit is contained in:
Pierre Krieger 2017-04-25 08:07:23 +02:00
parent 3ae8d75405
commit 9a114a03b7
6 changed files with 28 additions and 0 deletions

View File

@ -294,6 +294,11 @@ unsafe impl<T: ?Sized, A> Buffer for Arc<CpuAccessibleBuffer<T, A>>
fn access(self) -> Self {
self
}
#[inline]
fn size(&self) -> usize {
self.inner.size()
}
}
unsafe impl<T: ?Sized, A> BufferAccess for CpuAccessibleBuffer<T, A>

View File

@ -385,6 +385,11 @@ unsafe impl<T: ?Sized, A> Buffer for CpuBufferPoolSubbuffer<T, A>
fn access(self) -> Self {
self
}
#[inline]
fn size(&self) -> usize {
self.size
}
}
impl<T: ?Sized, A> Clone for CpuBufferPoolSubbuffer<T, A> where A: MemoryPool {

View File

@ -171,6 +171,11 @@ unsafe impl<T: ?Sized, A> Buffer for Arc<DeviceLocalBuffer<T, A>>
fn access(self) -> Self::Access {
DeviceLocalBufferAccess(self)
}
#[inline]
fn size(&self) -> usize {
self.inner.size()
}
}
unsafe impl<P, T: ?Sized, A> BufferAccess for DeviceLocalBufferAccess<P>

View File

@ -165,6 +165,11 @@ unsafe impl<T: ?Sized, A> Buffer for Arc<ImmutableBuffer<T, A>>
fn access(self) -> Self {
self
}
#[inline]
fn size(&self) -> usize {
self.inner.size()
}
}
unsafe impl<T: ?Sized, A> BufferAccess for ImmutableBuffer<T, A>

View File

@ -168,6 +168,11 @@ unsafe impl<T: ?Sized, B> Buffer for BufferSlice<T, B> where B: BufferAccess {
fn access(self) -> Self {
self
}
#[inline]
fn size(&self) -> usize {
self.size
}
}
unsafe impl<T: ?Sized, B> BufferAccess for BufferSlice<T, B> where B: BufferAccess {

View File

@ -26,6 +26,9 @@ pub unsafe trait Buffer {
/// Builds an object that represents a GPU access to the buffer.
fn access(self) -> Self::Access;
/// Returns the size of the buffer in bytes.
fn size(&self) -> usize;
}
/// Trait for objects that represent a way for the GPU to have access to a buffer or a slice of a