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_bufferreturns a valid, aligned pointer tosizebytes of CPU-accessible memory that remains valid untilunmap_bufferis called.unmap_bufferinvalidates the pointer and releases the mapping.delete_bufferfrees the GL buffer resources.
Required Methods§
Sourcefn map_buffer(&self, buffer_id: u32, size: usize) -> Result<PboMapping>
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.
Sourcefn unmap_buffer(&self, buffer_id: u32) -> Result<()>
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).
Sourcefn delete_buffer(&self, buffer_id: u32)
fn delete_buffer(&self, buffer_id: u32)
Delete the PBO. Fire-and-forget — no reply needed. Called from PboTensor’s Drop impl.