pub struct Buffer {
pub(crate) raw: Snatchable<Box<dyn DynBuffer>>,
pub(crate) device: Arc<Device>,
pub(crate) usage: BufferUsages,
pub(crate) size: BufferAddress,
pub(crate) initialization_status: RwLock<InitTracker<BufferAddress>>,
pub(crate) label: String,
pub(crate) tracking_data: TrackingData,
pub(crate) map_state: Mutex<BufferMapState>,
pub(crate) bind_groups: Mutex<WeakVec<BindGroup>>,
}
Fields§
§raw: Snatchable<Box<dyn DynBuffer>>
§device: Arc<Device>
§usage: BufferUsages
§size: BufferAddress
§initialization_status: RwLock<InitTracker<BufferAddress>>
§label: String
The label
from the descriptor used to create the resource.
tracking_data: TrackingData
§map_state: Mutex<BufferMapState>
§bind_groups: Mutex<WeakVec<BindGroup>>
Implementations§
source§impl Buffer
impl Buffer
pub(crate) fn raw<'a>( &'a self, guard: &'a SnatchGuard<'_>, ) -> Option<&'a dyn DynBuffer>
pub(crate) fn try_raw<'a>( &'a self, guard: &'a SnatchGuard<'_>, ) -> Result<&dyn DynBuffer, DestroyedResourceError>
pub(crate) fn check_destroyed<'a>( &'a self, guard: &'a SnatchGuard<'_>, ) -> Result<(), DestroyedResourceError>
sourcepub(crate) fn check_usage(
&self,
expected: BufferUsages,
) -> Result<(), MissingBufferUsageError>
pub(crate) fn check_usage( &self, expected: BufferUsages, ) -> Result<(), MissingBufferUsageError>
Checks that the given buffer usage contains the required buffer usage, returns an error otherwise.
sourcepub(crate) fn map_async(
self: &Arc<Self>,
offset: BufferAddress,
size: Option<BufferAddress>,
op: BufferMapOperation,
) -> Result<(), (BufferMapOperation, BufferAccessError)>
pub(crate) fn map_async( self: &Arc<Self>, offset: BufferAddress, size: Option<BufferAddress>, op: BufferMapOperation, ) -> Result<(), (BufferMapOperation, BufferAccessError)>
Returns the mapping callback in case of error so that the callback can be fired outside of the locks that are held in this function.
pub(crate) fn unmap( self: &Arc<Self>, buffer_id: BufferId, ) -> Result<(), BufferAccessError>
fn unmap_inner( self: &Arc<Self>, buffer_id: BufferId, ) -> Result<Option<BufferMapPendingClosure>, BufferAccessError>
pub(crate) fn destroy(self: &Arc<Self>) -> Result<(), DestroyError>
Trait Implementations§
source§impl Labeled for Buffer
impl Labeled for Buffer
source§fn label(&self) -> &str
fn label(&self) -> &str
Returns a string identifying this resource for logging and errors. Read more
fn error_ident(&self) -> ResourceErrorIdent
source§impl ParentDevice for Buffer
impl ParentDevice for Buffer
source§impl Trackable for Buffer
impl Trackable for Buffer
fn tracker_index(&self) -> TrackerIndex
Auto Trait Implementations§
impl !Freeze for Buffer
impl !RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl !UnwindSafe for Buffer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more