Implement conflict_key for immutable buffer

This commit is contained in:
Pierre Krieger 2017-05-15 09:21:18 +02:00
parent 1818ac5bc7
commit d5a14a2e3c

View File

@ -345,6 +345,11 @@ unsafe impl<T: ?Sized, A> BufferAccess for ImmutableBuffer<T, A> {
}
}
#[inline]
fn conflict_key(&self, self_offset: usize, self_size: usize) -> u64 {
self.inner.key()
}
#[inline]
fn try_gpu_lock(&self, exclusive_access: bool, queue: &Queue) -> bool {
if exclusive_access {
@ -387,6 +392,11 @@ unsafe impl<T: ?Sized, A> BufferAccess for ImmutableBufferInitialization<T, A> {
self.buffer.inner()
}
#[inline]
fn conflict_key(&self, self_offset: usize, self_size: usize) -> u64 {
self.buffer.inner.key()
}
#[inline]
fn try_gpu_lock(&self, exclusive_access: bool, queue: &Queue) -> bool {
!self.used.compare_and_swap(false, true, Ordering::Relaxed)