pub struct WgpuAccelerator { /* private fields */ }Expand description
GPU-backed accelerator using wgpu (Vulkan / Metal / DX12 / WebGPU).
If no GPU is available the constructor fails; use AcceleratorBuilder
which transparently falls back to CpuAccelerator.
All operations currently delegate to the CPU path while the wgpu compute pipeline is being set up. The struct is intentionally structured so that individual operations can be migrated to GPU shaders without changing the public interface.
Implementations§
Source§impl WgpuAccelerator
impl WgpuAccelerator
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a WgpuAccelerator with automatic device selection.
§Errors
Returns GpuError::NoAdapter if no GPU is available.
Sourcepub fn gpu_device(&self) -> &Arc<GpuDevice> ⓘ
pub fn gpu_device(&self) -> &Arc<GpuDevice> ⓘ
Underlying GPU device.
Trait Implementations§
Source§impl GpuAccelerator for WgpuAccelerator
impl GpuAccelerator for WgpuAccelerator
Source§fn rgb_to_yuv(
&self,
input: &[u8],
output: &mut [u8],
width: u32,
height: u32,
) -> Result<()>
fn rgb_to_yuv( &self, input: &[u8], output: &mut [u8], width: u32, height: u32, ) -> Result<()>
Convert packed RGBA data to packed YUVA using BT.601 coefficients. Read more
Source§fn yuv_to_rgb(
&self,
input: &[u8],
output: &mut [u8],
width: u32,
height: u32,
) -> Result<()>
fn yuv_to_rgb( &self, input: &[u8], output: &mut [u8], width: u32, height: u32, ) -> Result<()>
Convert packed YUVA data to packed RGBA using BT.601 coefficients. Read more
Source§fn scale_bilinear(
&self,
input: &[u8],
src_width: u32,
src_height: u32,
output: &mut [u8],
dst_width: u32,
dst_height: u32,
) -> Result<()>
fn scale_bilinear( &self, input: &[u8], src_width: u32, src_height: u32, output: &mut [u8], dst_width: u32, dst_height: u32, ) -> Result<()>
Resize packed RGBA image using bilinear interpolation. Read more
Source§fn gaussian_blur(
&self,
input: &[u8],
output: &mut [u8],
width: u32,
height: u32,
sigma: f32,
) -> Result<()>
fn gaussian_blur( &self, input: &[u8], output: &mut [u8], width: u32, height: u32, sigma: f32, ) -> Result<()>
Apply a separable Gaussian blur to a packed RGBA image. Read more
Source§fn edge_detect(
&self,
input: &[u8],
output: &mut [u8],
width: u32,
height: u32,
) -> Result<()>
fn edge_detect( &self, input: &[u8], output: &mut [u8], width: u32, height: u32, ) -> Result<()>
Detect edges using the Sobel operator on a packed RGBA image. Read more
Source§fn sharpen(
&self,
input: &[u8],
output: &mut [u8],
width: u32,
height: u32,
amount: f32,
) -> Result<()>
fn sharpen( &self, input: &[u8], output: &mut [u8], width: u32, height: u32, amount: f32, ) -> Result<()>
Sharpen a packed RGBA image using an unsharp mask. Read more
Source§fn dct_2d(
&self,
input: &[f32],
output: &mut [f32],
width: u32,
height: u32,
) -> Result<()>
fn dct_2d( &self, input: &[f32], output: &mut [f32], width: u32, height: u32, ) -> Result<()>
Compute the 2-D Type-II DCT on a grid of
f32 values. Read moreSource§fn idct_2d(
&self,
input: &[f32],
output: &mut [f32],
width: u32,
height: u32,
) -> Result<()>
fn idct_2d( &self, input: &[f32], output: &mut [f32], width: u32, height: u32, ) -> Result<()>
Auto Trait Implementations§
impl Freeze for WgpuAccelerator
impl !RefUnwindSafe for WgpuAccelerator
impl Send for WgpuAccelerator
impl Sync for WgpuAccelerator
impl Unpin for WgpuAccelerator
impl UnsafeUnpin for WgpuAccelerator
impl !UnwindSafe for WgpuAccelerator
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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