Skip to main content

PboOps

Trait PboOps 

Source
pub unsafe trait PboOps: Send + Sync {
    // Required methods
    fn map_buffer(&self, buffer_id: u32, size: usize) -> Result<PboMapping>;
    fn unmap_buffer(&self, buffer_id: u32) -> Result<()>;
    fn delete_buffer(&self, buffer_id: u32);
}
Expand description

Trait for PBO GL operations, implemented by the image crate.

All methods are blocking — they send commands to the GL thread and wait for completion. Implementations must ensure GL context is current on the thread that executes the actual GL calls.

§Safety

Implementations must ensure:

  • map_buffer returns a valid, aligned pointer to size bytes of CPU-accessible memory that remains valid until unmap_buffer is called.
  • unmap_buffer invalidates the pointer and releases the mapping.
  • delete_buffer frees the GL buffer resources.

Required Methods§

Source

fn map_buffer(&self, buffer_id: u32, size: usize) -> Result<PboMapping>

Map the PBO for CPU read/write access. The returned PboMapping is valid until unmap_buffer is called.

Source

fn unmap_buffer(&self, buffer_id: u32) -> Result<()>

Unmap a previously mapped PBO. Must be called before GL operations on this buffer (GLES 3.0 requirement).

Source

fn delete_buffer(&self, buffer_id: u32)

Delete the PBO. Fire-and-forget — no reply needed. Called from PboTensor’s Drop impl.

Implementors§