[−][src]Struct kiss3d::resource::GPUVec
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]
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]
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
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
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>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T> Downcast for T where
T: Any,
T: Any,