pub enum ArrayHandle {
Buffer(Buffer),
Texel(TextureView),
}Expand description
A flat array of fixed-size elements, as a bindable resource.
A device with storage buffers holds an array in one; a device without them —
WebGL2 — holds the same bytes in a TexelArray the shader reads with
textureLoad. A caller that has to work on both builds its bind group from
this handle rather than from a buffer, so the two paths differ in how the
array is uploaded and in nothing else.
See the module docs for how the texel path lays the bytes out.
Variants§
Buffer(Buffer)
A storage buffer holding the whole array.
Texel(TextureView)
A texture holding the whole array.
Implementations§
Source§impl ArrayHandle
impl ArrayHandle
Sourcepub fn binding_resource(&self) -> BindingResource<'_>
pub fn binding_resource(&self) -> BindingResource<'_>
The bind-group resource that binds this array.
Sourcepub fn layout_entry(
&self,
binding: u32,
visibility: ShaderStages,
element_size: u64,
) -> BindGroupLayoutEntry
pub fn layout_entry( &self, binding: u32, visibility: ShaderStages, element_size: u64, ) -> BindGroupLayoutEntry
The layout entry binding an array of element_size-byte elements held
this way.
This is the Rust half of the shader’s interface: the composed variant declares a storage buffer on the buffer path and a non-filterable float texture on the texel path, and the two have to agree.
Trait Implementations§
Source§impl Clone for ArrayHandle
impl Clone for ArrayHandle
Source§impl Debug for ArrayHandle
impl Debug for ArrayHandle
impl Eq for ArrayHandle
Source§impl From<ArrayHandle> for Resource
impl From<ArrayHandle> for Resource
Source§fn from(value: ArrayHandle) -> Self
fn from(value: ArrayHandle) -> Self
Source§impl PartialEq for ArrayHandle
impl PartialEq for ArrayHandle
Source§impl ResourceKind for ArrayHandle
impl ResourceKind for ArrayHandle
Source§fn borrow_from(resource: &Resource) -> Option<&Self>
fn borrow_from(resource: &Resource) -> Option<&Self>
Resource, or None when that
resource is of another kind.Source§fn take_from(resource: Resource) -> Option<Self>
fn take_from(resource: Resource) -> Option<Self>
Resource, or None when that
resource is of another kind.Source§fn into_resource(self) -> Resource
fn into_resource(self) -> Resource
Resource.impl StructuralPartialEq for ArrayHandle
Auto Trait Implementations§
impl !RefUnwindSafe for ArrayHandle
impl !UnwindSafe for ArrayHandle
impl Forget for ArrayHandle
impl Freeze for ArrayHandle
impl Send for ArrayHandle
impl Sync for ArrayHandle
impl Unpin for ArrayHandle
impl UnsafeUnpin for ArrayHandle
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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