Skip to main content

wgpu_cuda_interop/
lib.rs

1#[cfg(feature = "cuda")]
2pub mod cuda;
3#[cfg(feature = "cuda")]
4pub mod cuda_ext;
5#[cfg(feature = "cuda")]
6pub mod cuda_vulkan_interop;
7#[cfg(feature = "cuda")]
8pub mod interop;
9#[cfg(feature = "cuda")]
10pub mod vulkan_wgpu_interop;
11
12#[derive(Clone, Copy, PartialEq, Eq)]
13pub struct AllocSize {
14    pub height: usize,
15    pub width: usize,
16    pub stride: usize, //stride between rows (width * nr_channels * bytes per channel)
17}
18impl AllocSize {
19    pub fn full_size(&self) -> usize {
20        self.height * self.stride
21    }
22    pub fn stride_padded(&self) -> usize {
23        let output_stride = self.stride;
24        let align = wgpu::COPY_BYTES_PER_ROW_ALIGNMENT as usize;
25        let padding = (align - output_stride % align) % align;
26        output_stride + padding
27    }
28    pub fn full_size_padded(&self) -> usize {
29        self.height * self.stride_padded()
30    }
31}
32
33#[derive(Clone)]
34pub struct VulkanGpu {
35    pub device: ash::Device,
36    pub instance: ash::Instance,
37    pub physical_device: ash::vk::PhysicalDevice,
38}