Struct glin::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: 'static> SharedBufferStorage<T>[src]

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

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

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

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

pub fn copy_to<U, B: BufferRange<U> + WithBackendMut>(&self, dst: &mut B)[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) -> GLuint[src]

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

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

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

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

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

impl SharedBufferStorage<u8>[src]

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

Trait Implementations

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<T: Eq> Eq for SharedBufferStorage<T>[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<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<T> Pointable for T[src]

type Init = T

The type for initializers.

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.