Struct kiss3d::resource::GPUVec
[−]
[src]
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]
fn new(data: Vec<T>,
buf_type: BufferType,
alloc_type: AllocationType)
-> GPUVec<T>
buf_type: BufferType,
alloc_type: AllocationType)
-> GPUVec<T>
Creates a new GPUVec
that is not yet uploaded to the GPU.
fn len(&self) -> usize
The length of this vector.
fn data_mut(&mut self) -> &mut Option<Vec<T>>
Mutably accesses the vector if it is available on RAM.
This method will mark this vector as trash
.
fn data(&self) -> &Option<Vec<T>>
Immutably accesses the vector if it is available on RAM.
fn is_on_gpu(&self) -> bool
Returns true
if this vector is already uploaded to the GPU.
fn trash(&self) -> bool
Returns true
if the cpu data and gpu data are out of sync.
fn is_on_ram(&self) -> bool
Returns true
if this vector is available on RAM.
Note that a GPUVec
may be both on RAM and on the GPU.
fn load_to_gpu(&mut self)
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.
fn bind(&mut self)
Binds this vector to the appropriate gpu array.
This does not associate this buffer with any shader attribute.
fn unbind(&mut self)
Unbind this vector to the corresponding gpu buffer.
fn load_to_ram(&mut self)
Loads the vector from the GPU to the RAM.
If the vector is not available on the GPU or already loaded to the RAM, nothing will happen.
fn unload_from_gpu(&mut self)
Unloads this resource from the GPU.
fn unload_from_ram(&mut self)
Removes this resource from the RAM.
This is useful to save memory for vectors required on the GPU only.