pub struct Memcpy2DParams {
pub src_pitch: usize,
pub dst_pitch: usize,
pub width: usize,
pub height: usize,
}Expand description
Parameters for a 2D (pitched) memory copy.
A “pitched” allocation stores 2D data where each row occupies
pitch bytes, of which only width bytes contain actual data.
The remaining pitch - width bytes per row are alignment padding.
Both source and destination may have different pitches (e.g., when
copying between allocations created by different cuMemAllocPitch
calls or between host and device memory).
Fields§
§src_pitch: usizeBytes per row in the source (including padding).
dst_pitch: usizeBytes per row in the destination (including padding).
width: usizeBytes of actual data to copy per row.
height: usizeNumber of rows to copy.
Implementations§
Source§impl Memcpy2DParams
impl Memcpy2DParams
Sourcepub fn new(
src_pitch: usize,
dst_pitch: usize,
width: usize,
height: usize,
) -> Self
pub fn new( src_pitch: usize, dst_pitch: usize, width: usize, height: usize, ) -> Self
Creates new 2D copy parameters.
§Parameters
src_pitch- Source bytes per row (including padding).dst_pitch- Destination bytes per row (including padding).width- Data bytes to copy per row.height- Number of rows.
Sourcepub fn validate(&self) -> CudaResult<()>
pub fn validate(&self) -> CudaResult<()>
Validates the parameters.
Checks that width <= both pitches, and that all dimensions are non-zero.
§Errors
Returns CudaError::InvalidValue if any constraint is violated.
Sourcepub fn src_byte_extent(&self) -> usize
pub fn src_byte_extent(&self) -> usize
Returns the total bytes that would be read from the source.
This is (height - 1) * src_pitch + width to account for the
fact that the last row does not need trailing padding.
Sourcepub fn dst_byte_extent(&self) -> usize
pub fn dst_byte_extent(&self) -> usize
Returns the total bytes that would be written to the destination.
Trait Implementations§
Source§impl Clone for Memcpy2DParams
impl Clone for Memcpy2DParams
Source§fn clone(&self) -> Memcpy2DParams
fn clone(&self) -> Memcpy2DParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more