Struct rin::gl::SharedBufferStorage[][src]

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

Wrapper around a BufferStorage with internal reference counting

Useful for example when the same buffer or ranges of the same buffer are to be used in different VAOs

Implementations

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

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

pub fn with_map_read<F>(&self, flags: MapReadFlags, f: F) -> Result<(), Error> where
    F: FnMut(&[T]), 
[src]

pub unsafe fn map_write<F>(
    &mut self,
    flags: MapWriteFlags,
    f: F
) -> Result<(), Error> where
    F: FnMut(&mut [T]), 
[src]

pub fn map_read_write<F>(
    &mut self,
    flags: MapReadWriteFlags,
    f: F
) -> Result<(), Error> where
    F: FnMut(&mut [T]), 
[src]

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

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

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

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

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

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

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

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

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

pub fn range_mut<R>(
    &mut self,
    range: R
) -> Range<T, SharedBufferStorage<T>, SharedBufferStorage<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 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, &SharedBufferStorage<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, SharedBufferStorage<T>>, Error>
[src]

pub fn map_persistent_write(
    &self,
    flags: MapWriteFlags
) -> Result<MapPersistentWrite<T, &SharedBufferStorage<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, SharedBufferStorage<T>>, Error>
[src]

pub fn map_persistent_read_write(
    &self,
    flags: MapReadWriteFlags
) -> Result<MapPersistentReadWrite<T, &SharedBufferStorage<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, SharedBufferStorage<T>>, Error>
[src]

impl SharedBufferStorage<u8>[src]

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

Trait Implementations

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

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

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

impl<T> Cast<T> for SharedBufferStorage<u8> where
    T: 'static, 
[src]

impl<T> Clone for SharedBufferStorage<T>[src]

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

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

impl InternalCreation<SharedBufferStorage<u8>> for Allocator<SharedBufferStorage<u8>>[src]

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

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

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

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

impl<T> PartialEq<SharedBufferStorage<T>> for SharedBufferStorage<T> where
    T: PartialEq<T>, 
[src]

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

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

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

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

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

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

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

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

impl<T> Eq for SharedBufferStorage<T> where
    T: Eq
[src]

impl<T> StructuralEq for SharedBufferStorage<T>[src]

impl<T> StructuralPartialEq for SharedBufferStorage<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for SharedBufferStorage<T>

impl<T> !Send for SharedBufferStorage<T>

impl<T> !Sync for SharedBufferStorage<T>

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

impl<T> !UnwindSafe for SharedBufferStorage<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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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]