[−][src]Struct web_glitz::pipeline::graphics::IndexBufferView
A view on a segment or the whole of an IndexBuffer.
Implementations
impl<'a, T> IndexBufferView<'a, T>[src]
pub fn size_in_bytes(&self) -> usize[src]
The size in bytes of the viewed index buffer region.
pub fn usage_hint(&self) -> UsageHint[src]
Returns the UsageHint that was specified for the IndexBuffer viewed by this IndexBufferView when it was created.
See UsageHint for details.
pub fn len(&self) -> usize[src]
Returns the number of elements viewed by this IndexBufferView.
pub fn get<R>(&self, range: R) -> Option<IndexBufferView<'_, T>> where
R: IndexBufferViewSliceIndex<T>, [src]
R: IndexBufferViewSliceIndex<T>,
Returns an IndexBufferView on a slice of the indices this IndexBuffer based on the given
range or None if the range is out of bounds
Examples
use web_glitz::pipeline::graphics::{IndexBuffer, IndexBufferView}; use web_glitz::buffer::UsageHint; let index_buffer: IndexBuffer<u16> = context.create_index_buffer([1, 2, 3, 4], UsageHint::StreamDraw); let view = IndexBufferView::from(&index_buffer); view.get(1..3); // Some IndexBufferView<[f32]> containing `[2.0, 3.0]` view.get(..2); // Some IndexBufferView<[f32]> containing `[1.0 2.0]`
pub unsafe fn get_unchecked<R>(&self, range: R) -> IndexBufferView<'_, T> where
R: IndexBufferViewSliceIndex<T>, [src]
R: IndexBufferViewSliceIndex<T>,
Returns an IndexBufferView on a slice of the indices this IndexBuffer based on the given
range, without performing any bounds checks
Examples
use web_glitz::pipeline::graphics::{IndexBuffer, IndexBufferView}; use web_glitz::buffer::UsageHint; let index_buffer: IndexBuffer<u16> = context.create_index_buffer([1, 2, 3, 4], UsageHint::StreamDraw); let view = IndexBufferView::from(&index_buffer); unsafe { view.get_unchecked(1..3) }; // IndexBufferView<[f32]> containing `[2.0, 3.0]`
Unsafe
Only safe if range is in bounds. See [get] for a safe alternative.
impl<'a, T> IndexBufferView<'a, T> where
T: IndexFormat, [src]
T: IndexFormat,
pub fn upload_command<D>(&self, data: D) -> IndexBufferUploadCommand<T, D> where
D: Borrow<[T]> + Send + Sync + 'static, [src]
D: Borrow<[T]> + Send + Sync + 'static,
Returns a command which, when executed will replace the indices viewed contained by this
IndexBufferView with the indices in given index_data.
If the index_data contains fewer elements than the slice viewed by this IndexBufferView,
then only the first N elements will be replaced, where N is the number of elements in
the given index_data.
If the index_data contains more elements than the slice viewed this IndexBufferView,
then only the first M elements in the index_data will be used to update the index
buffer, where M is the number of elements viewed by the IndexBufferView.
This will modify the viewed IndexBuffer, the buffer (and any other views on the same data) will be affected by this change.
impl<'a, T> IndexBufferView<'a, MaybeUninit<T>> where
T: IndexFormat, [src]
T: IndexFormat,
pub fn upload_command<D>(
&self,
data: D
) -> IndexBufferUploadCommand<MaybeUninit<T>, D> where
D: Borrow<[MaybeUninit<T>]> + Send + Sync + 'static, [src]
&self,
data: D
) -> IndexBufferUploadCommand<MaybeUninit<T>, D> where
D: Borrow<[MaybeUninit<T>]> + Send + Sync + 'static,
Returns a command which, when executed will replace the indices viewed contained by this
IndexBufferView with the indices in given data.
If the data contains fewer elements than the slice viewed by this IndexBufferView,
then only the first N elements will be replaced, where N is the number of elements in
the given index_data.
If the index_data contains more elements than the slice viewed this IndexBufferView,
then only the first M elements in the index_data will be used to update the index
buffer, where M is the number of elements viewed by the IndexBufferView.
This will modify the viewed IndexBuffer, the buffer (and any other views on the same data) will be affected by this change.
impl<'a, T> IndexBufferView<'a, MaybeUninit<T>> where
T: IndexFormat, [src]
T: IndexFormat,
pub unsafe fn assume_init(self) -> IndexBufferView<'a, T>[src]
Converts to IndexBufferView<T>.
Safety
Its up to the user to guarantee that any tasks that read buffer region viewed by this view, is only executed after the viewed region is initialized. Note that certain tasks may wait on GPU fences and allow a runtime to progress other tasks while its waiting on the fence. As such, submitting your initialization tasks as part of a task that includes fencing (these are typically tasks that include "download" commands), may not guarantee that the buffer was initialized before any tasks that are submitted later will begin executing.
Trait Implementations
impl<'a, T> Clone for IndexBufferView<'a, T>[src]
fn clone(&self) -> Self[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<'a, T> Copy for IndexBufferView<'a, T>[src]
impl<'a, T> From<&'a IndexBuffer<T>> for IndexBufferView<'a, T>[src]
fn from(buffer: &'a IndexBuffer<T>) -> IndexBufferView<'a, T>[src]
impl<'a, T: Hash> Hash for IndexBufferView<'a, T>[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl<'a, T> IndexData for IndexBufferView<'a, T> where
T: IndexFormat, [src]
T: IndexFormat,
fn descriptor(&self) -> IndexDataDescriptor[src]
impl<'a, T: PartialEq> PartialEq<IndexBufferView<'a, T>> for IndexBufferView<'a, T>[src]
fn eq(&self, other: &IndexBufferView<'a, T>) -> bool[src]
fn ne(&self, other: &IndexBufferView<'a, T>) -> bool[src]
impl<'a, T> StructuralPartialEq for IndexBufferView<'a, T>[src]
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for IndexBufferView<'a, T>
impl<'a, T> !Send for IndexBufferView<'a, T>
impl<'a, T> !Sync for IndexBufferView<'a, T>
impl<'a, T> Unpin for IndexBufferView<'a, T>
impl<'a, T> !UnwindSafe for IndexBufferView<'a, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<D, T> IntoBuffer<T> for D where
D: Borrow<T> + 'static,
T: Copy + 'static, [src]
D: Borrow<T> + 'static,
T: Copy + 'static,
fn into_buffer<Rc>(Self, &Rc, BufferId, UsageHint) -> Buffer<T> where
Rc: RenderingContext + Clone + 'static, [src]
Rc: RenderingContext + Clone + 'static,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,