Struct glium::uniforms::UniformBuffer [] [src]

pub struct UniformBuffer<T: ?Sized> where T: Content {
    // some fields omitted
}

Buffer that contains a uniform block.

Methods

impl<T> UniformBuffer<T> where T: Copy

fn new<F>(facade: &F, data: T) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Uploads data in the uniforms buffer.

fn dynamic<F>(facade: &F, data: T) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Uploads data in the uniforms buffer.

fn persistent<F>(facade: &F, data: T) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Uploads data in the uniforms buffer.

fn immutable<F>(facade: &F, data: T) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Uploads data in the uniforms buffer.

fn empty<F>(facade: &F) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Creates an empty buffer.

fn empty_dynamic<F>(facade: &F) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Creates an empty buffer.

fn empty_persistent<F>(facade: &F) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Creates an empty buffer.

fn empty_immutable<F>(facade: &F) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Creates an empty buffer.

impl<T: ?Sized> UniformBuffer<T> where T: Content

fn empty_unsized<F>(facade: &F, size: usize) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Creates an empty buffer.

Panic

Panicks if the size passed as parameter is not suitable for the type of data.

fn empty_unsized_dynamic<F>(facade: &F, size: usize) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Creates an empty buffer.

Panic

Panicks if the size passed as parameter is not suitable for the type of data.

fn empty_unsized_persistent<F>(facade: &F, size: usize) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Creates an empty buffer.

Panic

Panicks if the size passed as parameter is not suitable for the type of data.

fn empty_unsized_immutable<F>(facade: &F, size: usize) -> Result<UniformBuffer<T>, BufferCreationError> where F: Facade

Creates an empty buffer.

Panic

Panicks if the size passed as parameter is not suitable for the type of data.

Methods from Deref<Target=BufferView<T>>

fn new<F>(facade: &F, data: &T, ty: BufferType, mode: BufferMode) -> Result<BufferView<T>, BufferCreationError> where F: Facade

Builds a new buffer containing the given data. The size of the buffer is equal to the size of the data.

fn empty_unsized<F>(facade: &F, ty: BufferType, size: usize, mode: BufferMode) -> Result<BufferView<T>, BufferCreationError> where F: Facade

Builds a new buffer of the given size.

fn get_context(&self) -> &Rc<Context>

Returns the context corresponding to this buffer.

fn get_size(&self) -> usize

Returns the size in bytes of this buffer.

fn is_persistent(&self) -> bool

Returns true if this buffer uses persistent mapping.

fn write(&self, data: &T)

Uploads some data in this buffer.

Panic

Panics if the length of data is different from the length of this buffer.

fn invalidate(&self)

Invalidates the content of the buffer. The data becomes undefined.

You should call this if you only use parts of a buffer. For example if you want to use the first half of the buffer, you invalidate the whole buffer then write the first half.

This operation is a no-op if the backend doesn't support it.

fn read(&self) -> Result<T, ReadError>

Reads the content of the buffer.

fn map(&mut self) -> Mapping<T>

Maps the buffer in memory for both reading and writing.

fn map_read(&mut self) -> ReadMapping<T>

Maps the buffer in memory for reading.

fn map_write(&mut self) -> WriteMapping<T>

Maps the buffer in memory for writing only.

fn as_slice_any(&self) -> BufferViewAnySlice

Builds a slice-any containing the whole subbuffer.

fn empty<F>(facade: &F, ty: BufferType, mode: BufferMode) -> Result<BufferView<T>, BufferCreationError> where F: Facade

Builds a new buffer of the given size.

fn empty_array<F>(facade: &F, ty: BufferType, len: usize, mode: BufferMode) -> Result<BufferView<[T]>, BufferCreationError> where F: Facade

Builds a new buffer of the given size.

fn len(&self) -> usize

Returns the number of elements in this buffer.

fn slice(&self, range: Range<usize>) -> Option<BufferViewSlice<[T]>>

Builds a slice of this subbuffer. Returns None if out of range.

fn slice_mut(&mut self, range: Range<usize>) -> Option<BufferViewMutSlice<[T]>>

Builds a slice of this subbuffer. Returns None if out of range.

fn as_slice(&self) -> BufferViewSlice<[T]>

Builds a slice containing the whole subbuffer.

fn as_mut_slice(&mut self) -> BufferViewMutSlice<[T]>

Builds a slice containing the whole subbuffer.

fn read_as_texture_1d<S>(&self) -> Result<S, ReadError> where S: Texture1dDataSink<T>

Reads the content of the buffer.

Trait Implementations

impl<T: ?Sized> Deref for UniformBuffer<T> where T: Content

type Target = BufferView<T>

fn deref(&self) -> &BufferView<T>

impl<T: ?Sized> DerefMut for UniformBuffer<T> where T: Content

fn deref_mut(&mut self) -> &mut BufferView<T>

impl<'a, T: ?Sized> AsUniformValue for &'a UniformBuffer<T> where T: UniformBlock + Content

fn as_uniform_value(&self) -> UniformValue

Derived Implementations

impl<T: Debug + ?Sized> Debug for UniformBuffer<T> where T: Content, T: Debug

fn fmt(&self, __arg_0: &mut Formatter) -> Result