Skip to main content

WgpuBlur

Struct WgpuBlur 

Source
pub struct WgpuBlur { /* private fields */ }
Expand description

The wgpu implementation of BackdropBlur. Holds the fixed pipeline machinery (bind-group layout, sampler, Gaussian/downsample/upsample pipelines) and the per-(size) scratch (Gaussian ping-pong + dual-Kawase pyramid) + per-target-format composite caches, so repeated frosted surfaces reuse them.

Implementations§

Source§

impl WgpuBlur

Source

pub fn new(device: &Device) -> Self

Build the fixed pipeline machinery. The Gaussian pipeline (always writing the internal scratch format) is built now; composite pipelines are built lazily per target format.

Trait Implementations§

Source§

impl BackdropBlur for WgpuBlur

Source§

type Device = Device

The GPU device (wgpu::Device; glow::Context).
Source§

type Queue = Queue

The upload queue (wgpu::Queue; () for glow, which uploads via the context).
Source§

type Encoder = CommandEncoder

The command sink (wgpu::CommandEncoder; glow::Context, the immediate-mode handle).
Source§

type SourceTexture = SourceView

A sampleable backdrop (wgpu::TextureView; glow::Texture). Own-loop backends receive it from the host; grab-pass backends produce it via GrabPass::grab_source.
Source§

type Target = TextureView

The composite destination (wgpu::TextureView; a glow framebuffer).
Source§

type TargetFormat = TextureFormat

The target’s color format (wgpu::TextureFormat; a GLES internal-format enum). Passed to prepare because wgpu bakes the fragment-target format into the composite pipeline at creation, so the pipeline is cached per format.
Source§

type Prepared = WgpuPrepared

An owned, opaque per-call handle carrying the resolved payload (kernel offsets, tint, ResolvedMask, target rect, and the resource keys) from prepare to record. Owned — it borrows nothing from the blurrer.
Source§

fn prepare( &mut self, device: &Self::Device, _queue: &Self::Queue, source: &Self::SourceTexture, target_format: Self::TargetFormat, request: &BlurRequest, ) -> Result<Option<Self::Prepared>, BlurError>

Phase 1 — holds the device + queue. Allocates and keys the ping-pong chain, lazily builds and caches pipelines (the fixed-scratch down/up pipelines once; the composite pipeline per target_format), and resolves the payload into an owned Prepared. Read more
Source§

fn record( &self, encoder: &mut Self::Encoder, target: &Self::Target, prepared: &Self::Prepared, ) -> Result<(), BlurError>

Phase 2 — holds only the encoder + target. Records downsample → upsample → composite for a prepared produced earlier in the same frame. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,