pub struct PboTensor<T>{
pub name: String,
pub shape: Vec<usize>,
/* private fields */
}Expand description
A tensor backed by an OpenGL Pixel Buffer Object.
Fields§
§name: String§shape: Vec<usize>Implementations§
Source§impl<T> PboTensor<T>
impl<T> PboTensor<T>
Sourcepub fn from_pbo(
buffer_id: u32,
size: usize,
shape: &[usize],
name: Option<&str>,
ops: Arc<dyn PboOps>,
) -> Result<Self>
pub fn from_pbo( buffer_id: u32, size: usize, shape: &[usize], name: Option<&str>, ops: Arc<dyn PboOps>, ) -> Result<Self>
Create a new PBO tensor from an already-allocated GL buffer.
Called by the image crate after creating the PBO on the GL thread.
Users should not call this directly — use ImageProcessor::create_image().
§Errors
Returns Error::ShapeMismatch if size does not equal
shape.iter().product::<usize>() * std::mem::size_of::<T>().
Returns Error::InvalidSize if size is zero.
Trait Implementations§
impl<T> Send for PboTensor<T>
impl<T> Sync for PboTensor<T>
Source§impl<T> TensorTrait<T> for PboTensor<T>
impl<T> TensorTrait<T> for PboTensor<T>
Source§fn set_logical_shape(&mut self, shape: &[usize]) -> Result<()>
fn set_logical_shape(&mut self, shape: &[usize]) -> Result<()>
Capacity-based reconfigure (mirrors Mem/Shm/DMA/IOSurface): allow any
shape whose byte size fits the PBO allocation, so an oversized reusable
pool can be configure_imaged to a smaller image. Without this PBO fell
back to the strict-reshape default and rejected pool reuse.
Source§fn view(&self, offset_bytes: usize, shape: &[usize]) -> Result<Self>
fn view(&self, offset_bytes: usize, shape: &[usize]) -> Result<Self>
Zero-copy sub-region view sharing this PBO’s GL buffer (via the
Arc<PboHandle>) and BufferIdentity, positioned at offset_bytes
from this tensor’s own window with logical shape. The GL backend keys
the import on the shared identity and addresses the window via
glViewport / the staged copy; a CPU map adds view_offset to the
mapped base. Mirrors DmaTensor::view.
§Errors
Error::InvalidOperationifoffset_bytesis mis-aligned forT.Error::InsufficientCapacityif the window exceeds the allocation.
Source§fn new(_shape: &[usize], _name: Option<&str>) -> Result<Self>
fn new(_shape: &[usize], _name: Option<&str>) -> Result<Self>
Source§fn from_fd(_fd: OwnedFd, _shape: &[usize], _name: Option<&str>) -> Result<Self>
fn from_fd(_fd: OwnedFd, _shape: &[usize], _name: Option<&str>) -> Result<Self>
Source§fn memory(&self) -> TensorMemory
fn memory(&self) -> TensorMemory
Source§fn reshape(&mut self, shape: &[usize]) -> Result<()>
fn reshape(&mut self, shape: &[usize]) -> Result<()>
Source§fn capacity_bytes(&self) -> usize
fn capacity_bytes(&self) -> usize
size()).
Defaults to the logical size for storages without spare capacity.Source§fn map(&self) -> Result<TensorMap<T>>
fn map(&self) -> Result<TensorMap<T>>
Source§fn buffer_identity(&self) -> &BufferIdentity
fn buffer_identity(&self) -> &BufferIdentity
Auto Trait Implementations§
impl<T> !RefUnwindSafe for PboTensor<T>
impl<T> !UnwindSafe for PboTensor<T>
impl<T> Freeze for PboTensor<T>
impl<T> Unpin for PboTensor<T>where
T: Unpin,
impl<T> UnsafeUnpin for PboTensor<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more