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]
impl<T: GLPrimitive> GPUVec<T>
pub fn new(
data: Vec<T>,
buf_type: BufferType,
alloc_type: AllocationType
) -> GPUVec<T>
[src]
pub fn new(
data: Vec<T>,
buf_type: BufferType,
alloc_type: AllocationType
) -> GPUVec<T>
Creates a new GPUVec
that is not yet uploaded to the GPU.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
The length of this vector.
pub fn data_mut(&mut self) -> &mut Option<Vec<T>>
[src]
pub 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
.
pub fn data(&self) -> &Option<Vec<T>>
[src]
pub fn data(&self) -> &Option<Vec<T>>
Immutably accesses the vector if it is available on RAM.
pub fn is_on_gpu(&self) -> bool
[src]
pub fn is_on_gpu(&self) -> bool
Returns true
if this vector is already uploaded to the GPU.
pub fn trash(&self) -> bool
[src]
pub fn trash(&self) -> bool
Returns true
if the cpu data and gpu data are out of sync.
pub fn is_on_ram(&self) -> bool
[src]
pub 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.
pub fn load_to_gpu(&mut self)
[src]
pub 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.
pub fn bind(&mut self)
[src]
pub fn bind(&mut self)
Binds this vector to the appropriate gpu array.
This does not associate this buffer with any shader attribute.
pub fn unbind(&mut self)
[src]
pub fn unbind(&mut self)
Unbind this vector to the corresponding gpu buffer.
pub fn unload_from_gpu(&mut self)
[src]
pub fn unload_from_gpu(&mut self)
Unloads this resource from the GPU.
pub fn unload_from_ram(&mut self)
[src]
pub 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.
impl<T: Clone + GLPrimitive> GPUVec<T>
[src]
impl<T: Clone + GLPrimitive> GPUVec<T>
pub fn to_owned(&self) -> Option<Vec<T>>
[src]
pub fn to_owned(&self) -> Option<Vec<T>>
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.