Struct glium::buffer::BufferViewSlice
source · pub struct BufferViewSlice<'a, T>where
T: Content + 'a + ?Sized,{ /* private fields */ }
Expand description
DEPRECATED. Only here for backward compatibility. Represents a sub-part of a buffer.
Implementations§
source§impl<'a, T> BufferSlice<'a, T>where
T: Content + 'a + ?Sized,
impl<'a, T> BufferSlice<'a, T>where T: Content + 'a + ?Sized,
sourcepub fn get_context(&self) -> &Rc<Context>
pub fn get_context(&self) -> &Rc<Context>
Returns the context corresponding to this buffer.
sourcepub fn write(&self, data: &T)
pub fn write(&self, data: &T)
Uploads some data in this buffer.
Implementation
- For persistent-mapped buffers, waits untils the data is no longer used by the GPU then memcpies the data to the mapping.
- For immutable buffers, creates a temporary buffer that contains the data then calls
glCopyBufferSubData
to copy from the temporary buffer to the real one. - For other types, calls
glBufferSubData
.
Panic
Panics if the length of data
is different from the length of this buffer.
sourcepub fn invalidate(&self)
pub fn invalidate(&self)
Invalidates the content of the slice. The data becomes undefined.
This operation is a no-op if the backend doesn’t support it and for persistent-mapped buffers.
Implementation
Calls glInvalidateBufferSubData
if supported.
sourcepub fn copy_to<S>(&self, target: S) -> Result<(), CopyError>where
S: Into<BufferSlice<'a, T>>,
pub fn copy_to<S>(&self, target: S) -> Result<(), CopyError>where S: Into<BufferSlice<'a, T>>,
Copies the content of this slice to another slice.
Panic
Panics if T
is unsized and the other buffer is too small.
sourcepub unsafe fn slice_custom<F, R>(&self, f: F) -> BufferSlice<'a, R>where
F: for<'r> FnOnce(&'r T) -> &'r R,
R: Content + ?Sized,
pub unsafe fn slice_custom<F, R>(&self, f: F) -> BufferSlice<'a, R>where F: for<'r> FnOnce(&'r T) -> &'r R, R: Content + ?Sized,
Builds a slice that contains an element from inside the buffer.
This method builds an object that represents a slice of the buffer. No actual operation OpenGL is performed.
Example
#[derive(Copy, Clone)]
struct BufferContent {
value1: u16,
value2: u16,
}
let slice = unsafe { buffer.slice_custom(|content| &content.value2) };
Safety
The object whose reference is passed to the closure is uninitialized. Therefore you must not access the content of the object.
You must return a reference to an element from the parameter. The closure must not panic.
sourcepub fn as_slice_any(&self) -> BufferAnySlice<'a>
pub fn as_slice_any(&self) -> BufferAnySlice<'a>
Builds a slice-any containing the whole subbuffer.
This method builds an object that represents a slice of the buffer. No actual operation OpenGL is performed.
source§impl<'a, T> BufferSlice<'a, [T]>where
T: PixelValue + 'a,
impl<'a, T> BufferSlice<'a, [T]>where T: PixelValue + 'a,
sourcepub fn read_as_texture_1d<S>(&self) -> Result<S, ReadError>where
S: Texture1dDataSink<T>,
pub fn read_as_texture_1d<S>(&self) -> Result<S, ReadError>where S: Texture1dDataSink<T>,
Reads the content of the buffer.
Trait Implementations§
source§impl<'a, T> Clone for BufferSlice<'a, T>where
T: Content + 'a + Clone + ?Sized,
impl<'a, T> Clone for BufferSlice<'a, T>where T: Content + 'a + Clone + ?Sized,
source§fn clone(&self) -> BufferSlice<'a, T>
fn clone(&self) -> BufferSlice<'a, T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'a, T> From<&'a Buffer<T>> for BufferSlice<'a, T>where
T: Content + 'a + ?Sized,
impl<'a, T> From<&'a Buffer<T>> for BufferSlice<'a, T>where T: Content + 'a + ?Sized,
source§fn from(b: &'a Buffer<T>) -> BufferSlice<'a, T>
fn from(b: &'a Buffer<T>) -> BufferSlice<'a, T>
source§impl<'a> From<&'a DrawCommandsIndicesBuffer> for BufferSlice<'a, [DrawCommandIndices]>
impl<'a> From<&'a DrawCommandsIndicesBuffer> for BufferSlice<'a, [DrawCommandIndices]>
source§fn from(
b: &'a DrawCommandsIndicesBuffer
) -> BufferSlice<'a, [DrawCommandIndices]>
fn from( b: &'a DrawCommandsIndicesBuffer ) -> BufferSlice<'a, [DrawCommandIndices]>
source§impl<'a> From<&'a DrawCommandsNoIndicesBuffer> for BufferSlice<'a, [DrawCommandNoIndices]>
impl<'a> From<&'a DrawCommandsNoIndicesBuffer> for BufferSlice<'a, [DrawCommandNoIndices]>
source§fn from(
b: &'a DrawCommandsNoIndicesBuffer
) -> BufferSlice<'a, [DrawCommandNoIndices]>
fn from( b: &'a DrawCommandsNoIndicesBuffer ) -> BufferSlice<'a, [DrawCommandNoIndices]>
source§impl<'a, T> From<&'a IndexBuffer<T>> for BufferSlice<'a, [T]>where
T: Index,
impl<'a, T> From<&'a IndexBuffer<T>> for BufferSlice<'a, [T]>where T: Index,
source§fn from(b: &'a IndexBuffer<T>) -> BufferSlice<'a, [T]>
fn from(b: &'a IndexBuffer<T>) -> BufferSlice<'a, [T]>
source§impl<'a, T> From<&'a UniformBuffer<T>> for BufferSlice<'a, T>where
T: Content + ?Sized,
impl<'a, T> From<&'a UniformBuffer<T>> for BufferSlice<'a, T>where T: Content + ?Sized,
source§fn from(b: &'a UniformBuffer<T>) -> BufferSlice<'a, T>
fn from(b: &'a UniformBuffer<T>) -> BufferSlice<'a, T>
source§impl<'a, T> From<&'a VertexBuffer<T>> for BufferSlice<'a, [T]>where
T: Copy,
impl<'a, T> From<&'a VertexBuffer<T>> for BufferSlice<'a, [T]>where T: Copy,
source§fn from(b: &'a VertexBuffer<T>) -> BufferSlice<'a, [T]>
fn from(b: &'a VertexBuffer<T>) -> BufferSlice<'a, [T]>
source§impl<'a, T> From<&'a mut Buffer<T>> for BufferSlice<'a, T>where
T: Content + 'a + ?Sized,
impl<'a, T> From<&'a mut Buffer<T>> for BufferSlice<'a, T>where T: Content + 'a + ?Sized,
source§fn from(b: &'a mut Buffer<T>) -> BufferSlice<'a, T>
fn from(b: &'a mut Buffer<T>) -> BufferSlice<'a, T>
source§impl<'a, T> From<BufferMutSlice<'a, T>> for BufferSlice<'a, T>where
T: Content + 'a + ?Sized,
impl<'a, T> From<BufferMutSlice<'a, T>> for BufferSlice<'a, T>where T: Content + 'a + ?Sized,
source§fn from(s: BufferMutSlice<'a, T>) -> BufferSlice<'a, T>
fn from(s: BufferMutSlice<'a, T>) -> BufferSlice<'a, T>
source§impl<'a, T> From<IndexBufferSlice<'a, T>> for BufferSlice<'a, [T]>where
T: Index,
impl<'a, T> From<IndexBufferSlice<'a, T>> for BufferSlice<'a, [T]>where T: Index,
source§fn from(b: IndexBufferSlice<'a, T>) -> BufferSlice<'a, [T]>
fn from(b: IndexBufferSlice<'a, T>) -> BufferSlice<'a, [T]>
source§impl<'a, T> From<VertexBufferSlice<'a, T>> for BufferSlice<'a, [T]>where
T: Copy,
impl<'a, T> From<VertexBufferSlice<'a, T>> for BufferSlice<'a, [T]>where T: Copy,
source§fn from(b: VertexBufferSlice<'a, T>) -> BufferSlice<'a, [T]>
fn from(b: VertexBufferSlice<'a, T>) -> BufferSlice<'a, [T]>
impl<'a, T> Copy for BufferSlice<'a, T>where T: Content + 'a + Copy + ?Sized,
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for BufferSlice<'a, T>
impl<'a, T> !Send for BufferSlice<'a, T>
impl<'a, T> !Sync for BufferSlice<'a, T>
impl<'a, T: ?Sized> Unpin for BufferSlice<'a, T>
impl<'a, T> !UnwindSafe for BufferSlice<'a, T>
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
source§impl<T> Content for Twhere
T: Copy,
impl<T> Content for Twhere T: Copy,
source§fn read<F, E>(size: usize, f: F) -> Result<T, E>where
F: FnOnce(&mut T) -> Result<(), E>,
fn read<F, E>(size: usize, f: F) -> Result<T, E>where F: FnOnce(&mut T) -> Result<(), E>,
Owned
.