[][src]Struct kiss3d::resource::GPUVec

pub struct GPUVec<T> { /* fields omitted */ }

A vector of elements that can be loaded to the GPU, on the RAM, or both.

Methods

impl<T: GLPrimitive> GPUVec<T>[src]

pub fn new(
    data: Vec<T>,
    buf_type: BufferType,
    alloc_type: AllocationType
) -> GPUVec<T>
[src]

Creates a new GPUVec that is not yet uploaded to the GPU.

pub fn len(&self) -> usize[src]

The length of this vector.

pub fn data_mut(&mut self) -> &mut Option<Vec<T>>[src]

Mutably accesses the vector if it is available on RAM.

This method will mark this vector as trash.

pub fn data(&self) -> &Option<Vec<T>>[src]

Immutably accesses the vector if it is available on RAM.

pub fn is_on_gpu(&self) -> bool[src]

Returns true if this vector is already uploaded to the GPU.

pub fn trash(&self) -> bool[src]

Returns true if the cpu data and gpu data are out of sync.

pub fn is_on_ram(&self) -> bool[src]

Returns true if this vector is available on RAM.

Note that a GPUVec may be both on RAM and on the GPU.

pub fn load_to_gpu(&mut self)[src]

Loads the vector from the RAM to the GPU.

If the vector is not available on RAM or already loaded to the GPU, nothing will happen.

pub fn bind(&mut self)[src]

Binds this vector to the appropriate gpu array.

This does not associate this buffer with any shader attribute.

pub fn unbind(&mut self)[src]

Unbind this vector to the corresponding gpu buffer.

pub fn unload_from_gpu(&mut self)[src]

Unloads this resource from the GPU.

pub fn unload_from_ram(&mut self)[src]

Removes this resource from the RAM.

This is useful to save memory for vectors required on the GPU only.

impl<T: Clone + GLPrimitive> GPUVec<T>[src]

pub fn to_owned(&self) -> Option<Vec<T>>[src]

Returns this vector as an owned vector if it is available on RAM.

If it has been uploaded to the GPU, and unloaded from the RAM, call load_to_ram first to make the data accessible.

Auto Trait Implementations

impl<T> Send for GPUVec<T> where
    T: Send

impl<T> Sync for GPUVec<T> where
    T: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.

impl<T> Same for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>, 

impl<T> Downcast for T where
    T: Any

impl<T> Erased for T