pub struct Array3D { /* private fields */ }Expand description
A 3-D CUDA array. Element format chosen at creation; channels are 1/2/4.
Implementations§
Source§impl Array3D
impl Array3D
Sourcepub fn new(
context: &Context,
width: usize,
height: usize,
depth: usize,
format: ArrayFormat,
num_channels: u32,
) -> Result<Self>
pub fn new( context: &Context, width: usize, height: usize, depth: usize, format: ArrayFormat, num_channels: u32, ) -> Result<Self>
Allocate a plain width × height × depth 3-D array.
Sourcepub fn with_flags(
context: &Context,
width: usize,
height: usize,
depth: usize,
format: ArrayFormat,
num_channels: u32,
flags: u32,
) -> Result<Self>
pub fn with_flags( context: &Context, width: usize, height: usize, depth: usize, format: ArrayFormat, num_channels: u32, flags: u32, ) -> Result<Self>
Allocate with custom flags (layered, cubemap, surface-ldst, etc. —
see baracuda_cuda_sys::types::CUarray3D_flags).
Sourcepub unsafe fn from_borrowed(
context: &Context,
handle: CUarray,
width: usize,
height: usize,
depth: usize,
format: ArrayFormat,
num_channels: u32,
) -> Self
pub unsafe fn from_borrowed( context: &Context, handle: CUarray, width: usize, height: usize, depth: usize, format: ArrayFormat, num_channels: u32, ) -> Self
Wrap an existing array handle (e.g. a mipmap level) without taking ownership. Drop is a no-op; the parent owns lifetime.
§Safety
handle must be a valid CUarray that outlives this wrapper.
pub fn as_raw(&self) -> CUarray
pub fn width(&self) -> usize
pub fn height(&self) -> usize
pub fn depth(&self) -> usize
Sourcepub fn bytes_per_element(&self) -> usize
pub fn bytes_per_element(&self) -> usize
Element width in bytes (channel size × channel count).
Sourcepub fn copy_from_host<T: DeviceRepr>(&self, host: &[T]) -> Result<()>
pub fn copy_from_host<T: DeviceRepr>(&self, host: &[T]) -> Result<()>
Synchronous host → 3-D array copy. host.len() must equal
width × max(height, 1) × max(depth, 1).
Sourcepub fn copy_to_host<T: DeviceRepr>(&self, host: &mut [T]) -> Result<()>
pub fn copy_to_host<T: DeviceRepr>(&self, host: &mut [T]) -> Result<()>
Synchronous 3-D array → host copy.
Sourcepub fn copy_from_host_async<T: DeviceRepr>(
&self,
host: &[T],
stream: &Stream,
) -> Result<()>
pub fn copy_from_host_async<T: DeviceRepr>( &self, host: &[T], stream: &Stream, ) -> Result<()>
Async variant of Array3D::copy_from_host on stream.
Note: CUDA requires the host buffer to be pinned for real async
behavior — otherwise the driver falls back to a sync copy.