Rename Buffer to BufferAccess

This commit is contained in:
Pierre Krieger 2017-04-05 16:10:24 +02:00
parent 063e694b64
commit 8e4a6b0324
32 changed files with 125 additions and 125 deletions

View File

@ -32,7 +32,7 @@ use buffer::sys::BufferCreationError;
use buffer::sys::SparseLevel;
use buffer::sys::UnsafeBuffer;
use buffer::sys::Usage;
use buffer::traits::Buffer;
use buffer::traits::BufferAccess;
use buffer::traits::BufferInner;
use buffer::traits::IntoBuffer;
use buffer::traits::TypedBuffer;
@ -296,7 +296,7 @@ unsafe impl<T: ?Sized, A> IntoBuffer for Arc<CpuAccessibleBuffer<T, A>>
}
}
unsafe impl<T: ?Sized, A> Buffer for CpuAccessibleBuffer<T, A>
unsafe impl<T: ?Sized, A> BufferAccess for CpuAccessibleBuffer<T, A>
where T: 'static + Send + Sync, A: MemoryPool
{
#[inline]

View File

@ -24,7 +24,7 @@ use buffer::sys::BufferCreationError;
use buffer::sys::SparseLevel;
use buffer::sys::UnsafeBuffer;
use buffer::sys::Usage;
use buffer::traits::Buffer;
use buffer::traits::BufferAccess;
use buffer::traits::BufferInner;
use buffer::traits::IntoBuffer;
use buffer::traits::TypedBuffer;
@ -173,7 +173,7 @@ unsafe impl<T: ?Sized, A> IntoBuffer for Arc<DeviceLocalBuffer<T, A>>
}
}
unsafe impl<P, T: ?Sized, A> Buffer for DeviceLocalBufferAccess<P>
unsafe impl<P, T: ?Sized, A> BufferAccess for DeviceLocalBufferAccess<P>
where P: SafeDeref<Target = DeviceLocalBuffer<T, A>>,
T: 'static + Send + Sync,
A: MemoryPool

View File

@ -28,7 +28,7 @@ use buffer::sys::BufferCreationError;
use buffer::sys::SparseLevel;
use buffer::sys::UnsafeBuffer;
use buffer::sys::Usage;
use buffer::traits::Buffer;
use buffer::traits::BufferAccess;
use buffer::traits::BufferInner;
use buffer::traits::IntoBuffer;
use buffer::traits::TypedBuffer;
@ -167,7 +167,7 @@ unsafe impl<T: ?Sized, A> IntoBuffer for Arc<ImmutableBuffer<T, A>>
}
}
unsafe impl<T: ?Sized, A> Buffer for ImmutableBuffer<T, A>
unsafe impl<T: ?Sized, A> BufferAccess for ImmutableBuffer<T, A>
where T: 'static + Send + Sync, A: MemoryPool
{
#[inline]

View File

@ -68,7 +68,7 @@ pub use self::immutable::ImmutableBuffer;
pub use self::slice::BufferSlice;
pub use self::sys::BufferCreationError;
pub use self::sys::Usage as BufferUsage;
pub use self::traits::Buffer;
pub use self::traits::BufferAccess;
pub use self::traits::BufferInner;
pub use self::traits::IntoBuffer;
pub use self::traits::TypedBuffer;

View File

@ -12,7 +12,7 @@ use std::mem;
use std::ops::Range;
use std::sync::Arc;
use buffer::traits::Buffer;
use buffer::traits::BufferAccess;
use buffer::traits::BufferInner;
use buffer::traits::TypedBuffer;
use buffer::traits::IntoBuffer;
@ -161,7 +161,7 @@ impl<T, B> BufferSlice<[T], B> {
}
}
unsafe impl<T: ?Sized, B> IntoBuffer for BufferSlice<T, B> where B: Buffer {
unsafe impl<T: ?Sized, B> IntoBuffer for BufferSlice<T, B> where B: BufferAccess {
type Target = Self;
#[inline]
@ -170,7 +170,7 @@ unsafe impl<T: ?Sized, B> IntoBuffer for BufferSlice<T, B> where B: Buffer {
}
}
unsafe impl<T: ?Sized, B> Buffer for BufferSlice<T, B> where B: Buffer {
unsafe impl<T: ?Sized, B> BufferAccess for BufferSlice<T, B> where B: BufferAccess {
#[inline]
fn inner(&self) -> BufferInner {
let inner = self.resource.inner();
@ -187,7 +187,7 @@ unsafe impl<T: ?Sized, B> Buffer for BufferSlice<T, B> where B: Buffer {
#[inline]
fn conflicts_buffer(&self, self_offset: usize, self_size: usize,
other: &Buffer, other_offset: usize, other_size: usize) -> bool
other: &BufferAccess, other_offset: usize, other_size: usize) -> bool
{
let self_offset = self.offset + self_offset;
// FIXME: spurious failures ; needs investigation
@ -214,7 +214,7 @@ unsafe impl<T: ?Sized, B> Buffer for BufferSlice<T, B> where B: Buffer {
}
}
unsafe impl<T: ?Sized, B> TypedBuffer for BufferSlice<T, B> where B: Buffer, T: 'static {
unsafe impl<T: ?Sized, B> TypedBuffer for BufferSlice<T, B> where B: BufferAccess, T: 'static {
type Content = T;
}

View File

@ -20,7 +20,7 @@ use SafeDeref;
use VulkanObject;
/// Trait for objects that represent either a buffer or a slice of a buffer.
pub unsafe trait Buffer: DeviceOwned {
pub unsafe trait BufferAccess: DeviceOwned {
/// Returns the inner information about this buffer.
fn inner(&self) -> BufferInner;
@ -93,7 +93,7 @@ pub unsafe trait Buffer: DeviceOwned {
/// If this function returns `false`, this means that we are allowed to access the offset/size
/// of `self` at the same time as the offset/size of `other` without causing a data race.
fn conflicts_buffer(&self, self_offset: usize, self_size: usize,
other: &Buffer, other_offset: usize, other_size: usize)
other: &BufferAccess, other_offset: usize, other_size: usize)
-> bool
{
// TODO: should we really provide a default implementation?
@ -169,7 +169,7 @@ pub unsafe trait Buffer: DeviceOwned {
/// Utility trait.
pub unsafe trait IntoBuffer {
type Target: Buffer;
type Target: BufferAccess;
fn into_buffer(self) -> Self::Target;
}
@ -184,7 +184,7 @@ pub struct BufferInner<'a> {
pub offset: usize,
}
unsafe impl<T> Buffer for T where T: SafeDeref, T::Target: Buffer {
unsafe impl<T> BufferAccess for T where T: SafeDeref, T::Target: BufferAccess {
#[inline]
fn inner(&self) -> BufferInner {
(**self).inner()
@ -197,7 +197,7 @@ unsafe impl<T> Buffer for T where T: SafeDeref, T::Target: Buffer {
#[inline]
fn conflicts_buffer(&self, self_offset: usize, self_size: usize,
other: &Buffer, other_offset: usize, other_size: usize) -> bool
other: &BufferAccess, other_offset: usize, other_size: usize) -> bool
{
(**self).conflicts_buffer(self_offset, self_size, other, other_offset, other_size)
}
@ -218,7 +218,7 @@ unsafe impl<T> Buffer for T where T: SafeDeref, T::Target: Buffer {
}
}
pub unsafe trait TypedBuffer: Buffer {
pub unsafe trait TypedBuffer: BufferAccess {
type Content: ?Sized + 'static;
}

View File

@ -43,7 +43,7 @@ use std::mem;
use std::ptr;
use std::sync::Arc;
use buffer::Buffer;
use buffer::BufferAccess;
use buffer::BufferInner;
use buffer::TypedBuffer;
use device::Device;
@ -61,14 +61,14 @@ use vk;
/// Represents a way for the GPU to interpret buffer data. See the documentation of the
/// `view` module.
pub struct BufferView<F, B> where B: Buffer {
pub struct BufferView<F, B> where B: BufferAccess {
view: vk::BufferView,
buffer: B,
marker: PhantomData<F>,
atomic_accesses: bool,
}
impl<F, B> BufferView<F, B> where B: Buffer {
impl<F, B> BufferView<F, B> where B: BufferAccess {
/// Builds a new buffer view.
#[inline]
pub fn new(buffer: B, format: F) -> Result<Arc<BufferView<F, B>>, BufferViewCreationError>
@ -82,7 +82,7 @@ impl<F, B> BufferView<F, B> where B: Buffer {
/// Builds a new buffer view without checking that the format is correct.
pub unsafe fn unchecked(org_buffer: B, format: F)
-> Result<Arc<BufferView<F, B>>, BufferViewCreationError>
where B: Buffer, F: FormatDesc + 'static
where B: BufferAccess, F: FormatDesc + 'static
{
let (view, format_props) = {
let size = org_buffer.size();
@ -176,7 +176,7 @@ impl<F, B> BufferView<F, B> where B: Buffer {
}
}
unsafe impl<F, B> VulkanObject for BufferView<F, B> where B: Buffer {
unsafe impl<F, B> VulkanObject for BufferView<F, B> where B: BufferAccess {
type Object = vk::BufferView;
#[inline]
@ -186,7 +186,7 @@ unsafe impl<F, B> VulkanObject for BufferView<F, B> where B: Buffer {
}
unsafe impl<F, B> DeviceOwned for BufferView<F, B>
where B: Buffer
where B: BufferAccess
{
#[inline]
fn device(&self) -> &Arc<Device> {
@ -194,7 +194,7 @@ unsafe impl<F, B> DeviceOwned for BufferView<F, B>
}
}
impl<F, B> Drop for BufferView<F, B> where B: Buffer {
impl<F, B> Drop for BufferView<F, B> where B: BufferAccess {
#[inline]
fn drop(&mut self) {
unsafe {
@ -206,14 +206,14 @@ impl<F, B> Drop for BufferView<F, B> where B: Buffer {
}
pub unsafe trait BufferViewRef {
type Buffer: Buffer;
type BufferAccess: BufferAccess;
type Format;
fn view(&self) -> &BufferView<Self::Format, Self::Buffer>;
fn view(&self) -> &BufferView<Self::Format, Self::BufferAccess>;
}
unsafe impl<F, B> BufferViewRef for BufferView<F, B> where B: Buffer {
type Buffer = B;
unsafe impl<F, B> BufferViewRef for BufferView<F, B> where B: BufferAccess {
type BufferAccess = B;
type Format = F;
#[inline]
@ -222,8 +222,8 @@ unsafe impl<F, B> BufferViewRef for BufferView<F, B> where B: Buffer {
}
}
unsafe impl<T, F, B> BufferViewRef for T where T: SafeDeref<Target = BufferView<F, B>>, B: Buffer {
type Buffer = B;
unsafe impl<T, F, B> BufferViewRef for T where T: SafeDeref<Target = BufferView<F, B>>, B: BufferAccess {
type BufferAccess = B;
type Format = F;
#[inline]

View File

@ -10,7 +10,7 @@
use std::error;
use std::sync::Arc;
use buffer::Buffer;
use buffer::BufferAccess;
use command_buffer::cb;
use command_buffer::commands_raw;
use command_buffer::cb::AddCommand;
@ -91,7 +91,7 @@ unsafe impl<P> CommandBuffer for AutoCommandBufferBuilder<P>
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
self.inner.check_buffer_access(buffer, exclusive, queue)

View File

@ -11,7 +11,7 @@ use std::any::Any;
use std::error::Error;
use std::sync::Arc;
use buffer::Buffer;
use buffer::BufferAccess;
use command_buffer::cb::AddCommand;
use command_buffer::cb::CommandBufferBuild;
use command_buffer::cb::UnsafeCommandBuffer;
@ -57,7 +57,7 @@ unsafe impl<I> CommandBuffer for AbstractStorageLayer<I> where I: CommandBuffer
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
self.inner.check_buffer_access(buffer, exclusive, queue)

View File

@ -10,7 +10,7 @@
use std::error::Error;
use std::sync::Arc;
use buffer::Buffer;
use buffer::BufferAccess;
use command_buffer::cb::AddCommand;
use command_buffer::cb::CommandBufferBuild;
use command_buffer::cb::UnsafeCommandBuffer;
@ -38,7 +38,7 @@ use sync::GpuFuture;
///
pub struct SubmitSyncBuilderLayer<I> {
inner: I,
buffers: Vec<(Box<Buffer + Send + Sync>, bool)>,
buffers: Vec<(Box<BufferAccess + Send + Sync>, bool)>,
images: Vec<(Box<Image + Send + Sync>, bool)>,
}
@ -55,7 +55,7 @@ impl<I> SubmitSyncBuilderLayer<I> {
// Adds a buffer to the list.
fn add_buffer<B>(&mut self, buffer: &B, exclusive: bool)
where B: Buffer + Send + Sync + Clone + 'static
where B: BufferAccess + Send + Sync + Clone + 'static
{
for &mut (ref existing_buf, ref mut existing_exclusive) in self.buffers.iter_mut() {
if existing_buf.conflicts_buffer(0, existing_buf.size(), buffer, 0, buffer.size()) {
@ -136,7 +136,7 @@ pass_through!((C), commands_raw::CmdExecuteCommands<C>);
unsafe impl<I, O, B> AddCommand<commands_raw::CmdBindIndexBuffer<B>> for SubmitSyncBuilderLayer<I>
where I: AddCommand<commands_raw::CmdBindIndexBuffer<B>, Out = O>,
B: Buffer + Send + Sync + Clone + 'static
B: BufferAccess + Send + Sync + Clone + 'static
{
type Out = SubmitSyncBuilderLayer<O>;
@ -204,8 +204,8 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdClearAttachments> for SubmitSyncBu
unsafe impl<I, O, S, D> AddCommand<commands_raw::CmdCopyBuffer<S, D>> for SubmitSyncBuilderLayer<I>
where I: AddCommand<commands_raw::CmdCopyBuffer<S, D>, Out = O>,
S: Buffer + Send + Sync + Clone + 'static,
D: Buffer + Send + Sync + Clone + 'static
S: BufferAccess + Send + Sync + Clone + 'static,
D: BufferAccess + Send + Sync + Clone + 'static
{
type Out = SubmitSyncBuilderLayer<O>;
@ -224,7 +224,7 @@ unsafe impl<I, O, S, D> AddCommand<commands_raw::CmdCopyBuffer<S, D>> for Submit
unsafe impl<I, O, S, D> AddCommand<commands_raw::CmdCopyBufferToImage<S, D>> for SubmitSyncBuilderLayer<I>
where I: AddCommand<commands_raw::CmdCopyBufferToImage<S, D>, Out = O>,
S: Buffer + Send + Sync + Clone + 'static,
S: BufferAccess + Send + Sync + Clone + 'static,
D: Image + Send + Sync + Clone + 'static
{
type Out = SubmitSyncBuilderLayer<O>;
@ -324,7 +324,7 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdEndRenderPass> for SubmitSyncBuild
unsafe impl<I, O, B> AddCommand<commands_raw::CmdFillBuffer<B>> for SubmitSyncBuilderLayer<I>
where I: AddCommand<commands_raw::CmdFillBuffer<B>, Out = O>,
B: Buffer + Send + Sync + Clone + 'static
B: BufferAccess + Send + Sync + Clone + 'static
{
type Out = SubmitSyncBuilderLayer<O>;
@ -422,7 +422,7 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdSetState> for SubmitSyncBuilderLay
unsafe impl<I, O, B, D> AddCommand<commands_raw::CmdUpdateBuffer<B, D>> for SubmitSyncBuilderLayer<I>
where I: AddCommand<commands_raw::CmdUpdateBuffer<B, D>, Out = O>,
B: Buffer + Send + Sync + Clone + 'static
B: BufferAccess + Send + Sync + Clone + 'static
{
type Out = SubmitSyncBuilderLayer<O>;
@ -441,7 +441,7 @@ unsafe impl<I, O, B, D> AddCommand<commands_raw::CmdUpdateBuffer<B, D>> for Subm
/// Layer around a command buffer that handles synchronization between command buffers.
pub struct SubmitSyncLayer<I> {
inner: I,
buffers: Vec<(Box<Buffer + Send + Sync>, bool)>,
buffers: Vec<(Box<BufferAccess + Send + Sync>, bool)>,
images: Vec<(Box<Image + Send + Sync>, bool)>,
}
@ -482,7 +482,7 @@ unsafe impl<I> CommandBuffer for SubmitSyncLayer<I> where I: CommandBuffer {
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
// FIXME: implement

View File

@ -12,7 +12,7 @@ use std::ptr;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use buffer::Buffer;
use buffer::BufferAccess;
use command_buffer::CommandBuffer;
use command_buffer::cb::CommandBufferBuild;
use command_buffer::pool::AllocatedCommandBuffer;
@ -323,7 +323,7 @@ unsafe impl<P> CommandBuffer for UnsafeCommandBuffer<P> where P: CommandPool {
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
Err(())

View File

@ -12,7 +12,7 @@ use std::fmt;
use std::mem;
use std::sync::Arc;
use buffer::Buffer;
use buffer::BufferAccess;
use buffer::TypedBuffer;
use command_buffer::commands_raw::CmdBindDescriptorSets;
use command_buffer::commands_raw::CmdBindDescriptorSetsError;
@ -92,7 +92,7 @@ impl<L, B, Pl, S, Pc> CmdDispatchIndirect<L, B, Pl, S, Pc>
}
unsafe impl<L, B, Pl, S, Pc> CommandsList for CmdDispatchIndirect<L, B, Pl, S, Pc>
where L: CommandsList, B: Buffer,
where L: CommandsList, B: BufferAccess,
Pl: PipelineLayoutAbstract, S: TrackedDescriptorSetsCollection
{
#[inline]

View File

@ -7,7 +7,7 @@
// notice may not be copied, modified, or distributed except
// according to those terms.
use buffer::Buffer;
use buffer::BufferAccess;
use buffer::TypedBuffer;
use command_buffer::DynamicState;
use command_buffer::cb::AddCommand;
@ -38,7 +38,7 @@ pub struct CmdDrawIndexed<V, Ib, P, S, Pc>
impl<V, Ib, I, P, S, Pc> CmdDrawIndexed<V, Ib, P, S, Pc>
where P: GraphicsPipelineAbstract,
S: DescriptorSetsCollection,
Ib: Buffer + TypedBuffer<Content = [I]>,
Ib: BufferAccess + TypedBuffer<Content = [I]>,
I: Index + 'static
{
/// See the documentation of the `draw` method.

View File

@ -9,7 +9,7 @@
use std::sync::Arc;
use buffer::Buffer;
use buffer::BufferAccess;
use buffer::TypedBuffer;
use command_buffer::cb::AddCommand;
use command_buffer::cb::UnsafeCommandBufferBuilder;
@ -36,7 +36,7 @@ pub struct CmdBindIndexBuffer<B> {
}
impl<B, I> CmdBindIndexBuffer<B>
where B: Buffer + TypedBuffer<Content = [I]>,
where B: BufferAccess + TypedBuffer<Content = [I]>,
I: Index + 'static
{
/// Builds the command.

View File

@ -12,7 +12,7 @@ use std::error;
use std::fmt;
use std::sync::Arc;
use buffer::Buffer;
use buffer::BufferAccess;
use command_buffer::cb::AddCommand;
use command_buffer::cb::UnsafeCommandBufferBuilder;
use command_buffer::pool::CommandPool;
@ -34,7 +34,7 @@ pub struct CmdCopyBuffer<S, D> {
}
impl<S, D> CmdCopyBuffer<S, D>
where S: Buffer, D: Buffer
where S: BufferAccess, D: BufferAccess
{
/// Builds a new command.
///
@ -113,8 +113,8 @@ unsafe impl<S, D> DeviceOwned for CmdCopyBuffer<S, D>
}
unsafe impl<'a, P, S, D> AddCommand<&'a CmdCopyBuffer<S, D>> for UnsafeCommandBufferBuilder<P>
where S: Buffer,
D: Buffer,
where S: BufferAccess,
D: BufferAccess,
P: CommandPool,
{
type Out = UnsafeCommandBufferBuilder<P>;

View File

@ -10,7 +10,7 @@
use std::error;
use std::fmt;
use std::sync::Arc;
use buffer::Buffer;
use buffer::BufferAccess;
use command_buffer::cb::AddCommand;
use command_buffer::cb::UnsafeCommandBufferBuilder;
use command_buffer::pool::CommandPool;
@ -48,7 +48,7 @@ pub struct CmdCopyBufferToImage<S, D> {
extent: [u32; 3],
}
impl<S, D> CmdCopyBufferToImage<S, D> where S: Buffer, D: Image {
impl<S, D> CmdCopyBufferToImage<S, D> where S: BufferAccess, D: Image {
#[inline]
pub fn new(source: S, destination: D)
-> Result<CmdCopyBufferToImage<S, D>, CmdCopyBufferToImageError>

View File

@ -8,7 +8,7 @@
// according to those terms.
use std::sync::Arc;
use buffer::Buffer;
use buffer::BufferAccess;
use command_buffer::cb::AddCommand;
use command_buffer::cb::UnsafeCommandBufferBuilder;
use command_buffer::pool::CommandPool;
@ -25,7 +25,7 @@ pub struct CmdDrawIndirectRaw<B> {
stride: u32,
}
impl<B> CmdDrawIndirectRaw<B> where B: Buffer {
impl<B> CmdDrawIndirectRaw<B> where B: BufferAccess {
#[inline]
pub unsafe fn new(buffer: B, offset: usize, draw_count: u32) -> CmdDrawIndirectRaw<B> {
let real_offset = offset + buffer.inner().offset;
@ -52,7 +52,7 @@ unsafe impl<B> DeviceOwned for CmdDrawIndirectRaw<B>
}
unsafe impl<'a, B, P> AddCommand<&'a CmdDrawIndirectRaw<B>> for UnsafeCommandBufferBuilder<P>
where B: Buffer,
where B: BufferAccess,
P: CommandPool
{
type Out = UnsafeCommandBufferBuilder<P>;

View File

@ -11,7 +11,7 @@ use std::error;
use std::fmt;
use std::sync::Arc;
use buffer::Buffer;
use buffer::BufferAccess;
use buffer::BufferInner;
use command_buffer::cb::AddCommand;
use command_buffer::cb::UnsafeCommandBufferBuilder;
@ -45,7 +45,7 @@ unsafe impl<B> DeviceOwned for CmdFillBuffer<B>
}
impl<B> CmdFillBuffer<B>
where B: Buffer
where B: BufferAccess
{
/// Builds a command that writes data to a buffer.
// TODO: not safe because of signalling NaNs

View File

@ -13,7 +13,7 @@ use std::ptr;
use std::u32;
use smallvec::SmallVec;
use buffer::Buffer;
use buffer::BufferAccess;
use buffer::BufferInner;
use command_buffer::cb::AddCommand;
use command_buffer::cb::UnsafeCommandBufferBuilder;
@ -149,7 +149,7 @@ impl<'a> CmdPipelineBarrier<'a> {
source_access: AccessFlagBits, dest_stage: PipelineStages,
dest_access: AccessFlagBits, by_region: bool,
queue_transfer: Option<(u32, u32)>, offset: usize, size: usize)
where B: Buffer
where B: BufferAccess
{
self.add_execution_dependency(source_stage, dest_stage, by_region);

View File

@ -13,7 +13,7 @@ use std::sync::Arc;
use std::os::raw::c_void;
use std::ptr;
use buffer::Buffer;
use buffer::BufferAccess;
use buffer::BufferInner;
use command_buffer::cb::AddCommand;
use command_buffer::cb::UnsafeCommandBufferBuilder;
@ -42,7 +42,7 @@ pub struct CmdUpdateBuffer<B, D> {
}
impl<B, D> CmdUpdateBuffer<B, D>
where B: Buffer
where B: BufferAccess
{
/// Builds a command that writes data to a buffer.
///
@ -103,7 +103,7 @@ unsafe impl<B, D> DeviceOwned for CmdUpdateBuffer<B, D>
}
unsafe impl<'a, P, B, D> AddCommand<&'a CmdUpdateBuffer<B, D>> for UnsafeCommandBufferBuilder<P>
where B: Buffer,
where B: BufferAccess,
P: CommandPool,
{
type Out = UnsafeCommandBufferBuilder<P>;

View File

@ -13,7 +13,7 @@ use std::sync::Mutex;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use buffer::Buffer;
use buffer::BufferAccess;
use command_buffer::cb::UnsafeCommandBuffer;
use command_buffer::pool::CommandPool;
use command_buffer::submit::SubmitAnyBuilder;
@ -91,7 +91,7 @@ pub unsafe trait CommandBuffer: DeviceOwned {
}
}
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>;
fn check_image_access(&self, image: &Image, exclusive: bool, queue: &Queue)
@ -125,7 +125,7 @@ unsafe impl<T> CommandBuffer for T where T: SafeDeref, T::Target: CommandBuffer
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
(**self).check_buffer_access(buffer, exclusive, queue)
@ -229,7 +229,7 @@ unsafe impl<F, Cb> GpuFuture for CommandBufferExecFuture<F, Cb>
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
match self.command_buffer.check_buffer_access(buffer, exclusive, queue) {

View File

@ -121,7 +121,7 @@ pub enum DescriptorDescTy {
multisampled: bool,
array_layers: DescriptorImageDescArray,
},
Buffer(DescriptorBufferDesc),
BufferAccess(DescriptorBufferDesc),
}
impl DescriptorDescTy {
@ -138,7 +138,7 @@ impl DescriptorDescTy {
else { DescriptorType::StorageImage }
},
DescriptorDescTy::InputAttachment { .. } => DescriptorType::InputAttachment,
DescriptorDescTy::Buffer(ref desc) => {
DescriptorDescTy::BufferAccess(ref desc) => {
let dynamic = match desc.dynamic { Some(d) => d, None => return None };
match (desc.storage, dynamic) {
(false, false) => DescriptorType::UniformBuffer,
@ -175,7 +175,7 @@ impl DescriptorDescTy {
me_multisampled == other_multisampled && me_array_layers == other_array_layers
},
(&DescriptorDescTy::Buffer(ref me), &DescriptorDescTy::Buffer(ref other)) => {
(&DescriptorDescTy::BufferAccess(ref me), &DescriptorDescTy::BufferAccess(ref other)) => {
if me.storage != other.storage {
return false;
}

View File

@ -8,7 +8,7 @@
// according to those terms.
use std::iter;
use buffer::Buffer;
use buffer::BufferAccess;
use descriptor::descriptor::DescriptorDesc;
use descriptor::descriptor_set::DescriptorSet;
use descriptor::descriptor_set::DescriptorSetDesc;
@ -36,7 +36,7 @@ pub unsafe trait DescriptorSetsCollection {
fn descriptor(&self, set: usize, binding: usize) -> Option<DescriptorDesc>;
/// Returns the list of buffers used by this descriptor set. Includes buffer views.
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a Buffer> + 'a>;
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a BufferAccess> + 'a>;
/// Returns the list of images used by this descriptor set. Includes image views.
fn images_list<'a>(&'a self) -> Box<Iterator<Item = &'a Image> + 'a>;
@ -64,7 +64,7 @@ unsafe impl DescriptorSetsCollection for () {
}
#[inline]
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a Buffer> + 'a> {
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a BufferAccess> + 'a> {
Box::new(iter::empty())
}
@ -107,7 +107,7 @@ unsafe impl<T> DescriptorSetsCollection for T
}
#[inline]
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a Buffer> + 'a> {
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a BufferAccess> + 'a> {
DescriptorSet::buffers_list(self)
}
@ -193,7 +193,7 @@ macro_rules! impl_collection {
}
#[inline]
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a Buffer> + 'a> {
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a BufferAccess> + 'a> {
#![allow(non_snake_case)]
let &(ref first, $(ref $others,)*) = self;

View File

@ -35,7 +35,7 @@
//! - The `DescriptorSetsCollection` trait is implemented on collections of types that implement
//! `DescriptorSet`. It is what you pass to the draw functions.
use buffer::Buffer;
use buffer::BufferAccess;
use descriptor::descriptor::DescriptorDesc;
use image::Image;
use SafeDeref;
@ -70,7 +70,7 @@ pub unsafe trait DescriptorSet: DescriptorSetDesc {
/// Returns the list of buffers used by this descriptor set. Includes buffer views.
// TODO: meh for boxing
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a Buffer> + 'a>;
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a BufferAccess> + 'a>;
/// Returns the list of images used by this descriptor set. Includes image views.
// TODO: meh for boxing
@ -84,7 +84,7 @@ unsafe impl<T> DescriptorSet for T where T: SafeDeref, T::Target: DescriptorSet
}
#[inline]
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a Buffer> + 'a> {
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a BufferAccess> + 'a> {
(**self).buffers_list()
}

View File

@ -9,7 +9,7 @@
use std::sync::Arc;
use buffer::Buffer;
use buffer::BufferAccess;
use buffer::BufferViewRef;
use buffer::IntoBuffer;
use descriptor::descriptor::DescriptorDesc;
@ -69,7 +69,7 @@ unsafe impl<R, P> DescriptorSet for SimpleDescriptorSet<R, P> where P: Descripto
}
#[inline]
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a Buffer> + 'a> {
fn buffers_list<'a>(&'a self) -> Box<Iterator<Item = &'a BufferAccess> + 'a> {
unimplemented!()
}
@ -111,7 +111,7 @@ macro_rules! simple_descriptor_set {
$(
// Here `$val` can be either a buffer or an image. However we can't create an extension
// trait for both buffers and image, because `impl<T: Image> ExtTrait for T {}` would
// conflict with `impl<T: Buffer> ExtTrait for T {}`.
// conflict with `impl<T: BufferAccess> ExtTrait for T {}`.
//
// Therefore we use a trick: we create two traits, one for buffers
// (`SimpleDescriptorSetBufferExt`) and one for images (`SimpleDescriptorSetImageExt`),
@ -412,7 +412,7 @@ pub struct SimpleDescriptorSetBuf<B> {
}
/*unsafe impl<B> SimpleDescriptorSetResourcesCollection for SimpleDescriptorSetBuf<B>
where B: Buffer
where B: BufferAccess
{
#[inline]
fn add_transition<'a>(&'a self, sink: &mut CommandsListSink<'a>) {
@ -443,7 +443,7 @@ pub struct SimpleDescriptorSetBufView<V> where V: BufferViewRef {
}
/*unsafe impl<V> SimpleDescriptorSetResourcesCollection for SimpleDescriptorSetBufView<V>
where V: BufferViewRef, V::Buffer: Buffer
where V: BufferViewRef, V::BufferAccess: BufferAccess
{
#[inline]
fn add_transition<'a>(&'a self, sink: &mut CommandsListSink<'a>) {

View File

@ -17,7 +17,7 @@ use std::sync::Arc;
use std::vec::IntoIter as VecIntoIter;
use smallvec::SmallVec;
use buffer::Buffer;
use buffer::BufferAccess;
use buffer::BufferInner;
use buffer::BufferView;
use descriptor::descriptor::DescriptorType;
@ -791,7 +791,7 @@ impl DescriptorWrite {
#[inline]
pub fn uniform_texel_buffer<'a, F, B>(binding: u32, array_element: u32, view: &Arc<BufferView<F, B>>) -> DescriptorWrite
where B: Buffer,
where B: BufferAccess,
F: 'static + Send + Sync,
{
assert!(view.uniform_texel_buffer());
@ -805,7 +805,7 @@ impl DescriptorWrite {
#[inline]
pub fn storage_texel_buffer<'a, F, B>(binding: u32, array_element: u32, view: &Arc<BufferView<F, B>>) -> DescriptorWrite
where B: Buffer + 'static,
where B: BufferAccess + 'static,
F: 'static + Send + Sync,
{
assert!(view.storage_texel_buffer());
@ -819,7 +819,7 @@ impl DescriptorWrite {
#[inline]
pub unsafe fn uniform_buffer<B>(binding: u32, array_element: u32, buffer: &B) -> DescriptorWrite
where B: Buffer
where B: BufferAccess
{
let size = buffer.size();
let BufferInner { buffer, offset } = buffer.inner();
@ -835,7 +835,7 @@ impl DescriptorWrite {
#[inline]
pub unsafe fn storage_buffer<B>(binding: u32, array_element: u32, buffer: &B) -> DescriptorWrite
where B: Buffer
where B: BufferAccess
{
let size = buffer.size();
let BufferInner { buffer, offset } = buffer.inner();
@ -851,7 +851,7 @@ impl DescriptorWrite {
#[inline]
pub unsafe fn dynamic_uniform_buffer<B>(binding: u32, array_element: u32, buffer: &B) -> DescriptorWrite
where B: Buffer
where B: BufferAccess
{
let size = buffer.size();
let BufferInner { buffer, offset } = buffer.inner();
@ -866,7 +866,7 @@ impl DescriptorWrite {
#[inline]
pub unsafe fn dynamic_storage_buffer<B>(binding: u32, array_element: u32, buffer: &B) -> DescriptorWrite
where B: Buffer
where B: BufferAccess
{
let size = buffer.size();
let BufferInner { buffer, offset } = buffer.inner();
@ -959,7 +959,7 @@ mod tests {
let (device, _) = gfx_dev_and_queue!();
let layout = DescriptorDesc {
ty: DescriptorDescTy::Buffer(DescriptorBufferDesc {
ty: DescriptorDescTy::BufferAccess(DescriptorBufferDesc {
dynamic: Some(false),
storage: false,
content: DescriptorBufferContentDesc::F32,
@ -990,7 +990,7 @@ mod tests {
let (device2, _) = gfx_dev_and_queue!();
let layout = DescriptorDesc {
ty: DescriptorDescTy::Buffer(DescriptorBufferDesc {
ty: DescriptorDescTy::BufferAccess(DescriptorBufferDesc {
dynamic: Some(false),
storage: false,
content: DescriptorBufferContentDesc::F32,

View File

@ -151,7 +151,7 @@ mod tests {
let (device, _) = gfx_dev_and_queue!();
let layout = DescriptorDesc {
ty: DescriptorDescTy::Buffer(DescriptorBufferDesc {
ty: DescriptorDescTy::BufferAccess(DescriptorBufferDesc {
dynamic: Some(false),
storage: false,
content: DescriptorBufferContentDesc::F32,

View File

@ -7,7 +7,7 @@
// notice may not be copied, modified, or distributed except
// according to those terms.
use buffer::Buffer;
use buffer::BufferAccess;
use device::Queue;
use format::ClearValue;
use format::Format;
@ -103,7 +103,7 @@ pub unsafe trait Image {
/// If this function returns `false`, this means that we are allowed to access the offset/size
/// of `self` at the same time as the offset/size of `other` without causing a data race.
fn conflicts_buffer(&self, self_first_layer: u32, self_num_layers: u32, self_first_mipmap: u32,
self_num_mipmaps: u32, other: &Buffer, other_offset: usize,
self_num_mipmaps: u32, other: &BufferAccess, other_offset: usize,
other_size: usize) -> bool
{
// TODO: should we really provide a default implementation?

View File

@ -16,7 +16,7 @@ use std::sync::Arc;
use std::u32;
use smallvec::SmallVec;
use buffer::Buffer;
use buffer::BufferAccess;
use buffer::BufferInner;
use device::Device;
use device::DeviceOwned;
@ -1124,13 +1124,13 @@ impl Drop for Inner {
/// Trait implemented on objects that reference a graphics pipeline. Can be made into a trait
/// object.
pub unsafe trait GraphicsPipelineAbstract: PipelineLayoutAbstract + RenderPassAbstract + VertexSource<Vec<Arc<Buffer + Send + Sync>>> {
pub unsafe trait GraphicsPipelineAbstract: PipelineLayoutAbstract + RenderPassAbstract + VertexSource<Vec<Arc<BufferAccess + Send + Sync>>> {
/// Returns an opaque object that represents the inside of the graphics pipeline.
fn inner(&self) -> GraphicsPipelineSys;
}
unsafe impl<Mv, L, Rp> GraphicsPipelineAbstract for GraphicsPipeline<Mv, L, Rp>
where L: PipelineLayoutAbstract, Rp: RenderPassAbstract, Mv: VertexSource<Vec<Arc<Buffer + Send + Sync>>>
where L: PipelineLayoutAbstract, Rp: RenderPassAbstract, Mv: VertexSource<Vec<Arc<BufferAccess + Send + Sync>>>
{
#[inline]
fn inner(&self) -> GraphicsPipelineSys {

View File

@ -38,7 +38,7 @@
//! # use std::sync::Arc;
//! # use vulkano::device::Device;
//! # use vulkano::device::Queue;
//! use vulkano::buffer::Buffer;
//! use vulkano::buffer::BufferAccess;
//! use vulkano::buffer::Usage as BufferUsage;
//! use vulkano::memory::HostVisible;
//! use vulkano::pipeline::vertex::;
@ -56,7 +56,7 @@
//! .. BufferUsage::none()
//! };
//!
//! let vertex_buffer = Buffer::<[Vertex], _>::array(&device, 128, &usage, HostVisible, &queue)
//! let vertex_buffer = BufferAccess::<[Vertex], _>::array(&device, 128, &usage, HostVisible, &queue)
//! .expect("failed to create buffer");
//!
//! // TODO: finish example
@ -71,7 +71,7 @@ use std::option::IntoIter as OptionIntoIter;
use std::sync::Arc;
use std::vec::IntoIter as VecIntoIter;
use buffer::Buffer;
use buffer::BufferAccess;
use buffer::BufferInner;
use buffer::TypedBuffer;
use format::Format;
@ -165,7 +165,7 @@ pub struct AttributeInfo {
}
/// Trait for types that describe the definition of the vertex input used by a graphics pipeline.
pub unsafe trait VertexDefinition<I>: VertexSource<Vec<Arc<Buffer + Send + Sync>>> {
pub unsafe trait VertexDefinition<I>: VertexSource<Vec<Arc<BufferAccess + Send + Sync>>> {
/// Iterator that returns the offset, the stride (in bytes) and input rate of each buffer.
type BuffersIter: ExactSizeIterator<Item = (u32, usize, InputRate)>;
/// Iterator that returns the attribute location, buffer id, and infos.
@ -299,11 +299,11 @@ unsafe impl<T, I> VertexDefinition<I> for SingleBufferDefinition<T>
}
}
unsafe impl<V> VertexSource<Vec<Arc<Buffer + Send + Sync>>> for SingleBufferDefinition<V>
unsafe impl<V> VertexSource<Vec<Arc<BufferAccess + Send + Sync>>> for SingleBufferDefinition<V>
where V: Vertex
{
#[inline]
fn decode<'l>(&self, source: &'l Vec<Arc<Buffer + Send + Sync>>) -> (Vec<BufferInner<'l>>, usize, usize) {
fn decode<'l>(&self, source: &'l Vec<Arc<BufferAccess + Send + Sync>>) -> (Vec<BufferInner<'l>>, usize, usize) {
// FIXME: safety
assert_eq!(source.len(), 1);
let len = source[0].size() / mem::size_of::<V>();
@ -381,11 +381,11 @@ unsafe impl<T, U, I> VertexDefinition<I> for TwoBuffersDefinition<T, U>
}
}
unsafe impl<T, U> VertexSource<Vec<Arc<Buffer + Send + Sync>>> for TwoBuffersDefinition<T, U>
unsafe impl<T, U> VertexSource<Vec<Arc<BufferAccess + Send + Sync>>> for TwoBuffersDefinition<T, U>
where T: Vertex, U: Vertex
{
#[inline]
fn decode<'l>(&self, source: &'l Vec<Arc<Buffer + Send + Sync>>) -> (Vec<BufferInner<'l>>, usize, usize) {
fn decode<'l>(&self, source: &'l Vec<Arc<BufferAccess + Send + Sync>>) -> (Vec<BufferInner<'l>>, usize, usize) {
unimplemented!() // FIXME: implement
}
}
@ -462,11 +462,11 @@ unsafe impl<T, U, I> VertexDefinition<I> for OneVertexOneInstanceDefinition<T, U
}
}
unsafe impl<T, U> VertexSource<Vec<Arc<Buffer + Send + Sync>>> for OneVertexOneInstanceDefinition<T, U>
unsafe impl<T, U> VertexSource<Vec<Arc<BufferAccess + Send + Sync>>> for OneVertexOneInstanceDefinition<T, U>
where T: Vertex, U: Vertex
{
#[inline]
fn decode<'l>(&self, source: &'l Vec<Arc<Buffer + Send + Sync>>) -> (Vec<BufferInner<'l>>, usize, usize) {
fn decode<'l>(&self, source: &'l Vec<Arc<BufferAccess + Send + Sync>>) -> (Vec<BufferInner<'l>>, usize, usize) {
unimplemented!() // FIXME: implement
}
}

View File

@ -18,7 +18,7 @@ use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::time::Duration;
use buffer::Buffer;
use buffer::BufferAccess;
use command_buffer::submit::SubmitAnyBuilder;
use command_buffer::submit::SubmitPresentBuilder;
use command_buffer::submit::SubmitSemaphoresWaitBuilder;
@ -475,7 +475,7 @@ unsafe impl GpuFuture for SwapchainAcquireFuture {
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
Err(())
@ -666,7 +666,7 @@ unsafe impl<P> GpuFuture for PresentFuture<P> where P: GpuFuture {
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
unimplemented!() // TODO: VK specs don't say whether it is legal to do that

View File

@ -14,7 +14,7 @@ use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::time::Duration;
use buffer::Buffer;
use buffer::BufferAccess;
use command_buffer::CommandBuffer;
use command_buffer::CommandBufferExecFuture;
use command_buffer::submit::SubmitAnyBuilder;
@ -91,7 +91,7 @@ pub unsafe trait GpuFuture: DeviceOwned {
///
/// > **Note**: Returning `Ok` means "access granted", while returning `Err` means
/// > "don't know". Therefore returning `Err` is never unsafe.
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>;
/// Checks whether submitting something after this future grants access (exclusive or shared,
@ -226,7 +226,7 @@ unsafe impl<F: ?Sized> GpuFuture for Box<F> where F: GpuFuture {
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
(**self).check_buffer_access(buffer, exclusive, queue)
@ -286,7 +286,7 @@ unsafe impl GpuFuture for DummyFuture {
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
Err(())
@ -393,7 +393,7 @@ unsafe impl<F> GpuFuture for SemaphoreSignalFuture<F> where F: GpuFuture {
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
self.previous.check_buffer_access(buffer, exclusive, queue).map(|_| None)
@ -521,7 +521,7 @@ unsafe impl<F> GpuFuture for FenceSignalFuture<F> where F: GpuFuture {
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()> {
if let Some(ref previous) = self.previous {
previous.check_buffer_access(buffer, exclusive, queue)
@ -670,7 +670,7 @@ unsafe impl<A, B> GpuFuture for JoinFuture<A, B> where A: GpuFuture, B: GpuFutur
}
#[inline]
fn check_buffer_access(&self, buffer: &Buffer, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, ()>
{
let first = self.first.check_buffer_access(buffer, exclusive, queue);