Struct Buffer
pub struct Buffer { /* private fields */ }unstable-wgpu-27 only.Implementations§
§impl Buffer
impl Buffer
pub fn resolve_binding_size(
&self,
offset: u64,
binding_size: Option<NonZero<u64>>,
) -> Result<u64, BindingError>
pub fn resolve_binding_size( &self, offset: u64, binding_size: Option<NonZero<u64>>, ) -> Result<u64, BindingError>
Resolve the size of a binding for buffer with offset and size.
If size is None, then the remainder of the buffer starting from
offset is used.
If the binding would overflow the buffer, then an error is returned.
Zero-size bindings are permitted here for historical reasons. Although
zero-size bindings are permitted by WebGPU, they are not permitted by
some backends. See Buffer::binding and
#3170.
pub fn binding<'a>(
&'a self,
offset: u64,
binding_size: Option<NonZero<u64>>,
snatch_guard: &'a SnatchGuard<'_>,
) -> Result<(BufferBinding<'a, dyn DynBuffer>, u64), BindingError>
pub fn binding<'a>( &'a self, offset: u64, binding_size: Option<NonZero<u64>>, snatch_guard: &'a SnatchGuard<'_>, ) -> Result<(BufferBinding<'a, dyn DynBuffer>, u64), BindingError>
Create a new hal::BufferBinding for the buffer with offset and
binding_size.
If binding_size is None, then the remainder of the buffer starting
from offset is used.
If the binding would overflow the buffer, then an error is returned.
A zero-size binding at the end of the buffer is permitted here for historical reasons. Although zero-size bindings are permitted by WebGPU, they are not permitted by some backends. The zero-size binding need to be quashed or remapped to a non-zero size, either universally in wgpu-core, or in specific backends that do not support them. See #3170.
Although it seems like it would be simpler and safer to use the resolved
size in the returned hal::BufferBinding, doing this (and removing
redundant logic in backends to resolve the implicit size) was observed
to cause problems in certain CTS tests, so an implicit size
specification is preserved in the output.
Trait Implementations§
§impl Labeled for Buffer
impl Labeled for Buffer
§fn label(&self) -> &str
fn label(&self) -> &str
fn error_ident(&self) -> ResourceErrorIdent
§impl ParentDevice for Buffer
impl ParentDevice for Buffer
fn device(&self) -> &Arc<Device>
fn is_equal(self: &Arc<Self>, other: &Arc<Self>) -> bool
fn same_device_as<O>(&self, other: &O) -> Result<(), DeviceError>where
O: ParentDevice,
fn same_device(&self, device: &Device) -> Result<(), DeviceError>
§impl RawResourceAccess for Buffer
impl RawResourceAccess for Buffer
type DynResource = dyn DynBuffer
§fn raw<'a>(
&'a self,
guard: &'a SnatchGuard<'_>,
) -> Option<&'a <Buffer as RawResourceAccess>::DynResource>
fn raw<'a>( &'a self, guard: &'a SnatchGuard<'_>, ) -> Option<&'a <Buffer as RawResourceAccess>::DynResource>
§fn try_raw<'a>(
&'a self,
guard: &'a SnatchGuard<'_>,
) -> Result<&'a Self::DynResource, DestroyedResourceError>
fn try_raw<'a>( &'a self, guard: &'a SnatchGuard<'_>, ) -> Result<&'a Self::DynResource, DestroyedResourceError>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.