Struct rin::gl::buffer::BufferStorage[][src]

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

Inmmutable buffer object allocated with gl(Named)BufferStorage

Inmmutability here refers to the same concept OpenGL understands by it. The data in the buffer can still be modified but it can’t be reallocated

Implementations

impl<T> BufferStorage<T> where
    T: 'static, 
[src]

pub fn update(&mut self, data: &[T])[src]

Loads the passed data at the beginning of the buffer

Will panic if the buffer is not big enough or not allocated at all

see: gl(Named)BufferSubData

pub fn map_read(
    &mut self,
    flags: MapReadFlags
) -> Result<MapRead<'_, T, BufferStorage<T>>, Error>
[src]

Maps a buffer object’s data store

Pass a closure that receives the mapped buffer to access it

see glMapBuffer

pub fn map_write(
    &mut self,
    flags: MapWriteFlags
) -> Result<MapWrite<'_, T, BufferStorage<T>>, Error>
[src]

Maps a buffer object’s data store

Pass a closure that receives the mapped buffer to access it

see glMapBuffer

pub fn map_read_write(
    &mut self,
    flags: MapReadWriteFlags
) -> Result<MapReadWrite<'_, T, BufferStorage<T>>, Error>
[src]

Maps a buffer object’s data store

Pass a closure that receives the mapped buffer to access it

see glMapBuffer

pub unsafe fn map_read_slice(
    &mut self,
    flags: MapReadFlags
) -> Result<&[T], Error>
[src]

Maps a buffer object’s data store as a slice

This operation is unsafe cause the buffer needs to be unmapped manually so it could be accessed while mapped which is undefined behaviour

see glMapBuffer

pub unsafe fn map_write_slice(
    &mut self,
    flags: MapWriteFlags
) -> Result<&mut [T], Error>
[src]

Maps a buffer object’s data store as a slice

This operation is unsafe cause the buffer needs to be unmapped manually so it could be accessed while mapped which is undefined behaviour

see glMapBuffer

pub unsafe fn map_read_write_slice(
    &mut self,
    flags: MapReadWriteFlags
) -> Result<&mut [T], Error>
[src]

Maps a buffer object’s data store as a slice

This operation is unsafe cause the buffer needs to be unmapped manually so it could be accessed while mapped which is undefined behaviour

see glMapBuffer

pub unsafe fn unmap(&mut self)[src]

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

On creation the storage was passed the GL_MAP_PERSISTENT_BIT

The client may request that the server read from or write to the buffer while it is mapped. The client’s pointer to the data store remains valid so long as the data store is mapped, even during execution of drawing or dispatch commands.

If the storage is not persistent, calls to persistent_map_* will fail

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

On creation the storage was passed the GL_MAP_READ_BIT

The data store may be mapped by the client for read access and a pointer in the client’s address space obtained that may be read from.

If the storage is not read map, calls to any read map will fail

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

On creation the storage was passed the GL_MAP_WRITE_BIT

The data store may be mapped by the client for write access and a pointer in the client’s address space obtained that may be written through.

If the storage is not read write, calls to any write map will fail

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

On creation the storage was passed the GL_DYNAMIC_STORAGE_BIT

The contents of the data store may be updated after creation through calls to update (glSubBufferData). If this bit is not set, the buffer content may not be directly updated by the client. The data argument may be used to specify the initial content of the buffer’s data store regardless of the presence of the GL_DYNAMIC_STORAGE_BIT. Regardless of the presence of this bit, buffers may always be updated with server-side calls such as copy (glCopyBufferSubData) and clear (glClearBufferSubData).

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

On creation the storage was passed the gL_MAP_COHERENT_BIT

Shared access to buffers that are simultaneously mapped for client access and are used by the server will be coherent, so long as that mapping is performed using glMapBufferRange. That is, data written to the store by either the client or server will be immediately visible to the other with no further action taken by the application. In particular,

  • If GL_MAP_COHERENT_BIT is not set and the client performs a write followed by a call to the glMemoryBarrier command with the GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT set, then in subsequent commands the server will see the writes.

  • If GL_MAP_COHERENT_BIT is set and the client performs a write, then in subsequent commands the server will see the writes.

  • If GL_MAP_COHERENT_BIT is not set and the server performs a write, the application must call glMemoryBarrier with the GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT set and then call glFenceSync with GL_SYNC_GPU_COMMANDS_COMPLETE (or glFinish). Then the CPU will see the writes after the sync is complete.

  • If GL_MAP_COHERENT_BIT is set and the server does a write, the app must call FenceSync with GL_SYNC_GPU_COMMANDS_COMPLETE (or glFinish). Then the CPU will see the writes after the sync is complete.

pub fn map_persistent_read(
    &self,
    flags: MapReadFlags
) -> Result<MapPersistentRead<T, &BufferStorage<T>>, Error>
[src]

Persistently maps a buffer object’s data store

If the storage wasn’t created as pesistent this call will fail.

Persistent maps can be send and shared with other threads but need to be dropped from the same thread they were created from. The destructor will panic otherwise.

A common pattern to do this is to return the map as the return value of a thread and receive it by explicitly joining the thread using it’s join handle from the original thread.

see glMapBuffer with GL_MAP_PERSISTENT_BIT

pub fn into_map_persistent_read(
    self,
    flags: MapReadFlags
) -> Result<MapPersistentRead<T, BufferStorage<T>>, Error>
[src]

Moves the buffer into a persistent map

If the storage wasn’t created as pesistent this call will fail

Persistent maps can be send and shared with other threads but need to be dropped from the same thread they were created from. The destructor will panic otherwise.

A common pattern to do this is to return the map as the return value of a thread and receive it by explicitly joining the thread using it’s join handle from the original thread.

see glMapBuffer with GL_MAP_PERSISTENT_BIT

pub fn map_persistent_write(
    &self,
    flags: MapWriteFlags
) -> Result<MapPersistentWrite<T, &BufferStorage<T>>, Error>
[src]

Persistently maps a buffer object’s data store

If the storage wasn’t created as pesistent this call will fail

Persistent maps can be send and shared with other threads but need to be dropped from the same thread they were created from. The destructor will panic otherwise.

A common pattern to do this is to return the map as the return value of a thread and receive it by explicitly joining the thread using it’s join handle from the original thread.

see glMapBuffer with GL_MAP_PERSISTENT_BIT

pub fn into_map_persistent_write(
    self,
    flags: MapWriteFlags
) -> Result<MapPersistentWrite<T, BufferStorage<T>>, Error>
[src]

Moves the buffer into a persistent map

If the storage wasn’t created as pesistent this call will fail

see glMapBuffer with GL_MAP_PERSISTENT_BIT

pub fn map_persistent_read_write(
    &self,
    flags: MapReadWriteFlags
) -> Result<MapPersistentReadWrite<T, &BufferStorage<T>>, Error>
[src]

Persistently maps a buffer object’s data store

If the storage wasn’t created as pesistent this call will fail

Persistent maps can be send and shared with other threads but need to be dropped from the same thread they were created from. The destructor will panic otherwise.

A common pattern to do this is to return the map as the return value of a thread and receive it by explicitly joining the thread using it’s join handle from the original thread.

see glMapBuffer with GL_MAP_PERSISTENT_BIT

pub fn into_map_persistent_read_write(
    self,
    flags: MapReadWriteFlags
) -> Result<MapPersistentReadWrite<T, BufferStorage<T>>, Error>
[src]

Moves the buffer into a persistent map

If the storage wasn’t created as pesistent this call will fail

Persistent maps can be send and shared with other threads but need to be dropped from the same thread they were created from. The destructor will panic otherwise.

A common pattern to do this is to return the map as the return value of a thread and receive it by explicitly joining the thread using it’s join handle from the original thread.

see glMapBuffer with GL_MAP_PERSISTENT_BIT

pub fn copy_to<U, B>(&self, dst: &mut B) where
    B: BufferRange<U> + WithBackendMut
[src]

Copy one buffer into another

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

Number of elements on the last update

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

If there’s no elements loaded in the buffer

This is len == 0 not capacity == 0

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

Allocated capacity of the buffer in number of elements

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

Total bytes on the last update

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

Total capcacity of the buffer in bytes

pub fn id(&self) -> u32[src]

OpenGL id

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

Stride of the buffer type

pub fn into_shared(self) -> SharedBufferStorage<T>[src]

Consume into a shared buffer

pub fn range<R>(
    &self,
    range: R
) -> Range<T, BufferStorage<T>, &BufferStorage<T>> where
    R: InputRange
[src]

Get a range from the buffer

Useful to do operations on portions of the buffer

Panics if the range is out of bounds

pub fn range_mut<R>(
    &mut self,
    range: R
) -> Range<T, BufferStorage<T>, &mut BufferStorage<T>> where
    R: InputRange
[src]

Get a mutable range from the buffer

Useful to do operations on portions of the buffer

Panics if the range is out of bounds

pub fn into_range<R>(
    self,
    range: R
) -> Range<T, BufferStorage<T>, BufferStorage<T>> where
    R: InputRange
[src]

Consumes the buffer into a range

Panics if the range is out of bounds

impl BufferStorage<u8>[src]

pub fn cast<T>(self) -> BufferStorage<T>[src]

Trait Implementations

impl<'a, '_, T> BufferRange<T> for &'_ BufferStorage<T> where
    T: 'static, 
[src]

impl<T> BufferRange<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> BufferRangeMut<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> Cast<T> for BufferStorage<u8>[src]

type CastTo = BufferStorage<T>

impl<T> Debug for BufferStorage<T> where
    T: Debug
[src]

impl<T> From<BufferStorage<T>> for SharedBufferStorage<T> where
    T: 'static, 
[src]

impl<T> MapPersistent<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> MapPersistentMut<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> MapPersistentRange<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> MapPersistentRangeMut<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> MapRange<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> MapRangeMut<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> PartialEq<BufferStorage<T>> for BufferStorage<T>[src]

impl<'a, '_, T> TypedBuffer<T> for &'_ BufferStorage<T> where
    T: 'static, 
[src]

impl<T> TypedBuffer<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<'a, T> TypedBufferMut<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> WithBackend for BufferStorage<T>[src]

impl<T> WithBackendMut for BufferStorage<T>[src]

impl<T> WithMapRange<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> WithMapRangeMut<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> BufferExt<T> for BufferStorage<T> where
    T: 'static, 
[src]

impl<T> Eq for BufferStorage<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for BufferStorage<T>

impl<T> !Send for BufferStorage<T>

impl<T> !Sync for BufferStorage<T>

impl<T> Unpin for BufferStorage<T> where
    T: Unpin

impl<T> !UnwindSafe for BufferStorage<T>

Blanket Implementations

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

impl<T> Any for T where
    T: Any
[src]

impl<'a, B> AttributeBufferBinding for B where
    B: BufferRange<u32> + ?Sized
[src]

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

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

impl<T> Downcast for T where
    T: Any
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

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

impl<V> IntoPnt<V> for V[src]

impl<V> IntoVec<V> for V[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

impl<T, M> MapRange<T> for M where
    M: WithMapRange<T>, 
[src]