logo
pub unsafe trait BufferAccess: DeviceOwned + Send + Sync {
    fn inner(&self) -> BufferInner<'_>;
    fn size(&self) -> DeviceSize;

    fn usage(&self) -> &BufferUsage { ... }
    fn into_buffer_slice(
        self: &Arc<Self>
    ) -> Arc<BufferSlice<Self::Content, Self>>
    where
        Self: Sized + TypedBufferAccess
, { ... } fn slice<T>(
        self: &Arc<Self>,
        range: Range<DeviceSize>
    ) -> Option<Arc<BufferSlice<[T], Self>>>
    where
        Self: Sized + TypedBufferAccess<Content = [T]>
, { ... } fn index<T>(
        self: &Arc<Self>,
        index: DeviceSize
    ) -> Option<Arc<BufferSlice<T, Self>>>
    where
        Self: Sized + TypedBufferAccess<Content = [T]>
, { ... } fn raw_device_address(&self) -> Result<NonZeroU64, BufferDeviceAddressError> { ... } }
Expand description

Trait for objects that represent a way for the GPU to have access to a buffer or a slice of a buffer.

See also TypedBufferAccess.

Required Methods

Returns the inner information about this buffer.

Returns the size of the buffer in bytes.

Provided Methods

Returns the usage the buffer was created with.

Returns a BufferSlice covering the whole buffer.

Returns a BufferSlice for a subrange of elements in the buffer. Returns None if out of range.

This method can be used when you want to perform an operation on some part of the buffer and not on the whole buffer.

Returns a BufferSlice for a single element in the buffer. Returns None if out of range.

This method can be used when you want to perform an operation on a specific element of the buffer and not on the whole buffer.

Gets the device address for this buffer.

Safety

No lock checking or waiting is performed. This is nevertheless still safe because the returned value isn’t directly dereferencable. Unsafe code is required to dereference the value in a shader.

Trait Implementations

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Implementors